diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bc440c9..aa23a60 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,7 +5,7 @@ name: Java CI with Gradle on: push: - branches: [ neoforge-1.20.6 ] + branches: [ dev-1.21.0 ] pull_request: types: [ opened, synchronize, reopened ] diff --git a/build.gradle b/build.gradle index e164c3c..d35ba6a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,20 @@ plugins { id 'idea' id 'maven-publish' id 'org.gradle.crypto.checksum' version '1.4.0' - id 'net.neoforged.gradle.userdev' version '7.0.105' + id 'net.neoforged.gradle.userdev' version '7.0.142' } java.toolchain.languageVersion = JavaLanguageVersion.of(21) -minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') +minecraft { + // FML looks for this mod id to find the minecraft classes + modIdentifier 'minecraft' + + accessTransformers { + file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') + entry 'public net.minecraft.client.gui.Gui renderSlot(Lnet/minecraft/client/gui/GuiGraphics;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V' + } +} runs { // applies to all the run configs below @@ -58,10 +66,19 @@ runs { // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } +repositories { + maven { + url "https://www.cursemaven.com" + } + maven { + url 'https://maven.blamejared.com' + } +} + dependencies { implementation "net.neoforged:neoforge:${neo_version}" -// implementation "curse.maven:jei-238222:5101381" + implementation "curse.maven:jei-238222:5437447" } tasks.withType(ProcessResources).configureEach { diff --git a/gradle.properties b/gradle.properties index 8689a2e..e4b44dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,28 +1,22 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G +#org.gradle.jvmargs= org.gradle.daemon=false +org.gradle.debug=false -#neogradle.subsystems.parchment.minecraftVersion=1.20.6 -#neogradle.subsystems.parchment.mappingsVersion=2023.12.31 - -minecraft_version=1.20.6 -neo_version=20.6.43-beta -mapping_channel=official -mapping_version=1.20.6 - +neogradle.subsystems.parchment.minecraftVersion=1.20.6 +neogradle.subsystems.parchment.mappingsVersion=2024.05.01 ## Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.20.6 +minecraft_version=1.21 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.20.6,1.21) +minecraft_version_range=[1.21,1.22) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=20.6.42-beta +neo_version=21.0.10-beta # The Neo version range can use any version of Neo as bounds -neo_version_range=[20.6,) +neo_version_range=[21.0.0-beta,) # The loader version range can only use the major version of FML as bounds loader_version_range=[2,) @@ -37,7 +31,7 @@ mod_name=Inventory Tweaks Refoxed # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=Apache License, Version 2.0 # The mod version. See https://semver.org/ -mod_version=1.20.6-1.1.1 +mod_version=1.21.0-1.1.1 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/invtweaks/config/Category.java b/src/main/java/invtweaks/config/Category.java index eb58ee5..14f1ef8 100644 --- a/src/main/java/invtweaks/config/Category.java +++ b/src/main/java/invtweaks/config/Category.java @@ -41,8 +41,8 @@ private static Optional> compileClause(String clause) { String[] parts = clause.split(":", 2); if (parts[0].equals("/tag")) { - TagKey itemKey = TagKey.create(BuiltInRegistries.ITEM.key(), new ResourceLocation(parts[1])); - TagKey blockKey = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(parts[1])); + TagKey itemKey = TagKey.create(BuiltInRegistries.ITEM.key(), ResourceLocation.parse(parts[1])); + TagKey blockKey = TagKey.create(BuiltInRegistries.BLOCK.key(), ResourceLocation.parse(parts[1])); return Optional.of(stack -> stack.is(itemKey) || ( stack.getItem() instanceof BlockItem blockItem @@ -65,7 +65,7 @@ private static Optional> compileClause(String clause) { } else { // default to standard item checking try { return Optional.of( - st -> Objects.equals(BuiltInRegistries.ITEM.getKey(st.getItem()), new ResourceLocation(clause))); + st -> Objects.equals(BuiltInRegistries.ITEM.getKey(st.getItem()), ResourceLocation.parse(clause))); } catch (ResourceLocationException e) { InvTweaksMod.LOGGER.warn("Invalid item resource location found."); return Optional.empty(); diff --git a/src/main/java/invtweaks/events/ClientEvents.java b/src/main/java/invtweaks/events/ClientEvents.java index 08c1b0f..7587ff1 100644 --- a/src/main/java/invtweaks/events/ClientEvents.java +++ b/src/main/java/invtweaks/events/ClientEvents.java @@ -13,6 +13,7 @@ import invtweaks.util.Sorting; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.Screen; @@ -239,7 +240,7 @@ public static void renderOverlay(RenderGuiLayerEvent.Post event) { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - Minecraft.getInstance().gui.renderSlot(event.getGuiGraphics(), iprime, i2, Minecraft.getInstance().getFrameTime(), ent, toRender, 0); +// Minecraft.getInstance().gui.renderSlot(event.getGuiGraphics(), iprime, i2, DeltaTracker.ZERO, ent, toRender, 0); RenderSystem.disableBlend(); } diff --git a/src/main/java/invtweaks/gui/InvTweaksButton.java b/src/main/java/invtweaks/gui/InvTweaksButton.java index 5521a91..1edd0b2 100644 --- a/src/main/java/invtweaks/gui/InvTweaksButton.java +++ b/src/main/java/invtweaks/gui/InvTweaksButton.java @@ -9,7 +9,7 @@ public class InvTweaksButton extends ExtendedButton { protected static final ResourceLocation button = - new ResourceLocation(InvTweaksMod.MODID, "textures/gui/button_sprites.png"); + ResourceLocation.fromNamespaceAndPath(InvTweaksMod.MODID, "textures/gui/button_sprites.png"); private final int tx; private final int ty; diff --git a/src/main/java/invtweaks/jei/InvTweaksJEI.java b/src/main/java/invtweaks/jei/InvTweaksJEI.java index 27be35c..51b20cf 100644 --- a/src/main/java/invtweaks/jei/InvTweaksJEI.java +++ b/src/main/java/invtweaks/jei/InvTweaksJEI.java @@ -1,29 +1,29 @@ -//package invtweaks.jei; -// -//import invtweaks.InvTweaksMod; -//import invtweaks.events.ClientEvents; -//import mezz.jei.api.IModPlugin; -//import mezz.jei.api.JeiPlugin; -//import mezz.jei.api.runtime.IJeiRuntime; -//import net.minecraft.MethodsReturnNonnullByDefault; -//import net.minecraft.resources.ResourceLocation; -// -//import javax.annotation.ParametersAreNonnullByDefault; -// -//@SuppressWarnings("unused") -//@JeiPlugin -//@ParametersAreNonnullByDefault -//@MethodsReturnNonnullByDefault -//public class InvTweaksJEI implements IModPlugin { -// public static final ResourceLocation UID = new ResourceLocation(InvTweaksMod.MODID, "jei_plugin"); -// -// @Override -// public ResourceLocation getPluginUid() { -// return UID; -// } -// -// @Override -// public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { -// ClientEvents.setJEIKeyboardActiveFn(() -> jeiRuntime.getIngredientListOverlay().hasKeyboardFocus()); -// } -//} +package invtweaks.jei; + +import invtweaks.InvTweaksMod; +import invtweaks.events.ClientEvents; +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.runtime.IJeiRuntime; +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.ParametersAreNonnullByDefault; + +@SuppressWarnings("unused") +@JeiPlugin +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class InvTweaksJEI implements IModPlugin { + public static final ResourceLocation UID = ResourceLocation.fromNamespaceAndPath(InvTweaksMod.MODID, "jei_plugin"); + + @Override + public ResourceLocation getPluginUid() { + return UID; + } + + @Override + public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { + ClientEvents.setJEIKeyboardActiveFn(() -> jeiRuntime.getIngredientListOverlay().hasKeyboardFocus()); + } +} diff --git a/src/main/java/invtweaks/network/PacketSortInv.java b/src/main/java/invtweaks/network/PacketSortInv.java index 11f2271..6ce7168 100644 --- a/src/main/java/invtweaks/network/PacketSortInv.java +++ b/src/main/java/invtweaks/network/PacketSortInv.java @@ -14,7 +14,7 @@ public class PacketSortInv implements CustomPacketPayload, IPayloadHandler TYPE = new Type<>(new ResourceLocation(InvTweaksMod.MODID, "packet_sort_inv")); + public static final Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(InvTweaksMod.MODID, "packet_sort_inv")); public static final StreamCodec CODEC = new StreamCodec<>() { @Override diff --git a/src/main/java/invtweaks/network/PacketUpdateConfig.java b/src/main/java/invtweaks/network/PacketUpdateConfig.java index 2063aa6..c11913e 100644 --- a/src/main/java/invtweaks/network/PacketUpdateConfig.java +++ b/src/main/java/invtweaks/network/PacketUpdateConfig.java @@ -18,7 +18,7 @@ public class PacketUpdateConfig implements CustomPacketPayload, IPayloadHandler { - public static final Type TYPE = new Type<>(new ResourceLocation(InvTweaksMod.MODID, "packet_update_config")); + public static final Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(InvTweaksMod.MODID, "packet_update_config")); public static final StreamCodec CODEC = new StreamCodec<>() { @Override diff --git a/src/main/java/invtweaks/util/Sorting.java b/src/main/java/invtweaks/util/Sorting.java index 7c90c48..0d8d314 100644 --- a/src/main/java/invtweaks/util/Sorting.java +++ b/src/main/java/invtweaks/util/Sorting.java @@ -7,11 +7,6 @@ import invtweaks.config.Category; import invtweaks.config.ContOverride; import invtweaks.config.InvTweaksConfig; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.ints.IntLists; import invtweaks.config.Ruleset; import it.unimi.dsi.fastutil.ints.*; import net.minecraft.client.Minecraft; @@ -23,21 +18,9 @@ import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; -import net.neoforged.neoforge.items.ItemHandlerHelper; import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.PrimitiveIterator; -import java.util.Set; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 8175c4b..94f2889 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1 +1 @@ -public net.minecraft.client.gui.Gui renderSlot(Lnet/minecraft/client/gui/GuiGraphics;IIFLnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V # renderSlot +public net.minecraft.client.gui.Gui renderSlot(Lnet/minecraft/client/gui/GuiGraphics;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V # renderSlot diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 5904b80..917ab33 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -22,6 +22,9 @@ issueTrackerURL="https://github.com/JDKDigital/InvTweaksRefoxed/issues" logoFile="logo.png" displayTest="IGNORE_ALL_VERSION" +[[accessTransformers]] + file="META-INF/accesstransformer.cfg" + [[dependencies.${mod_id}]] modId="neoforge" type="required"