From c3b7296868b26b7ae3157ca909787cf645dea4c4 Mon Sep 17 00:00:00 2001 From: Gekocaretaker <61918937+Gekocaretaker@users.noreply.github.com> Date: Fri, 27 Mar 2026 19:38:45 -0600 Subject: [PATCH] Update to 26.1 --- build.gradle | 16 +++++++--------- gradle.properties | 9 ++++----- src/main/java/de/dafuqs/fractal/Fractal.java | 2 +- .../de/dafuqs/fractal/api/CreativeSubTab.java | 6 +++--- .../dafuqs/fractal/api/CreativeSubTabEvent.java | 10 +++++----- .../fractal/impl/client/SmallFontRenderer.java | 6 +++--- .../CreativeModeInventoryScreenAddTabsMixin.java | 13 +++++++------ ...iveModeInventoryScreenCustomTextureMixin.java | 13 +++++++------ src/main/resources/fabric.mod.json | 10 +--------- ...ractal.accesswidener => fractal.classtweaker} | 5 ++++- 10 files changed, 42 insertions(+), 48 deletions(-) rename src/main/resources/{fractal.accesswidener => fractal.classtweaker} (74%) diff --git a/build.gradle b/build.gradle index ac18a68..fa6556f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.14-SNAPSHOT' + id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' id 'maven-publish' } @@ -32,12 +32,10 @@ repositories { dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - //mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" // Recipe viewers //modCompileOnly "dev.emi:emi-fabric:${emi_version}" @@ -54,7 +52,7 @@ dependencies { } loom { - accessWidenerPath = file("src/main/resources/fractal.accesswidener") + accessWidenerPath = file("src/main/resources/fractal.classtweaker") } processResources { @@ -71,14 +69,14 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 25 } java { withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } jar { diff --git a/gradle.properties b/gradle.properties index 0cd9e15..8617300 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,18 +3,17 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.21.11 -yarn_mappings=1.21.11+build.3 -loader_version=0.18.3 +minecraft_version=26.1 +loader_version=0.18.5 # Mod Properties -mod_version=1.6.0+1.21.11 +mod_version=1.6.0+26.1 maven_group=de.dafuqs archives_base_name=fractal # Dependencies # check this on https://fabricmc.net/develop/ -fabric_api_version=0.140.0+1.21.11 +fabric_api_version=0.144.3+26.1 #rei_version=20.0.811 # emi dieded diff --git a/src/main/java/de/dafuqs/fractal/Fractal.java b/src/main/java/de/dafuqs/fractal/Fractal.java index 207d3c8..10dab0b 100644 --- a/src/main/java/de/dafuqs/fractal/Fractal.java +++ b/src/main/java/de/dafuqs/fractal/Fractal.java @@ -40,7 +40,7 @@ public class Fractal implements ModInitializer { public static final Identifier GROUP_ID = Identifier.fromNamespaceAndPath("mymod", "main"); - public static final CreativeModeTab MAIN = FabricItemGroup.builder() + public static final CreativeModeTab MAIN = FabricCreativeModeTab.builder() .icon(() -> new ItemStack(Blocks.REDSTONE_BLOCK)) .displayItems((itemDisplayParameters, output) -> { for (CreativeSubTab subGroup : Fractal.MAIN.fractal$getChildren()) { diff --git a/src/main/java/de/dafuqs/fractal/api/CreativeSubTab.java b/src/main/java/de/dafuqs/fractal/api/CreativeSubTab.java index 9d5d6e1..f9f6f37 100644 --- a/src/main/java/de/dafuqs/fractal/api/CreativeSubTab.java +++ b/src/main/java/de/dafuqs/fractal/api/CreativeSubTab.java @@ -1,7 +1,7 @@ package de.dafuqs.fractal.api; import net.fabricmc.fabric.api.event.*; -import net.fabricmc.fabric.api.itemgroup.v1.*; +import net.fabricmc.fabric.api.creativetab.v1.*; import net.minecraft.core.registries.*; import net.minecraft.network.chat.*; import net.minecraft.resources.*; @@ -73,8 +73,8 @@ protected void triggerEntryUpdateEvent(ItemDisplayParameters context) { // Convert the entries to lists List mutableDisplayStacks = new LinkedList<>(displayItems); List mutableSearchTabStacks = new LinkedList<>(displayItemsSearchTab); - FabricItemGroupEntries entries = new FabricItemGroupEntries(context, mutableDisplayStacks, mutableSearchTabStacks); // scary ApiStatus.Internal usage - + FabricCreativeModeTabOutput entries = new FabricCreativeModeTabOutput(context, mutableDisplayStacks, mutableSearchTabStacks); // scary ApiStatus.Internal usage + final Event modifyEntriesEvent = CreativeSubTabEvent.modifyEntriesEvent(identifier); if (modifyEntriesEvent != null) { diff --git a/src/main/java/de/dafuqs/fractal/api/CreativeSubTabEvent.java b/src/main/java/de/dafuqs/fractal/api/CreativeSubTabEvent.java index dd737b3..ec63ff0 100644 --- a/src/main/java/de/dafuqs/fractal/api/CreativeSubTabEvent.java +++ b/src/main/java/de/dafuqs/fractal/api/CreativeSubTabEvent.java @@ -2,7 +2,7 @@ import de.dafuqs.fractal.impl.*; import net.fabricmc.fabric.api.event.*; -import net.fabricmc.fabric.api.itemgroup.v1.*; +import net.fabricmc.fabric.api.creativetab.v1.*; import net.minecraft.resources.*; public final class CreativeSubTabEvent { @@ -38,9 +38,9 @@ public interface ModifyEntries { /** * Modifies the item group entries. * @param entries the entries - * @see FabricItemGroupEntries + * @see FabricCreativeModeTabOutput */ - void modifyEntries(FabricItemGroupEntries entries); + void modifyEntries(FabricCreativeModeTabOutput entries); } @FunctionalInterface @@ -49,8 +49,8 @@ public interface ModifyEntriesAll { * Modifies the item group entries. * @param group the item group that is being modified * @param entries the entries - * @see FabricItemGroupEntries + * @see FabricCreativeModeTabOutput */ - void modifyEntries(CreativeSubTab group, FabricItemGroupEntries entries); + void modifyEntries(CreativeSubTab group, FabricCreativeModeTabOutput entries); } } \ No newline at end of file diff --git a/src/main/java/de/dafuqs/fractal/impl/client/SmallFontRenderer.java b/src/main/java/de/dafuqs/fractal/impl/client/SmallFontRenderer.java index 6e0b920..e264921 100644 --- a/src/main/java/de/dafuqs/fractal/impl/client/SmallFontRenderer.java +++ b/src/main/java/de/dafuqs/fractal/impl/client/SmallFontRenderer.java @@ -5,7 +5,7 @@ import net.fabricmc.fabric.api.resource.v1.ResourceLoader; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.resources.Identifier; import net.minecraft.server.packs.PackType; @@ -22,7 +22,7 @@ public class SmallFontRenderer { private static final Identifier SILVER_FNT = Identifier.fromNamespaceAndPath("fractal", "textures/gui/silver.fnt"); private static AngelFont SILVER; - public static void draw(GuiGraphics ctx, String str, int x, int y, boolean rtl, int textColor) { + public static void draw(GuiGraphicsExtractor ctx, String str, int x, int y, boolean rtl, int textColor) { int[] codePoints = str.codePoints().toArray(); if (rtl) { int hf = codePoints.length/2; @@ -59,7 +59,7 @@ public static void draw(GuiGraphics ctx, String str, int x, int y, boolean rtl, } else { if (!hasRegisteredReloader) { hasRegisteredReloader = true; - ResourceLoader.get(PackType.CLIENT_RESOURCES).registerReloader(Identifier.fromNamespaceAndPath("fractal", "font_loader"), new Reloader()); + ResourceLoader.get(PackType.CLIENT_RESOURCES).registerReloadListener(Identifier.fromNamespaceAndPath("fractal", "font_loader"), new Reloader()); } if (SILVER == null) { SILVER = Reloader.parse(Minecraft.getInstance().getResourceManager()); diff --git a/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenAddTabsMixin.java b/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenAddTabsMixin.java index 47611df..859fb48 100644 --- a/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenAddTabsMixin.java +++ b/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenAddTabsMixin.java @@ -42,9 +42,10 @@ public CreativeModeInventoryScreenAddTabsMixin(CreativeModeInventoryScreen.ItemP private int fractal$x, fractal$h; // left tabs @Unique private int fractal$x2, fractal$h2; // right tabs - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen;renderTooltip(Lnet/minecraft/client/gui/GuiGraphics;II)V")) - public void fractal$render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta, CallbackInfo ci) { + + // Old + @Inject(method = "extractRenderState", at = @At(value = "TAIL")) + public void fractal$render(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (!(selectedTab instanceof ICreativeTabParent parent) || parent.fractal$getChildren().isEmpty()) return; var matrices = guiGraphics.pose(); @@ -54,12 +55,12 @@ public CreativeModeInventoryScreenAddTabsMixin(CreativeModeInventoryScreen.ItemP if (!selectedTab.showTitle()) { CreativeModeTab child = parent.fractal$getSelectedChild(); var selected = selectedTab.getDisplayName(); - guiGraphics.drawString(font, selected, 8, 6, CommonColors.DARK_GRAY, false); + guiGraphics.text(font, selected, 8, 6, CommonColors.DARK_GRAY, false); int x = 8 + font.width(selected); if (child != null) { - guiGraphics.drawString(font, " ", x, 6, CommonColors.DARK_GRAY, false); + guiGraphics.text(font, " ", x, 6, CommonColors.DARK_GRAY, false); x += font.width(" "); - guiGraphics.drawString(font, child.getDisplayName(), x, 6, CommonColors.DARK_GRAY, false); + guiGraphics.text(font, child.getDisplayName(), x, 6, CommonColors.DARK_GRAY, false); } } diff --git a/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenCustomTextureMixin.java b/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenCustomTextureMixin.java index eb3c30e..7b5773d 100644 --- a/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenCustomTextureMixin.java +++ b/src/main/java/de/dafuqs/fractal/mixin/client/CreativeModeInventoryScreenCustomTextureMixin.java @@ -25,14 +25,14 @@ public abstract class CreativeModeInventoryScreenCustomTextureMixin { private CreativeModeTab fractal$renderedItemGroup; // BACKGROUND - @ModifyArg(method = "renderBg", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIFFIIII)V")) + @ModifyArg(method = "extractBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIFFIIII)V")) private Identifier injectCustomGroupTexture(Identifier original) { CreativeSubTab subGroup = getSelectedSubGroup(); return (subGroup == null || subGroup.getStyle().backgroundTexture() == null) ? original : subGroup.getStyle().backgroundTexture(); } // SCROLLBAR - @ModifyArg(method = "renderBg", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIFFIIII)V")) + @ModifyArg(method = "extractBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIFFIIII)V")) private Identifier injectCustomScrollbarTexture(Identifier original) { CreativeSubTab subGroup = getSelectedSubGroup(); if(subGroup != null) { @@ -45,12 +45,13 @@ private Identifier injectCustomScrollbarTexture(Identifier original) { } // ICON - @Inject(method = "renderTabButton", at = @At("HEAD")) - private void captureContextGroup(GuiGraphics guiGraphics, int i, int j, CreativeModeTab creativeModeTab, CallbackInfo ci) { + @Inject(method = "extractTabButton", at = @At("HEAD")) + private void captureContextGroup(GuiGraphicsExtractor graphics, int mouseX, int mouseY, CreativeModeTab creativeModeTab, CallbackInfo ci) { this.fractal$renderedItemGroup = creativeModeTab; } - - @ModifyArg(method = "renderTabButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIII)V")) + + // Old + @ModifyArg(method = "extractTabButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;blitSprite(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIII)V")) private Identifier injectCustomTabTexture(Identifier original) { CreativeSubTab subGroup = getRenderedSubGroup(); if(subGroup == null) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 01d668d..30bf0eb 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -19,21 +19,13 @@ "mixins": [ "fractal.mixins.json" ], - "accessWidener": "fractal.accesswidener", + "accessWidener": "fractal.classtweaker", "depends": { "minecraft": ">=${minecraft_version}", "fabricloader": "*", "fabric-api": "*" }, "custom": { - "loom:injected_interfaces": { - "net/minecraft/class_1761": [ - "de/dafuqs/fractal/interfaces/ICreativeTabParent" - ], - "net/minecraft/class_481": [ - "de/dafuqs/fractal/interfaces/ISubTabLocation" - ] - }, "modmenu": { "badges": [ "library" ] } diff --git a/src/main/resources/fractal.accesswidener b/src/main/resources/fractal.classtweaker similarity index 74% rename from src/main/resources/fractal.accesswidener rename to src/main/resources/fractal.classtweaker index e3efbc2..849c379 100644 --- a/src/main/resources/fractal.accesswidener +++ b/src/main/resources/fractal.classtweaker @@ -1,4 +1,4 @@ -accessWidener v1 named +classTweaker v1 official accessible method net/minecraft/world/item/CreativeModeTab (Lnet/minecraft/world/item/CreativeModeTab$Row;ILnet/minecraft/world/item/CreativeModeTab$Type;Lnet/minecraft/network/chat/Component;Ljava/util/function/Supplier;Lnet/minecraft/world/item/CreativeModeTab$DisplayItemsGenerator;)V accessible class net/minecraft/world/item/CreativeModeTab$ItemDisplayBuilder @@ -6,3 +6,6 @@ accessible field net/minecraft/world/item/CreativeModeTab$ItemDisplayParameters accessible field net/minecraft/world/item/CreativeModeTab displayItemsGenerator Lnet/minecraft/world/item/CreativeModeTab$DisplayItemsGenerator; accessible field net/minecraft/world/item/CreativeModeTab displayItems Ljava/util/Collection; accessible field net/minecraft/world/item/CreativeModeTab displayItemsSearchTab Ljava/util/Set; + +transitive-inject-interface net/minecraft/world/item/CreativeModeTab de/dafuqs/fractal/interfaces/ICreativeTabParent +transitive-inject-interface net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen de/dafuqs/fractal/interfaces/ISubTabLocation