From 86ac2ed8ff69bf106f53c475c46a5513b84817e2 Mon Sep 17 00:00:00 2001 From: Me <135455255+IcarussOne@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:19:59 -0600 Subject: [PATCH 1/2] Disable Advancements Tweak --- README.md | 1 + .../config/UTConfigTweaks.java | 5 +++++ .../universaltweaks/core/UTLoadingPlugin.java | 3 +++ .../mixin/UTAdvancementManagerMixin.java | 19 +++++++++++++++++++ .../util/compat/UTObsoleteModsHandler.java | 1 + .../mixins.tweaks.misc.advancements.json | 7 +++++++ 6 files changed, 36 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java create mode 100644 src/main/resources/mixins.tweaks.misc.advancements.json diff --git a/README.md b/README.md index 9c0318d6..7a035fc7 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ All changes are toggleable via config files. * **Damage Velocity:** Enables the modification of damage sources that change the entity's velocity * **Default Difficulty:** Sets the default difficulty for newly generated worlds * **Dimension Unload:** Unloads dimensions not in use to free up resources +* **Disable Advancements:** Prevents the advancement system from loading * **Disable Audio Debug:** Improves loading times by removing debug code for missing sounds and subtitles * **Disable Creeper Music Discs:** Disables creepers dropping music discs when slain by skeletons * **Disable Fancy Missing Model:** Improves rendering performance by removing the resource location text on missing models diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 02d61ca7..53e58e44 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1163,6 +1163,11 @@ public static class MiscCategory @Config.Name("Default Difficulty") @Config.Comment("Sets the default difficulty for newly generated worlds") public EnumDifficulty utDefaultDifficulty = EnumDifficulty.NORMAL; + + @Config.RequiresMcRestart + @Config.Name("Disable Advancements") + @Config.Comment("Prevents the advancement system from loading") + public boolean utDisableAdvancementsToggle = false; @Config.RequiresMcRestart @Config.Name("Disable Narrator") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 1b9cbf3a..5ce71635 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -221,6 +221,7 @@ public List getMixinConfigs() configs.add("mixins.tweaks.items.rarity.json"); configs.add("mixins.tweaks.items.repairing.json"); configs.add("mixins.tweaks.items.xpbottle.json"); + configs.add("mixins.tweaks.misc.advancements.json"); configs.add("mixins.tweaks.misc.armorcurve.json"); configs.add("mixins.tweaks.misc.bannerlayers.json"); configs.add("mixins.tweaks.misc.console.addpacket.json"); @@ -474,6 +475,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigTweaks.ITEMS.utCraftingRepairToggle; case "mixins.tweaks.items.xpbottle.json": return UTConfigTweaks.ITEMS.utXPBottleAmount != -1; + case "mixins.tweaks.misc.advancements.json": + return UTConfigTweaks.MISC.utDisableAdvancementsToggle; case "mixins.tweaks.misc.armorcurve.json": return UTConfigTweaks.MISC.ARMOR_CURVE.utArmorCurveToggle; case "mixins.tweaks.misc.bannerlayers.json": diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java new file mode 100644 index 00000000..18aeb3dd --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java @@ -0,0 +1,19 @@ +package mod.acgaming.universaltweaks.tweaks.misc.advancements.mixin; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import net.minecraft.advancements.AdvancementManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// Courtesy of fonnymunkey +@Mixin(AdvancementManager.class) +public abstract class UTAdvancementManagerMixin +{ + @Inject(method = "reload", at = @At("HEAD"), cancellable = true) + public void utAdvancementManagerReload(CallbackInfo ci) + { + if (UTConfigTweaks.MISC.utDisableAdvancementsToggle) ci.cancel(); + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index 137daf77..40666cf0 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -88,6 +88,7 @@ public static List obsoleteModsMessage() if (Loader.isModLoaded("naturallychargedcreepers") && UTConfigTweaks.ENTITIES.utCreeperChargedChance > 0) messages.add("Naturally Charged Creepers"); if (Loader.isModLoaded("nanfix") && UTConfigBugfixes.ENTITIES.utEntityNaNToggle) messages.add("NaN Entity Health Fix"); if (Loader.isModLoaded("nanpolice") && UTConfigBugfixes.ENTITIES.utEntityNaNToggle) messages.add("NaNPolice"); + if (Loader.isModLoaded("noadvancements") && UTConfigTweaks.MISC.utDisableAdvancementsToggle) messages.add("No Advancements"); if (Loader.isModLoaded("nobounce") && UTConfigMods.THAUMCRAFT.utTCStableThaumometerToggle) messages.add("Stable Thaumometer"); if (Loader.isModLoaded("nodoze") && UTConfigTweaks.ENTITIES.SLEEPING.utDisableSleepingToggle) messages.add("No Doze"); if (Loader.isModLoaded("nonvflash") && UTConfigTweaks.MISC.utNightVisionFlashToggle) messages.add("No Night Vision Flashing"); diff --git a/src/main/resources/mixins.tweaks.misc.advancements.json b/src/main/resources/mixins.tweaks.misc.advancements.json new file mode 100644 index 00000000..3956c1f9 --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.advancements.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.advancements.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTAdvancementManagerMixin"] +} \ No newline at end of file From 7f6584da40828ae5d688c381d91010bf5173e1ac Mon Sep 17 00:00:00 2001 From: Me <135455255+IcarussOne@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:46:41 -0600 Subject: [PATCH 2/2] Update description --- README.md | 2 +- .../mod/acgaming/universaltweaks/config/UTConfigTweaks.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a035fc7..91bd0b62 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ All changes are toggleable via config files. * **Damage Velocity:** Enables the modification of damage sources that change the entity's velocity * **Default Difficulty:** Sets the default difficulty for newly generated worlds * **Dimension Unload:** Unloads dimensions not in use to free up resources -* **Disable Advancements:** Prevents the advancement system from loading +* **Disable Advancements:** Prevents the advancement system from loading entirely * **Disable Audio Debug:** Improves loading times by removing debug code for missing sounds and subtitles * **Disable Creeper Music Discs:** Disables creepers dropping music discs when slain by skeletons * **Disable Fancy Missing Model:** Improves rendering performance by removing the resource location text on missing models diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 53e58e44..bba8a656 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1166,7 +1166,7 @@ public static class MiscCategory @Config.RequiresMcRestart @Config.Name("Disable Advancements") - @Config.Comment("Prevents the advancement system from loading") + @Config.Comment("Prevents the advancement system from loading entirely") public boolean utDisableAdvancementsToggle = false; @Config.RequiresMcRestart