diff --git a/build.gradle b/build.gradle index 7d1c5e5..4071417 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + id "me.shedaniel.unified-publishing" version "0.1.+" apply false } architectury { @@ -36,7 +37,22 @@ allprojects { tasks.withType(JavaCompile) { options.encoding = "UTF-8" - options.release = 17 + options.release = 21 + } + ext { + releaseChangelog = { + def changes = new StringBuilder() + changes << "## MidnightLib v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/MidnightLib/commits/)" + def proc = "git log --max-count=1 --pretty=format:%s".execute() + proc.in.eachLine { line -> + def processedLine = line.toString() + if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) { + changes << "\n- ${processedLine.capitalize()}" + } + } + proc.waitFor() + return changes.toString() + } } java { diff --git a/common/build.gradle b/common/build.gradle index 21d4a73..ceedbf7 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -2,10 +2,6 @@ architectury { common(rootProject.enabled_platforms.split(",")) } -loom { - accessWidenerPath = file("src/main/resources/midnightlib.accesswidener") -} - dependencies { // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies // Do NOT use other classes from fabric loader diff --git a/MidnightConfigExample.java b/common/src/main/java/eu/midnightdust/core/config/MidnightConfigExample.java similarity index 68% rename from MidnightConfigExample.java rename to common/src/main/java/eu/midnightdust/core/config/MidnightConfigExample.java index 2975aea..83954e5 100644 --- a/MidnightConfigExample.java +++ b/common/src/main/java/eu/midnightdust/core/config/MidnightConfigExample.java @@ -13,22 +13,22 @@ import java.util.List; public class MidnightConfigExample extends MidnightConfig { - @Comment(category = "text") public static Comment text1; // Comments are rendered like an option without a button and are excluded from the config file - @Comment(category = "text", centered = true) public static Comment text2; // Centered comments are the same as normal ones - just centered! - @Comment(category = "text") public static Comment spacer1; // Comments containing the word "spacer" will just appear as a blank line - @Entry(category = "text") public static boolean showInfo = true; // Example for a boolean option - @Entry(category = "text") public static String name = "Hello World!"; // Example for a string option, which is in a category! - @Entry(category = "text") public static TestEnum testEnum = TestEnum.FABRIC; // Example for an enum option - public enum TestEnum { // Enums allow the user to cycle through predefined options + @Comment(category = "text") public static Comment text1; // Comments are rendered like an option without a button and are excluded from the config file + @Comment(category = "text", centered = true) public static Comment text2; // Centered comments are the same as normal ones - just centered! + @Comment(category = "text") public static Comment spacer1; // Comments containing the word "spacer" will just appear as a blank line + @Entry(category = "text") public static boolean showInfo = true; // Example for a boolean option + @Entry(category = "text") public static String name = "Hello World!"; // Example for a string option, which is in a category! + @Entry(category = "text") public static TestEnum testEnum = TestEnum.FABRIC; // Example for an enum option + public enum TestEnum { // Enums allow the user to cycle through predefined options QUILT, FABRIC, FORGE } - @Entry(category = "numbers") public static int fabric = 16777215; // Example for an int option - @Entry(category = "numbers") public static double world = 1.4D; // Example for a double option - @Entry(category = "numbers", min=69,max=420) public static int hello = 420; // - The entered number has to be larger than 69 and smaller than 420 - @Entry(category = "text", width = 7, min = 7, isColor = true, name = "I am a color!") public static String titleColor = "#ffffff"; // The isColor property adds a preview box for a hexadecimal color - @Entry(category = "text", name = "I am an array list!") public static List arrayList = Lists.newArrayList("String1", "String2"); // Array String Lists are also supported - @Entry(category = "sliders", name = "I am an int slider.",isSlider = true, min = 0, max = 100) public static int intSlider = 35; // Int fields can also be displayed as a Slider - @Entry(category = "sliders", name = "I am a float slider!", isSlider = true, min = 0f, max = 1f, precision = 1000) public static float floatSlider = 0.24f; // And so can floats! Precision defines the amount of decimal places + @Entry(category = "numbers") public static int fabric = 16777215; // Example for an int option + @Entry(category = "numbers") public static double world = 1.4D; // Example for a double option + @Entry(category = "numbers", min=69,max=420) public static int hello = 420; // - The entered number has to be larger than 69 and smaller than 420 + @Entry(category = "text", isColor = true) public static String titleColor = "#ffffff"; // The isColor property adds a preview box for a hexadecimal color + @Entry(category = "text") public static List arrayList = Lists.newArrayList(); // Array String Lists are also supported + @Entry(isSlider = true, min = 0, max = 100) public static int intSlider = 35; // Int fields can also be displayed as a Slider + @Entry(isSlider = true, min = 0f, max = 1f) public static float floatSlider = 0.24f; // And so can floats! Precision defines the amount of decimal places // The name field can be used to specify a custom translation string or plain text public static int imposter = 16777215; // - Entries without an @Entry or @Comment annotation are ignored diff --git a/common/src/main/java/eu/midnightdust/core/mixin/MixinOptionsScreen.java b/common/src/main/java/eu/midnightdust/core/mixin/MixinOptionsScreen.java new file mode 100644 index 0000000..6ce5b88 --- /dev/null +++ b/common/src/main/java/eu/midnightdust/core/mixin/MixinOptionsScreen.java @@ -0,0 +1,49 @@ +package eu.midnightdust.core.mixin; + +import eu.midnightdust.core.config.MidnightLibConfig; +import eu.midnightdust.core.screen.MidnightConfigOverviewScreen; +import eu.midnightdust.lib.util.PlatformFunctions; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.option.OptionsScreen; +import net.minecraft.client.gui.widget.TextIconButtonWidget; +import net.minecraft.client.gui.widget.ThreePartsLayoutWidget; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Objects; + +@Mixin(OptionsScreen.class) +public class MixinOptionsScreen extends Screen { + @Shadow @Final private ThreePartsLayoutWidget layout; + @Unique TextIconButtonWidget button = TextIconButtonWidget.builder(Text.translatable("midnightlib.overview.title"), ( + buttonWidget) -> Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(this)), true) + .texture(new Identifier("midnightlib","icon/midnightlib"), 16, 16).dimension(20, 20).build(); + @Unique boolean shouldShowButton = MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.TRUE) || (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.MODMENU) && !PlatformFunctions.isModLoaded("modmenu")); + + protected MixinOptionsScreen(Text title) {super(title);} + @Inject(at = @At("HEAD"), method = "init") + public void midnightlib$onInit(CallbackInfo ci) { + if (shouldShowButton) { + this.midnightlib$setupButton(); + this.addDrawableChild(button); + } + } + + @Override + public void resize(MinecraftClient client, int width, int height) { + super.resize(client, width, height); + if (shouldShowButton) this.midnightlib$setupButton(); + } + @Unique + public void midnightlib$setupButton() { + button.setPosition(layout.getWidth() / 2 + 158, layout.getY() + layout.getFooterHeight() - 4); + } +} \ No newline at end of file diff --git a/common/src/main/java/eu/midnightdust/core/screen/MidnightConfigOverviewScreen.java b/common/src/main/java/eu/midnightdust/core/screen/MidnightConfigOverviewScreen.java index 12e5da9..85cdd93 100755 --- a/common/src/main/java/eu/midnightdust/core/screen/MidnightConfigOverviewScreen.java +++ b/common/src/main/java/eu/midnightdust/core/screen/MidnightConfigOverviewScreen.java @@ -1,19 +1,14 @@ package eu.midnightdust.core.screen; import eu.midnightdust.core.MidnightLib; -import eu.midnightdust.core.config.MidnightLibConfig; import eu.midnightdust.lib.config.MidnightConfig; -import eu.midnightdust.lib.util.PlatformFunctions; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.option.OptionsScreen; import net.minecraft.client.gui.widget.*; import net.minecraft.screen.ScreenTexts; import net.minecraft.text.*; -import net.minecraft.util.Identifier; import java.util.*; @@ -29,10 +24,9 @@ public class MidnightConfigOverviewScreen extends Screen { @Override protected void init() { - this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).dimensions(this.width / 2 - 100, this.height - 28, 200, 20).build()); + this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).dimensions(this.width / 2 - 100, this.height - 26, 200, 20).build()); - this.list = new MidnightConfig.MidnightConfigListWidget(this.client, this.width, this.height - 64, 32, 25); - if (this.client != null && this.client.world != null) this.list.setRenderBackground(false); + this.list = new MidnightConfig.MidnightConfigListWidget(this.client, this.width, this.height - 57, 24, 25); this.addSelectableChild(this.list); List sortedMods = new ArrayList<>(MidnightConfig.configClass.keySet()); Collections.sort(sortedMods); @@ -46,22 +40,9 @@ public class MidnightConfigOverviewScreen extends Screen { } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { - if (client != null && client.world != null) super.renderInGameBackground(context); - this.list.render(context, mouseX, mouseY, delta); super.render(context, mouseX, mouseY, delta); + this.list.render(context, mouseX, mouseY, delta); - context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 15, 0xFFFFFF); - } - @Override public void renderBackground(DrawContext c, int x, int y, float d) {} - - public static void addButtonToOptionsScreen(Screen screen, MinecraftClient client) { - if (screen.getClass() == OptionsScreen.class && MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.TRUE) - || (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.MODMENU) && !PlatformFunctions.isModLoaded("modmenu"))) { - TextIconButtonWidget button = TextIconButtonWidget.builder(Text.translatable("midnightlib.overview.title"), ( - buttonWidget) -> Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(screen)), true) - .texture(new Identifier("midnightlib","icon/midnightlib"), 16, 16).dimension(20, 20).build(); - button.setPosition(screen.width / 2 + 158, screen.height / 6 - 12); - screen.addDrawableChild(button); - } + context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 10, 0xFFFFFF); } } \ No newline at end of file diff --git a/common/src/main/java/eu/midnightdust/lib/config/MidnightConfig.java b/common/src/main/java/eu/midnightdust/lib/config/MidnightConfig.java index a9ee4ae..048ca30 100755 --- a/common/src/main/java/eu/midnightdust/lib/config/MidnightConfig.java +++ b/common/src/main/java/eu/midnightdust/lib/config/MidnightConfig.java @@ -5,6 +5,7 @@ import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.mojang.blaze3d.systems.RenderSystem; import eu.midnightdust.lib.util.PlatformFunctions; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -19,7 +20,6 @@ import net.minecraft.client.gui.tab.Tab; import net.minecraft.client.gui.tab.TabManager; import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.*; -import net.minecraft.client.render.RenderLayer; import net.minecraft.client.resource.language.I18n; import net.minecraft.screen.ScreenTexts; import net.minecraft.text.OrderedText; @@ -168,7 +168,7 @@ public abstract class MidnightConfig { info.value = isNumber? value : s; else if (inLimits) { if (((List) info.value).size() == info.index) ((List) info.value).add(""); - ((List) info.value).set(info.index, Arrays.stream(info.tempValue.replace("[", "").replace("]", "").split(", ")).toList().get(0)); + ((List) info.value).set(info.index, Arrays.stream(info.tempValue.replace("[", "").replace("]", "").split(", ")).toList().getFirst()); } if (info.field.getAnnotation(Entry.class).isColor()) { @@ -292,7 +292,7 @@ public abstract class MidnightConfig { this.addDrawableChild(ButtonWidget.builder(ScreenTexts.CANCEL, button -> { loadValues(); Objects.requireNonNull(client).setScreen(parent); - }).dimensions(this.width / 2 - 154, this.height - 28, 150, 20).build()); + }).dimensions(this.width / 2 - 154, this.height - 26, 150, 20).build()); done = this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> { for (EntryInfo info : entries) if (info.id.equals(modid)) { @@ -302,10 +302,9 @@ public abstract class MidnightConfig { } write(modid); Objects.requireNonNull(client).setScreen(parent); - }).dimensions(this.width / 2 + 4, this.height - 28, 150, 20).build()); + }).dimensions(this.width / 2 + 4, this.height - 26, 150, 20).build()); - this.list = new MidnightConfigListWidget(this.client, this.width, this.height - 64, 32, 25); - if (this.client != null && this.client.world != null) this.list.setRenderBackground(false); + this.list = new MidnightConfigListWidget(this.client, this.width, this.height - 57, 24, 25); this.addSelectableChild(this.list); fillList(); @@ -382,21 +381,32 @@ public abstract class MidnightConfig { } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { - if (client != null && client.world != null) super.renderInGameBackground(context); - this.list.render(context, mouseX, mouseY, delta); super.render(context,mouseX,mouseY,delta); + this.list.render(context, mouseX, mouseY, delta); - if (tabs.size() < 2) context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 15, 0xFFFFFF); + if (tabs.size() < 2) + context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 10, 0xFFFFFF); + list.renderHeaderSeperator = tabs.size() < 2; } - @Override public void renderBackground(DrawContext c, int x, int y, float d) {} } @Environment(EnvType.CLIENT) public static class MidnightConfigListWidget extends ElementListWidget { + boolean renderHeaderSeperator = true; public MidnightConfigListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { super(client, width, height, y, itemHeight); } @Override - public int getScrollbarPositionX() { return this.width -7; } + public int getScrollbarX() { return this.width -7; } + + @Override + protected void drawHeaderAndFooterSeparators(DrawContext context) { + if (renderHeaderSeperator) super.drawHeaderAndFooterSeparators(context); + else { + RenderSystem.enableBlend(); + context.drawTexture(this.client.world == null ? Screen.FOOTER_SEPARATOR_TEXTURE : Screen.INWORLD_FOOTER_SEPARATOR_TEXTURE, this.getX(), this.getBottom(), 0.0F, 0.0F, this.getWidth(), 2, 32, 2); + RenderSystem.disableBlend(); + } + } public void addButton(List buttons, Text text, EntryInfo info) { this.addEntry(new ButtonEntry(buttons, text, info)); @@ -404,36 +414,28 @@ public abstract class MidnightConfig { public void clear() { this.clearEntries(); } @Override public int getRowWidth() { return 10000; } - @Override - protected void renderDecorations(DrawContext c, int mouseX, int mouseY) { - c.setShaderColor(0.25F, 0.25F, 0.25F, 1.0F); - c.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, this.getX(), 0, 0.0F, 0.0F, this.width, this.getY(), 32, 32); - c.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, this.getX(), this.getBottom(), 0.0F, 0.0F, this.width, this.height, 32, 32); - c.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - if (client == null || client.world == null) return; - c.fillGradient(RenderLayer.getGuiOverlay(), this.getX(), this.getY(), this.getRight(), this.getY() + 4, -16777216, 0, 0); - c.fillGradient(RenderLayer.getGuiOverlay(), this.getX(), this.getBottom() - 4, this.getRight(), this.getBottom(), 0, -16777216, 0); - } } public static class ButtonEntry extends ElementListWidget.Entry { private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer; public final List buttons; private final Text text; public final EntryInfo info; + public boolean centered = false; public static final Map buttonsWithText = new HashMap<>(); - private ButtonEntry(List buttons, Text text, EntryInfo info) { - if (!buttons.isEmpty()) buttonsWithText.put(buttons.get(0),text); + public ButtonEntry(List buttons, Text text, EntryInfo info) { + if (!buttons.isEmpty()) buttonsWithText.put(buttons.getFirst(),text); this.buttons = buttons; this.text = text; this.info = info; + if (info != null) this.centered = info.centered; } public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { buttons.forEach(b -> { b.setY(y); b.render(context, mouseX, mouseY, tickDelta); }); if (text != null && (!text.getString().contains("spacer") || !buttons.isEmpty())) { int wrappedY = y; for(Iterator textIterator = textRenderer.wrapLines(text, (buttons.size() > 1 ? buttons.get(1).getX()-24 : MinecraftClient.getInstance().getWindow().getScaledWidth() - 24)).iterator(); textIterator.hasNext(); wrappedY += 9) { - context.drawTextWithShadow(textRenderer, textIterator.next(), (info.centered) ? (MinecraftClient.getInstance().getWindow().getScaledWidth() / 2 - (textRenderer.getWidth(text) / 2)) : 12, wrappedY + 5, 0xFFFFFF); + context.drawTextWithShadow(textRenderer, textIterator.next(), (centered) ? (MinecraftClient.getInstance().getWindow().getScaledWidth() / 2 - (textRenderer.getWidth(text) / 2)) : 12, wrappedY + 5, 0xFFFFFF); } } } diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json index 093c5d3..9e26dfe 100644 --- a/common/src/main/resources/architectury.common.json +++ b/common/src/main/resources/architectury.common.json @@ -1,3 +1 @@ -{ - "accessWidener": "midnightlib.accesswidener" -} \ No newline at end of file +{} \ No newline at end of file diff --git a/common/src/main/resources/midnightlib.accesswidener b/common/src/main/resources/midnightlib.accesswidener deleted file mode 100644 index 561ebaa..0000000 --- a/common/src/main/resources/midnightlib.accesswidener +++ /dev/null @@ -1,3 +0,0 @@ -accessWidener v2 named - -accessible method net/minecraft/client/gui/screen/Screen addDrawableChild (Lnet/minecraft/client/gui/Element;)Lnet/minecraft/client/gui/Element; \ No newline at end of file diff --git a/common/src/main/resources/midnightlib.mixins.json b/common/src/main/resources/midnightlib.mixins.json new file mode 100644 index 0000000..20c4305 --- /dev/null +++ b/common/src/main/resources/midnightlib.mixins.json @@ -0,0 +1 @@ +{"required": true,"minVersion": "0.8","package": "eu.midnightdust.core.mixin","compatibilityLevel": "JAVA_17","client": ["MixinOptionsScreen"],"injectors": {"defaultRequire": 1}} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 4cfbb4b..bcc3e13 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,6 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" + id "me.shedaniel.unified-publishing" } repositories { maven { url "https://maven.terraformersmc.com/releases" } @@ -25,7 +26,7 @@ configurations { dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - modImplementation ("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") + modCompileOnly ("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } @@ -47,7 +48,6 @@ shadowJar { } remapJar { - injectAccessWidener = true input.set shadowJar.archiveFile dependsOn shadowJar } @@ -64,16 +64,38 @@ components.java { } } -publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = archives_base_name + "-" + project.name - from components.java +unifiedPublishing { + project { + displayName = "MidnightLib v$project.version - Fabric $project.minecraft_version" + releaseType = "$project.release_type" + changelog = releaseChangelog() + gameVersions = [] + gameLoaders = ["fabric","quilt"] + mainPublication remapJar + relations { + depends { + curseforge = "fabric-api" + modrinth = "fabric-api" + } + } + + var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN") + if (CURSEFORGE_TOKEN != null) { + curseforge { + token = CURSEFORGE_TOKEN + id = rootProject.curseforge_id + gameVersions.addAll "Java 21", project.minecraft_version + } + } + + var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN") + if (MODRINTH_TOKEN != null) { + modrinth { + token = MODRINTH_TOKEN + id = rootProject.modrinth_id + version = "$project.version-$project.name" + gameVersions.addAll project.minecraft_version + } } } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } } \ No newline at end of file diff --git a/fabric/src/main/java/eu/midnightdust/fabric/core/MidnightLibFabric.java b/fabric/src/main/java/eu/midnightdust/fabric/core/MidnightLibFabric.java index f1cffed..2919334 100644 --- a/fabric/src/main/java/eu/midnightdust/fabric/core/MidnightLibFabric.java +++ b/fabric/src/main/java/eu/midnightdust/fabric/core/MidnightLibFabric.java @@ -1,21 +1,14 @@ package eu.midnightdust.fabric.core; import eu.midnightdust.core.MidnightLib; -import eu.midnightdust.core.screen.MidnightConfigOverviewScreen; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.DedicatedServerModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; public class MidnightLibFabric implements ClientModInitializer, DedicatedServerModInitializer { @Override @Environment(EnvType.CLIENT) - public void onInitializeClient() { - MidnightLib.onInitializeClient(); - ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { - MidnightConfigOverviewScreen.addButtonToOptionsScreen(screen, client); - }); - } + public void onInitializeClient() {MidnightLib.onInitializeClient();} @Override @Environment(EnvType.SERVER) public void onInitializeServer() {MidnightLib.onInitializeServer();} } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 3944bac..8bc8a5e 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -32,9 +32,13 @@ }, "depends": { "fabric-resource-loader-v0": "*", - "minecraft": ">=1.20.3" + "minecraft": ">=1.20.4" }, + "mixins": [ + "midnightlib.mixins.json" + ], + "custom": { "modmenu": { "links": { @@ -46,6 +50,5 @@ }, "badges": [ "library" ] } - }, - "accessWidener": "midnightlib.accesswidener" + } } diff --git a/gradle.properties b/gradle.properties index 16e2ba3..7cc82cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,20 @@ org.gradle.jvmargs=-Xmx4096M -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.1 -enabled_platforms=fabric,neoforge +minecraft_version=1.20.6 +yarn_mappings=1.20.6+build.1 +enabled_platforms=fabric archives_base_name=midnightlib -mod_version=1.5.3 +mod_version=1.5.5 maven_group=eu.midnightdust +release_type=release +curseforge_id=488090 +modrinth_id=codAaoxh -fabric_loader_version=0.15.1 -fabric_api_version=0.91.1+1.20.4 +fabric_loader_version=0.15.11 +fabric_api_version=0.97.8+1.20.6 -neoforge_version=20.4.12-beta +neoforge_version=20.6.30-beta quilt_loader_version=0.19.0-beta.18 quilt_fabric_api_version=7.0.1+0.83.0-1.20 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a595206..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/neoforge/src/main/java/eu/midnightdust/lib/util/neoforge/PlatformFunctionsImpl.java b/neoforge/src/main/java/eu/midnightdust/lib/util/neoforge/PlatformFunctionsImpl.java index 16ee0a0..d2d5a19 100644 --- a/neoforge/src/main/java/eu/midnightdust/lib/util/neoforge/PlatformFunctionsImpl.java +++ b/neoforge/src/main/java/eu/midnightdust/lib/util/neoforge/PlatformFunctionsImpl.java @@ -23,6 +23,6 @@ public class PlatformFunctionsImpl { return ModList.get().isLoaded(modid); } public static void registerCommand(LiteralArgumentBuilder command) { - // Ignored here, see MidnightLibServerEvents#registerCommands + // Ignored here, see MidnightLibNeoForge#registerCommands } } diff --git a/neoforge/src/main/java/eu/midnightdust/neoforge/MidnightLibNeoForge.java b/neoforge/src/main/java/eu/midnightdust/neoforge/MidnightLibNeoForge.java index 31b0124..bdf4df0 100644 --- a/neoforge/src/main/java/eu/midnightdust/neoforge/MidnightLibNeoForge.java +++ b/neoforge/src/main/java/eu/midnightdust/neoforge/MidnightLibNeoForge.java @@ -38,13 +38,6 @@ public class MidnightLibNeoForge { }); } } - @Mod.EventBusSubscriber(modid = "midnightlib", value = Dist.CLIENT) - public static class MidnightLibClientEvents { - @SubscribeEvent - public static void afterInitScreen(ScreenEvent.Init.Post event) { - MidnightConfigOverviewScreen.addButtonToOptionsScreen(event.getScreen(), event.getScreen().getMinecraft()); - } - } @Mod.EventBusSubscriber(modid = "midnightlib", value = Dist.DEDICATED_SERVER) public static class MidnightLibServerEvents { diff --git a/settings.gradle b/settings.gradle index d64842c..f865b79 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,6 +11,6 @@ include("common") include("fabric-like") include("fabric") //include("quilt") -include("neoforge") +//include("neoforge") rootProject.name = "midnightlib"