From 2a5948169e45f930c333824bce2c8cacad63abee Mon Sep 17 00:00:00 2001 From: MartinSVK12 <37455793+MartinSVK12@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:20:04 +0200 Subject: [PATCH] Remove unlockAllRecipes gamerule as it is no longer necessary. --- build.gradle | 2 +- gradle.properties | 3 +- .../java/turniplabs/halplibe/HalpLibe.java | 2 - .../mixin/mixins/GuiRenderItemMixin.java | 45 ------------------- .../mixin/mixins/GuiTooltipMixin.java | 29 ------------ .../halplibe/mixin/mixins/MobPageMixin.java | 36 --------------- 6 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.java delete mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/GuiTooltipMixin.java delete mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/MobPageMixin.java diff --git a/build.gradle b/build.gradle index 97463f0..da1a84e 100644 --- a/build.gradle +++ b/build.gradle @@ -108,7 +108,7 @@ dependencies { implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}") include(implementation("org.apache.commons:commons-lang3:3.12.0")) - modImplementation "ModMenu:ModMenu:2.0.4" + modImplementation "ModMenu:ModMenu:${project.mod_menu_version}" } java { diff --git a/gradle.properties b/gradle.properties index 87796c4..ecfdfa3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,9 @@ org.gradle.jvmargs=-Xmx2G # BTA bta_version=7.1 -# Loader +# Loader & Mod Menu loader_version=0.15.6-babric.4-bta +mod_menu_version=2.0.5 # Mod mod_version=3.5.2 diff --git a/src/main/java/turniplabs/halplibe/HalpLibe.java b/src/main/java/turniplabs/halplibe/HalpLibe.java index fa74432..c0cbca3 100644 --- a/src/main/java/turniplabs/halplibe/HalpLibe.java +++ b/src/main/java/turniplabs/halplibe/HalpLibe.java @@ -101,8 +101,6 @@ public void onInitialize() { LOGGER.info("HalpLibe initialized."); } - public static GameRuleBoolean UNLOCK_ALL_RECIPES = GameRules.register(new GameRuleBoolean("unlockAllRecipes", false)); - @Override public void onPreLaunch() { // Initializes halp statics first diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.java deleted file mode 100644 index f4d04df..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.java +++ /dev/null @@ -1,45 +0,0 @@ -package turniplabs.halplibe.mixin.mixins; - -import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiRenderItem; -import net.minecraft.core.item.ItemStack; -import net.minecraft.core.player.inventory.slot.Slot; -import org.spongepowered.asm.mixin.Debug; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import turniplabs.halplibe.HalpLibe; - -@Debug(export = true) -@Mixin( - value = GuiRenderItem.class, - remap = false, - priority = -1 -) -public class GuiRenderItemMixin extends Gui { - - @Shadow - Minecraft mc; - - @Inject(method = "render(Lnet/minecraft/core/item/ItemStack;IIZLnet/minecraft/core/player/inventory/slot/Slot;)V", at = @At("HEAD")) - public void setDiscovered(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci) { - if(mc.theWorld != null && mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES) && slot != null){ - slot.setDiscovered(true); - } - } - - - @Inject(method = "render(Lnet/minecraft/core/item/ItemStack;IIZLnet/minecraft/core/player/inventory/slot/Slot;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/player/inventory/slot/Slot;getBackgroundIconIndex()I", shift = At.Shift.BEFORE)) - public void setDiscovered2(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci, @Local(ordinal = 2) LocalBooleanRef discovered) { - if(mc.theWorld != null && mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES) && slot != null){ - slot.setDiscovered(true); - discovered.set(true); - } - } -} diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiTooltipMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/GuiTooltipMixin.java deleted file mode 100644 index 99aa0c5..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiTooltipMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package turniplabs.halplibe.mixin.mixins; - -import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiTooltip; -import net.minecraft.core.item.ItemStack; -import net.minecraft.core.player.inventory.slot.Slot; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import turniplabs.halplibe.HalpLibe; - -@Mixin(value = GuiTooltip.class, remap = false) -public class GuiTooltipMixin extends Gui { - - @Shadow Minecraft mc; - - @Inject(method = "getTooltipText(Lnet/minecraft/core/item/ItemStack;ZLnet/minecraft/core/player/inventory/slot/Slot;)Ljava/lang/String;", at = @At(value = "FIELD", target = "Lnet/minecraft/core/player/inventory/slot/Slot;discovered:Z", ordinal = 0, shift = At.Shift.AFTER)) - public void getTooltipText(ItemStack itemStack, boolean showDescription, Slot slot, CallbackInfoReturnable cir, @Local(ordinal = 1) LocalBooleanRef discovered) { - if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ - discovered.set(true); - } - } - -} diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/MobPageMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/MobPageMixin.java deleted file mode 100644 index bf1ec79..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/MobPageMixin.java +++ /dev/null @@ -1,36 +0,0 @@ -package turniplabs.halplibe.mixin.mixins; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.guidebook.GuidebookSection; -import net.minecraft.client.gui.guidebook.mobs.MobInfoRegistry; -import net.minecraft.client.gui.guidebook.mobs.MobPage; -import net.minecraft.client.render.FontRenderer; -import net.minecraft.client.render.RenderEngine; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import turniplabs.halplibe.HalpLibe; - -@Mixin(value = MobPage.class, remap = false) -public class MobPageMixin { - @Shadow private boolean discovered; - - @Shadow @Final private static Minecraft mc; - - @Inject(method = "", at = @At("RETURN")) - private void onMobPageInit(GuidebookSection section, Class mobClass, MobInfoRegistry.MobInfo mobInfo, CallbackInfo ci) { - if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ - discovered = true; - } - } - - @Inject(method = "renderForeground", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/guidebook/mobs/MobPage;discovered:Z", ordinal = 0, shift = At.Shift.AFTER)) - public void setDiscovered(RenderEngine re, FontRenderer fr, int x, int y, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ - discovered = true; - } - } -}