From 91d06c237066d5fe1e1f72545b933d12038e8f6a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:12:36 -0800 Subject: [PATCH 1/8] Fix Chorus Farming StackOverflow --- README.md | 3 +- .../universaltweaks/config/UTConfigMods.java | 5 +++ .../universaltweaks/core/UTMixinLoader.java | 1 + .../chorus/mixin/UTChorusWalkerMixin.java | 31 +++++++++++++++++++ .../resources/mixins.mods.enderio.chorus.json | 7 +++++ 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/enderio/chorus/mixin/UTChorusWalkerMixin.java create mode 100644 src/main/resources/mixins.mods.enderio.chorus.json diff --git a/README.md b/README.md index f7098d67..2c2e651d 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,8 @@ All changes are toggleable via config files. * **Emojicord** * **Emoji Context:** Improves emoji context calculation to improve fps when rendering a lot of text * **Ender IO** - * **Replace Obelisk Renderer:** Fixes client-side memory leak by replacing obelisk renderer with a simpler one + * **Fix Chorus Farming StackOverflow:** Fixes the Farming Station Chorus Walker being able to loop though and check the same positions endlessly, causing a StackOverflow + * **Replace Obelisk Renderer:** Fixes client-side memory leak by replacing obelisk renderer with a simpler one * **Ender Storage** * **Fix Frequency Tracking:** Fixes storage frequencies being tracked multiple times * **Epic Siege Mod** diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 5f5e84a4..564fad44 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -526,6 +526,11 @@ public static class EmojicordCategory public static class EnderIOCategory { + @Config.RequiresMcRestart + @Config.Name("Fix Chorus Farming StackOverflow") + @Config.Comment("Fixes the Farming Station Chorus Walker being able to loop though and check the same positions endlessly, causing a StackOverflow") + public boolean utChorusStackOverflow = true; + @Config.RequiresMcRestart @Config.Name("Replace Obelisk Renderer") @Config.Comment("Fixes client-side memory leak by replacing obelisk renderer with a simpler one") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index bd274b1b..f434cecb 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -61,6 +61,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.effortlessbuilding.json", () -> loaded("effortlessbuilding")); put("mixins.mods.elementarystaffs.json", () -> loaded("element")); put("mixins.mods.elenaidodge2.json", () -> loaded("elenaidodge2")); + put("mixins.mods.enderio.chorus.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utChorusStackOverflow); put("mixins.mods.enderstorage.json", () -> loaded("enderstorage") && UTConfigMods.ENDER_STORAGE.utFrequencyTrackFixToggle); put("mixins.mods.epicsiegemod.json", () -> loaded("epicsiegemod")); put("mixins.mods.erebus.cabbage.json", () -> loaded("erebus") && UTConfigMods.EREBUS.utCabbageDrop); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/chorus/mixin/UTChorusWalkerMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/chorus/mixin/UTChorusWalkerMixin.java new file mode 100644 index 00000000..14e05ab3 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/chorus/mixin/UTChorusWalkerMixin.java @@ -0,0 +1,31 @@ +package mod.acgaming.universaltweaks.mods.enderio.chorus.mixin; + +import java.util.Set; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.spongepowered.asm.mixin.Mixin; +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.CallbackInfoReturnable; + +// Courtesy of WaitingIdly +@Mixin(targets = "crazypants.enderio.base.farming.farmers.ChorusFarmer$ChorusWalker", remap = false) +public abstract class UTChorusWalkerMixin +{ + @Unique + private final Set universalTweaks$checkedPositions = new ObjectOpenHashSet<>(); + + /** + * @author WaitingIdly + * @reason Prevent StackOverflows by skipping previously already checked positions. + */ + @Inject(method = "collect", at = @At("HEAD"), cancellable = true) + protected void utIgnoreDuplicatePositions(BlockPos pos, EnumFacing from, CallbackInfoReturnable cir) + { + if (!universalTweaks$checkedPositions.add(pos)) cir.setReturnValue(false); + } +} diff --git a/src/main/resources/mixins.mods.enderio.chorus.json b/src/main/resources/mixins.mods.enderio.chorus.json new file mode 100644 index 00000000..8c9dd538 --- /dev/null +++ b/src/main/resources/mixins.mods.enderio.chorus.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.enderio.chorus.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTChorusWalkerMixin"] +} \ No newline at end of file From 8610cb28b08dfd3e602466fe2afb661e73ed3a39 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:16:13 -0800 Subject: [PATCH 2/8] rename enderio mixin to specify what it fixes --- .../java/mod/acgaming/universaltweaks/core/UTMixinLoader.java | 2 +- .../{ => itemrender}/mixin/UTObeliskSpecialRendererMixin.java | 2 +- ...ns.mods.enderio.json => mixins.mods.enderio.itemrender.json} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/mod/acgaming/universaltweaks/mods/enderio/{ => itemrender}/mixin/UTObeliskSpecialRendererMixin.java (98%) rename src/main/resources/{mixins.mods.enderio.json => mixins.mods.enderio.itemrender.json} (66%) diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index f434cecb..599273ae 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -23,7 +23,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.compactmachines.memory.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utMemoryLeakFixToggle); put("mixins.mods.compactmachines.render.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utCMRenderFixToggle); put("mixins.mods.crafttweaker.json", () -> loaded("crafttweaker")); - put("mixins.mods.enderio.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utReplaceItemRenderer); + put("mixins.mods.enderio.itemrender.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utReplaceItemRenderer); put("mixins.mods.hwyla.json", () -> loaded("waila")); put("mixins.mods.ironchests.json", () -> loaded("ironchest") && UTConfigMods.IRON_CHESTS.utReplaceItemRenderer); put("mixins.mods.modularrouters.json", () -> loaded("modularrouters") && UTConfigMods.MODULAR_ROUTERS.utParticleThreadToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/mixin/UTObeliskSpecialRendererMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/itemrender/mixin/UTObeliskSpecialRendererMixin.java similarity index 98% rename from src/main/java/mod/acgaming/universaltweaks/mods/enderio/mixin/UTObeliskSpecialRendererMixin.java rename to src/main/java/mod/acgaming/universaltweaks/mods/enderio/itemrender/mixin/UTObeliskSpecialRendererMixin.java index 579733e0..7ca858a7 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/mixin/UTObeliskSpecialRendererMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/itemrender/mixin/UTObeliskSpecialRendererMixin.java @@ -1,4 +1,4 @@ -package mod.acgaming.universaltweaks.mods.enderio.mixin; +package mod.acgaming.universaltweaks.mods.enderio.itemrender.mixin; import java.util.Random; import javax.annotation.Nonnull; diff --git a/src/main/resources/mixins.mods.enderio.json b/src/main/resources/mixins.mods.enderio.itemrender.json similarity index 66% rename from src/main/resources/mixins.mods.enderio.json rename to src/main/resources/mixins.mods.enderio.itemrender.json index 58f0aa8e..fdd5ed82 100644 --- a/src/main/resources/mixins.mods.enderio.json +++ b/src/main/resources/mixins.mods.enderio.itemrender.json @@ -1,5 +1,5 @@ { - "package": "mod.acgaming.universaltweaks.mods.enderio.mixin", + "package": "mod.acgaming.universaltweaks.mods.enderio.itemrender.mixin", "refmap": "universaltweaks.refmap.json", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", From 6b0ca22b34d50ffb668740efda67c33780a54b8f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:17:41 -0800 Subject: [PATCH 3/8] fix missorted mixin entries --- .../mod/acgaming/universaltweaks/core/UTLoadingPlugin.java | 4 ++-- .../java/mod/acgaming/universaltweaks/core/UTMixinLoader.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index a98e85e4..a93a63ef 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -117,12 +117,12 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.entities.spawning.golem.json", () -> UTConfigTweaks.ENTITIES.NO_GOLEMS.utNGIronGolemToggle || UTConfigTweaks.ENTITIES.NO_GOLEMS.utNGSnowGolemToggle || UTConfigTweaks.ENTITIES.NO_GOLEMS.utNGWitherToggle); put("mixins.tweaks.entities.spawning.husk.json", () -> UTConfigTweaks.ENTITIES.utHuskStraySpawningToggle); put("mixins.tweaks.entities.spawning.portal.json", () -> UTConfigTweaks.ENTITIES.utPortalSpawningToggle); + put("mixins.tweaks.entities.spawning.skeletontrap.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle); put("mixins.tweaks.entities.spawning.stray.json", () -> UTConfigTweaks.ENTITIES.utHuskStraySpawningToggle); put("mixins.tweaks.entities.speed.boat.json", () -> UTConfigTweaks.ENTITIES.utBoatSpeed != 0.04D); put("mixins.tweaks.entities.speed.cobweb.json", () -> UTConfigTweaks.ENTITIES.COBWEB_SLOWNESS.utCobwebSlownessToggle); put("mixins.tweaks.entities.speed.player.json", () -> UTConfigTweaks.ENTITIES.PLAYER_SPEED.utPlayerSpeedToggle); put("mixins.tweaks.entities.taming.horse.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utTamingUndeadHorsesToggle); - put("mixins.tweaks.entities.spawning.skeletontrap.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle); put("mixins.tweaks.entities.trading.json", () -> UTConfigTweaks.ENTITIES.utVillagerTradeLevelingToggle || UTConfigTweaks.ENTITIES.utVillagerTradeRestockToggle); put("mixins.tweaks.entities.voidteleport.json", () -> UTConfigTweaks.ENTITIES.VOID_TELEPORT.utVoidTeleportToggle); put("mixins.tweaks.items.attackcooldown.server.json", () -> UTConfigTweaks.ITEMS.ATTACK_COOLDOWN.utAttackCooldownToggle); @@ -189,8 +189,8 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.mods.emojicord.emojicontext.json", () -> UTConfigMods.EMOJICORD.utEmojiContextToggle && emojicordLoaded); put("mixins.tweaks.blocks.betterplacement.json", () -> UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementToggle); put("mixins.tweaks.blocks.hitdelay.json", () -> UTConfigTweaks.BLOCKS.utBlockHitDelay != 5); - put("mixins.tweaks.entities.jumping.autojump.json", () -> UTConfigTweaks.ENTITIES.utAutoJumpToggle); put("mixins.tweaks.entities.burning.player.json", () -> UTConfigTweaks.ENTITIES.utFirstPersonBurningOverlay != -0.3D); + put("mixins.tweaks.entities.jumping.autojump.json", () -> UTConfigTweaks.ENTITIES.utAutoJumpToggle); put("mixins.tweaks.entities.playerdismount.json", () -> UTConfigTweaks.MISC.utUseSeparateDismountKey); put("mixins.tweaks.entities.playerf5.json", () -> UTConfigTweaks.ENTITIES.utThirdPersonIgnoresNonSolidBlocks); put("mixins.tweaks.items.attackcooldown.client.json", () -> UTConfigTweaks.ITEMS.ATTACK_COOLDOWN.utAttackCooldownToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 599273ae..1e2e11dc 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -98,8 +98,8 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.rftoolsdimensions.json", () -> loaded("rftoolsdim")); put("mixins.mods.roost.contenttweaker.json", () -> loaded("contenttweaker")); put("mixins.mods.simpledifficulty.json", () -> loaded("simpledifficulty")); - put("mixins.mods.steamworld.json", () -> loaded("steamworld") && UTConfigMods.STEAMWORLD.utSkyOfOldFixToggle); put("mixins.mods.spiceoflife.dupes.json", () -> loaded("spiceoflife") && UTConfigMods.SPICE_OF_LIFE.utDuplicationFixesToggle); + put("mixins.mods.steamworld.json", () -> loaded("steamworld") && UTConfigMods.STEAMWORLD.utSkyOfOldFixToggle); put("mixins.mods.tconstruct.json", () -> loaded("tconstruct")); put("mixins.mods.tconstruct.oredictcache.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle); put("mixins.mods.tconstruct.toolcustomization.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConToolCustomizationToggle); From 2499b25d532f4ac546eebb32be8434f535987101 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 16 Dec 2024 02:56:58 -0800 Subject: [PATCH 4/8] debug testdummy --- dependencies.gradle | 1 + gradle.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/dependencies.gradle b/dependencies.gradle index 008bd942..95b2dd60 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -134,6 +134,7 @@ final def mod_dependencies = [ 'curse.maven:tardis-290247:2903453' : [debug_tardis], 'curse.maven:tech-reborn-233564:2966851' : [debug_tech_reborn], 'curse.maven:teslacorelib-254602:2891841' : [debug_industrial_foregoing], + 'curse.maven:test_dummy-225738:2503041' : [debug_test_dummy], 'curse.maven:thaumcraft-223628:2629023' : [debug_thaumcraft, debug_thaumic_wonders], 'curse.maven:thaumicwonders-316704:2787954' : [debug_thaumic_wonders], 'curse.maven:the-erebus-220698:3211974' : [debug_erebus], diff --git a/gradle.properties b/gradle.properties index 0f63ee83..73463e1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -62,6 +62,7 @@ debug_steamworld = false debug_storage_drawers = false debug_tardis = false debug_tech_reborn = false +debug_test_dummy = false debug_thaumcraft = false debug_thaumic_wonders = false debug_the_farlanders = false From 034a108649c1293e09e99f450719af20cc276341 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 16 Dec 2024 03:00:54 -0800 Subject: [PATCH 5/8] Copy Armor to Test Dummy --- .../universaltweaks/config/UTConfigMods.java | 16 +++++++ .../universaltweaks/core/UTMixinLoader.java | 1 + .../copyarmor/mixin/UTEntityDummyMixin.java | 42 +++++++++++++++++++ .../mixins.mods.testdummy.copyarmor.json | 7 ++++ 4 files changed, 66 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/testdummy/copyarmor/mixin/UTEntityDummyMixin.java create mode 100644 src/main/resources/mixins.mods.testdummy.copyarmor.json diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 564fad44..51c60901 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -243,6 +243,10 @@ public class UTConfigMods @Config.Name("Tech Reborn") public static final TechRebornCategory TECH_REBORN = new TechRebornCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.test_dummy") + @Config.Name("MmmMmmMmmMmm") + public static final TestDummyCategory TEST_DUMMY = new TestDummyCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.tc") @Config.Name("Thaumcraft") public static final ThaumcraftCategory THAUMCRAFT = new ThaumcraftCategory(); @@ -940,6 +944,18 @@ public static class TechRebornCategory public boolean utOptimizeRollingMachineToggle = true; } + public static class TestDummyCategory + { + @Config.RequiresMcRestart + @Config.Name("Copy Armor Stacks to Dummy") + @Config.Comment + ({ + "Instead of deleting the original itemstack being equipped, use a copy of it and do not drop armor.", + "This is primarily relevant for fixing a duplication bug involving EnderIO Armor and its interact with being \"destroyed\"" + }) + public boolean utCopyArmor = true; + } + public static class ThaumcraftCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 1e2e11dc..8ed505f9 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -105,6 +105,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.tconstruct.toolcustomization.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConToolCustomizationToggle); put("mixins.mods.tconstruct.toolcustomization.plustic.json", () -> loaded("tconstruct") && loaded("plustic") && UTConfigMods.TINKERS_CONSTRUCT.utTConToolCustomizationToggle); put("mixins.mods.techreborn.json", () -> loaded("techreborn")); + put("mixins.mods.testdummy.copyarmor.json", () -> loaded("testdummy") && UTConfigMods.TEST_DUMMY.utCopyArmor); put("mixins.mods.thaumcraft.foci.focuseffects.json", () -> loaded("thaumcraft")); put("mixins.mods.thaumcraft.foci.focusmediums.json", () -> loaded("thaumcraft")); put("mixins.mods.thaumcraft.json", () -> loaded("thaumcraft")); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/testdummy/copyarmor/mixin/UTEntityDummyMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/testdummy/copyarmor/mixin/UTEntityDummyMixin.java new file mode 100644 index 00000000..6b3c7967 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/testdummy/copyarmor/mixin/UTEntityDummyMixin.java @@ -0,0 +1,42 @@ +package mod.acgaming.universaltweaks.mods.testdummy.copyarmor.mixin; + +import net.minecraft.item.ItemStack; + +import boni.dummy.EntityDummy; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import mod.acgaming.universaltweaks.config.UTConfigMods; + +// Courtesy of WaitingIdly +@Mixin(value = EntityDummy.class, remap = false) +public abstract class UTEntityDummyMixin +{ + /** + * @author WaitingIdly + */ + @WrapWithCondition(method = "equipArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;shrink(I)V", remap = true)) + private boolean utDisableShrink(ItemStack instance, int quantity) + { + return !UTConfigMods.TEST_DUMMY.utCopyArmor; + } + + /** + * @author WaitingIdly + */ + @WrapWithCondition(method = {"equipArmor", "removeArmor"}, at = @At(value = "INVOKE", target = "Lboni/dummy/EntityDummy;entityDropItem(Lnet/minecraft/item/ItemStack;F)Lnet/minecraft/entity/item/EntityItem;", remap = true)) + private boolean utDisableDrop(EntityDummy instance, ItemStack itemStack, float v) + { + return !UTConfigMods.TEST_DUMMY.utCopyArmor; + } + + /** + * @author WaitingIdly + */ + @WrapWithCondition(method = {"dismantle"}, at = @At(value = "INVOKE", target = "Lboni/dummy/EntityDummy;dropEquipment(ZI)V", remap = true)) + private boolean utDisableDismantleEquipmentDrop(EntityDummy instance, boolean b, int i) + { + return !UTConfigMods.TEST_DUMMY.utCopyArmor; + } + +} diff --git a/src/main/resources/mixins.mods.testdummy.copyarmor.json b/src/main/resources/mixins.mods.testdummy.copyarmor.json new file mode 100644 index 00000000..59397b3c --- /dev/null +++ b/src/main/resources/mixins.mods.testdummy.copyarmor.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.testdummy.copyarmor.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTEntityDummyMixin"] +} \ No newline at end of file From 928810e14e67f638e033df85720769ffb31670d2 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 16 Dec 2024 08:40:51 -0800 Subject: [PATCH 6/8] fix cycle buttons not saving properly --- README.md | 1 + .../universaltweaks/config/UTConfigMods.java | 5 +++ .../universaltweaks/core/UTMixinLoader.java | 1 + .../mixin/UTBasicItemFilterGuiAccessor.java | 14 ++++++ .../mixin/UTPickerOverlayMixin.java | 44 +++++++++++++++++++ .../mixin/UTTooltipButtonAccessor.java | 14 ++++++ .../mixins.mods.enderio.cyclebutton.json | 7 +++ 7 files changed, 86 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTBasicItemFilterGuiAccessor.java create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTPickerOverlayMixin.java create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTTooltipButtonAccessor.java create mode 100644 src/main/resources/mixins.mods.enderio.cyclebutton.json diff --git a/README.md b/README.md index 2c2e651d..e300eabf 100644 --- a/README.md +++ b/README.md @@ -339,6 +339,7 @@ All changes are toggleable via config files. * **Ender IO** * **Fix Chorus Farming StackOverflow:** Fixes the Farming Station Chorus Walker being able to loop though and check the same positions endlessly, causing a StackOverflow * **Replace Obelisk Renderer:** Fixes client-side memory leak by replacing obelisk renderer with a simpler one + * **Save Filter Cycle Buttons Properly:** Fixes an issue where Cycle Buttons for Damage do not report being clicked when in the Picker Overlay, preventing changing Damage values until clicked again * **Ender Storage** * **Fix Frequency Tracking:** Fixes storage frequencies being tracked multiple times * **Epic Siege Mod** diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 51c60901..74c0ed21 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -539,6 +539,11 @@ public static class EnderIOCategory @Config.Name("Replace Obelisk Renderer") @Config.Comment("Fixes client-side memory leak by replacing obelisk renderer with a simpler one") public boolean utReplaceItemRenderer = true; + + @Config.RequiresMcRestart + @Config.Name("Save Filter Cycle Buttons Properly") + @Config.Comment("Fixes an issue where Cycle Buttons for Damage do not report being clicked when in the Picker Overlay, preventing changing Damage values until clicked again") + public boolean utSaveFilterCycleButtonProperly = true; } public static class EnderStorageCategory diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 8ed505f9..9a9b500d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -62,6 +62,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.elementarystaffs.json", () -> loaded("element")); put("mixins.mods.elenaidodge2.json", () -> loaded("elenaidodge2")); put("mixins.mods.enderio.chorus.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utChorusStackOverflow); + put("mixins.mods.enderio.cyclebutton.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utSaveFilterCycleButtonProperly); put("mixins.mods.enderstorage.json", () -> loaded("enderstorage") && UTConfigMods.ENDER_STORAGE.utFrequencyTrackFixToggle); put("mixins.mods.epicsiegemod.json", () -> loaded("epicsiegemod")); put("mixins.mods.erebus.cabbage.json", () -> loaded("erebus") && UTConfigMods.EREBUS.utCabbageDrop); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTBasicItemFilterGuiAccessor.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTBasicItemFilterGuiAccessor.java new file mode 100644 index 00000000..f09ca756 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTBasicItemFilterGuiAccessor.java @@ -0,0 +1,14 @@ +package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; + +import com.enderio.core.client.gui.button.CycleButton; +import crazypants.enderio.base.filter.gui.BasicItemFilterGui; +import crazypants.enderio.base.filter.gui.DamageModeIconHolder; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(value = BasicItemFilterGui.class, remap = false) +public interface UTBasicItemFilterGuiAccessor +{ + @Accessor("damageB") + CycleButton getDamageB(); +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTPickerOverlayMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTPickerOverlayMixin.java new file mode 100644 index 00000000..37b4d260 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTPickerOverlayMixin.java @@ -0,0 +1,44 @@ +package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; + +import java.io.IOException; + +import com.enderio.core.api.client.gui.IGuiScreen; +import com.enderio.core.client.gui.button.CycleButton; +import mod.acgaming.universaltweaks.config.UTConfigMods; +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; + +// Courtesy of WaitingIdly +@Mixin(targets = "com.enderio.core.client.gui.button.CycleButton$PickerOverlay", remap = false) +public abstract class UTPickerOverlayMixin +{ + @Shadow + CycleButton cycleButton; + + /** + * @author WaitingIdly + * @reason Update the filter that the damage button was changed when + * interacting with any of internal buttons of the picker overlay. + * This is required to ensure that the filter damage setting is saved. + */ + @Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "Lcom/enderio/core/client/gui/button/CycleButton;setMode(Ljava/lang/Enum;)V", shift = At.Shift.AFTER)) + private void utNotifyFilterOfChange(int x, int y, int b, CallbackInfoReturnable cir) + { + if (!UTConfigMods.ENDER_IO.utSaveFilterCycleButtonProperly) return; + try + { + if (cycleButton instanceof UTTooltipButtonAccessor) + { + IGuiScreen gui = ((UTTooltipButtonAccessor) cycleButton).getGui(); + if (gui instanceof UTBasicItemFilterGuiAccessor) + { + gui.doActionPerformed(((UTBasicItemFilterGuiAccessor) gui).getDamageB()); + } + } + } + catch (IOException ignored) {} + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTTooltipButtonAccessor.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTTooltipButtonAccessor.java new file mode 100644 index 00000000..b720276b --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTTooltipButtonAccessor.java @@ -0,0 +1,14 @@ +package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; + +import com.enderio.core.api.client.gui.IGuiScreen; +import com.enderio.core.client.gui.button.TooltipButton; +import org.jetbrains.annotations.NotNull; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(value = TooltipButton.class, remap = false) +public interface UTTooltipButtonAccessor +{ + @Accessor("gui") + @NotNull IGuiScreen getGui(); +} diff --git a/src/main/resources/mixins.mods.enderio.cyclebutton.json b/src/main/resources/mixins.mods.enderio.cyclebutton.json new file mode 100644 index 00000000..c3c2f020 --- /dev/null +++ b/src/main/resources/mixins.mods.enderio.cyclebutton.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTBasicItemFilterGuiAccessor", "UTPickerOverlayMixin", "UTTooltipButtonAccessor"] +} \ No newline at end of file From 5c077e0abe341c46b90f8603e64c62bf06ada507 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:52:20 -0800 Subject: [PATCH 7/8] Fix Soul Binder JEI Appearance --- README.md | 1 + .../universaltweaks/config/UTConfigMods.java | 5 +++ .../universaltweaks/core/UTMixinLoader.java | 1 + .../UTSoulBinderRecipeCategoryMixin.java | 45 +++++++++++++++++++ .../mixins.mods.enderio.soulbinderjei.json | 7 +++ 5 files changed, 59 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/enderio/soulbinderjei/mixin/UTSoulBinderRecipeCategoryMixin.java create mode 100644 src/main/resources/mixins.mods.enderio.soulbinderjei.json diff --git a/README.md b/README.md index e300eabf..07552301 100644 --- a/README.md +++ b/README.md @@ -338,6 +338,7 @@ All changes are toggleable via config files. * **Emoji Context:** Improves emoji context calculation to improve fps when rendering a lot of text * **Ender IO** * **Fix Chorus Farming StackOverflow:** Fixes the Farming Station Chorus Walker being able to loop though and check the same positions endlessly, causing a StackOverflow + * **Fix Soul Binder JEI Appearance:** Fixes the Soul Binder having empty ingredients or displaying filled soul vials in the output slot incorrectly * **Replace Obelisk Renderer:** Fixes client-side memory leak by replacing obelisk renderer with a simpler one * **Save Filter Cycle Buttons Properly:** Fixes an issue where Cycle Buttons for Damage do not report being clicked when in the Picker Overlay, preventing changing Damage values until clicked again * **Ender Storage** diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 74c0ed21..139af306 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -535,6 +535,11 @@ public static class EnderIOCategory @Config.Comment("Fixes the Farming Station Chorus Walker being able to loop though and check the same positions endlessly, causing a StackOverflow") public boolean utChorusStackOverflow = true; + @Config.RequiresMcRestart + @Config.Name("Fix Soul Binder JEI Appearance") + @Config.Comment("Fix the Soul Binder having empty ingredients or displaying filled soul vials in the output slot incorrectly") + public boolean utFixSoulBinderJEI = true; + @Config.RequiresMcRestart @Config.Name("Replace Obelisk Renderer") @Config.Comment("Fixes client-side memory leak by replacing obelisk renderer with a simpler one") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 9a9b500d..07b859c9 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -63,6 +63,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.elenaidodge2.json", () -> loaded("elenaidodge2")); put("mixins.mods.enderio.chorus.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utChorusStackOverflow); put("mixins.mods.enderio.cyclebutton.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utSaveFilterCycleButtonProperly); + put("mixins.mods.enderio.soulbinderjei.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utFixSoulBinderJEI); put("mixins.mods.enderstorage.json", () -> loaded("enderstorage") && UTConfigMods.ENDER_STORAGE.utFrequencyTrackFixToggle); put("mixins.mods.epicsiegemod.json", () -> loaded("epicsiegemod")); put("mixins.mods.erebus.cabbage.json", () -> loaded("erebus") && UTConfigMods.EREBUS.utCabbageDrop); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/enderio/soulbinderjei/mixin/UTSoulBinderRecipeCategoryMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/soulbinderjei/mixin/UTSoulBinderRecipeCategoryMixin.java new file mode 100644 index 00000000..14921254 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/enderio/soulbinderjei/mixin/UTSoulBinderRecipeCategoryMixin.java @@ -0,0 +1,45 @@ +package mod.acgaming.universaltweaks.mods.enderio.soulbinderjei.mixin; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import com.llamalad7.mixinextras.sugar.Local; +import crazypants.enderio.machines.integration.jei.SoulBinderRecipeCategory; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.recipe.IFocus; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import static crazypants.enderio.base.init.ModObject.itemSoulVial; + +// Courtesy of WaitingIdly +@Mixin(value = SoulBinderRecipeCategory.class, remap = false) +public abstract class UTSoulBinderRecipeCategoryMixin +{ + /** + * @author WaitingIdly + * @reason ensure list replacing prior entries isn't empty, + * as this will cause JEI to appear in an incorrect state. + */ + @WrapWithCondition(method = "setRecipe(Lmezz/jei/api/gui/IRecipeLayout;Lcrazypants/enderio/machines/integration/jei/SoulBinderRecipeCategory$SoulBinderRecipeWrapper;Lmezz/jei/api/ingredients/IIngredients;)V", at = @At(value = "INVOKE", target = "Lmezz/jei/api/gui/IGuiItemStackGroup;set(ILjava/util/List;)V")) + private boolean utEnsureListNotEmpty(IGuiItemStackGroup instance, int i, List list) + { + return !list.isEmpty(); + } + + /** + * @author WaitingIdly + * @reason check that the focus is not an soul vial, as + * checking for recipes that output that will cause + * soul vials to replace the second output slot on all recipes. + */ + @ModifyExpressionValue(method = "setRecipe(Lmezz/jei/api/gui/IRecipeLayout;Lcrazypants/enderio/machines/integration/jei/SoulBinderRecipeCategory$SoulBinderRecipeWrapper;Lmezz/jei/api/ingredients/IIngredients;)V", at = @At(value = "INVOKE", target = "Lcrazypants/enderio/util/CapturedMob;containsSoul(Lnet/minecraft/item/ItemStack;)Z", ordinal = 1)) + private boolean utCheckFocusNotVial(boolean original, @Local IFocus focus) + { + // at this point, focus.getValue() has already been checked if its an instanceof ItemStack. + return original && ((ItemStack) focus.getValue()).getItem() != itemSoulVial.getItemNN(); + } +} diff --git a/src/main/resources/mixins.mods.enderio.soulbinderjei.json b/src/main/resources/mixins.mods.enderio.soulbinderjei.json new file mode 100644 index 00000000..adab87cc --- /dev/null +++ b/src/main/resources/mixins.mods.enderio.soulbinderjei.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.enderio.soulbinderjei.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTSoulBinderRecipeCategoryMixin"] +} \ No newline at end of file From d567fda1f3c89af8209a595b5752ce9e4243425e Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:57:33 -0800 Subject: [PATCH 8/8] add MmmMmmMmmMmm fix to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 07552301..39badfee 100644 --- a/README.md +++ b/README.md @@ -374,6 +374,8 @@ All changes are toggleable via config files. * **Ingredient Matching:** Changes item matching code to CraftTweaker's ingredient matching system, fixes item NBT issues * **Mekanism** * **Duplication Fixes:** Fixes various duplication exploits +* **MmmMmmMmmMmm** + * **Copy Armor Stacks to Dummy:** Instead of deleting the original itemstack being equipped, use a copy of it and do not drop armor * **Mob Stages** * **Spawning Rules Fixes:** Fixes mob replacement ignoring entity spawning rules * **Modular Routers**