From e39f5fd8eddece3526060422833a27000c1a1081 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:27:23 -0700 Subject: [PATCH 1/2] Fix tiny Quake Hammer Texture --- README.md | 1 + .../universaltweaks/config/UTConfigMods.java | 5 ++++ .../universaltweaks/core/UTMixinLoader.java | 1 + .../quakehammer/mixin/UTQuakeHammerMixin.java | 27 +++++++++++++++++++ .../mixins.mods.erebus.quakehammer.json | 7 +++++ 5 files changed, 41 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java create mode 100644 src/main/resources/mixins.mods.erebus.quakehammer.json diff --git a/README.md b/README.md index c5920175..523acacb 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,7 @@ All changes are toggleable via config files. * **Memory Leak Fix:** Fixes a client-side memory leak when wearing Void Fortress armor * **The Erebus** * **Preserved Blocks Fix:** Prevents HWYLA/TOP crashes with preserved blocks + * **Fix Quake Hammer Texture:** Fixes the Quake Hammer using the incorrect config option to control its size * **The Farlanders** * **Duplication Fixes:** Fixes various duplication exploits * **Thermal Expansion** diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index a0fc6dfa..6c66ddbf 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -390,6 +390,11 @@ public static class ErebusCategory @Config.Name("Preserved Blocks Fix") @Config.Comment("Prevents HWYLA/TOP crashes with preserved blocks") public boolean utEBPreservedBlocksToggle = true; + + @Config.RequiresMcRestart + @Config.Name("Fix Quake Hammer Texture") + @Config.Comment("Fixes the Quake Hammer using the incorrect config option to control its size") + public boolean utFixQuakeHammerTexture = true; } public static class ExtraUtilitiesCategory diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index a528a617..b3975cff 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -52,6 +52,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.elenaidodge2.json", () -> loaded("elenaidodge2")); put("mixins.mods.epicsiegemod.json", () -> loaded("epicsiegemod")); put("mixins.mods.erebus.json", () -> loaded("erebus")); + put("mixins.mods.erebus.quakehammer.json", () -> loaded("erebus") && UTConfigMods.EREBUS.utFixQuakeHammerTexture); put("mixins.mods.extrautilities.breakcreativemill.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utFixCreativeMillHarvestability); put("mixins.mods.extrautilities.dupes.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utDuplicationFixesToggle); put("mixins.mods.extrautilities.mutabledrops.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utMutableBlockDrops); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java new file mode 100644 index 00000000..ac1f5538 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java @@ -0,0 +1,27 @@ +package mod.acgaming.universaltweaks.mods.erebus.quakehammer.mixin; + +import erebus.core.handler.configs.ConfigHandler; +import mod.acgaming.universaltweaks.config.UTConfigMods; +import net.minecraftforge.common.config.Configuration; +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.Redirect; + +// Courtesy of WaitingIdly +@Mixin(value = ConfigHandler.class, remap = false) +public class UTQuakeHammerMixin +{ + @Shadow + public Configuration config; + + @Shadow + public float getHammer_renderSizeChargedMultiplier; + + @Redirect(method = "syncConfigs", at = @At(value = "FIELD", target = "Lerebus/core/handler/configs/ConfigHandler;hammer_renderSize:F", ordinal = 1)) + private void utFixRenderSize(ConfigHandler configHandler, float original) + { + if (!UTConfigMods.EREBUS.utFixQuakeHammerTexture) return; + this.getHammer_renderSizeChargedMultiplier = this.config.getFloat("Quake Hammer charged render size", "Quake Hammer", 0.03F, 0.0F, Float.MAX_VALUE, ""); + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.mods.erebus.quakehammer.json b/src/main/resources/mixins.mods.erebus.quakehammer.json new file mode 100644 index 00000000..60b07a8c --- /dev/null +++ b/src/main/resources/mixins.mods.erebus.quakehammer.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.erebus.quakehammer.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTQuakeHammerMixin"] +} \ No newline at end of file From b06183c79af8b22e2cafee0aa61153f448bd2fc6 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:36:24 -0700 Subject: [PATCH 2/2] simplify hammer mixin --- .../erebus/quakehammer/mixin/UTQuakeHammerMixin.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java index ac1f5538..a85d9c46 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/erebus/quakehammer/mixin/UTQuakeHammerMixin.java @@ -2,9 +2,7 @@ import erebus.core.handler.configs.ConfigHandler; import mod.acgaming.universaltweaks.config.UTConfigMods; -import net.minecraftforge.common.config.Configuration; 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.Redirect; @@ -12,16 +10,10 @@ @Mixin(value = ConfigHandler.class, remap = false) public class UTQuakeHammerMixin { - @Shadow - public Configuration config; - - @Shadow - public float getHammer_renderSizeChargedMultiplier; - @Redirect(method = "syncConfigs", at = @At(value = "FIELD", target = "Lerebus/core/handler/configs/ConfigHandler;hammer_renderSize:F", ordinal = 1)) private void utFixRenderSize(ConfigHandler configHandler, float original) { if (!UTConfigMods.EREBUS.utFixQuakeHammerTexture) return; - this.getHammer_renderSizeChargedMultiplier = this.config.getFloat("Quake Hammer charged render size", "Quake Hammer", 0.03F, 0.0F, Float.MAX_VALUE, ""); + configHandler.getHammer_renderSizeChargedMultiplier = original; } } \ No newline at end of file