From 92d3a01dac2db6909af72651369b99057195589b Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sun, 10 Mar 2024 16:33:52 +1100 Subject: [PATCH] Remove Disabling Advancements Option Universal Tweaks has a better version. --- .../nomiceu/nomilabs/config/LabsConfig.java | 6 ----- .../nomilabs/mixin/AdvancementListMixin.java | 20 --------------- .../mixin/AdvancementManagerMixin.java | 25 ------------------- .../mixin/ClientAdvancementManagerMixin.java | 25 ------------------- .../resources/assets/nomilabs/lang/en_us.lang | 1 - src/main/resources/mixins.nomilabs.json | 6 +---- 6 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/AdvancementListMixin.java delete mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/AdvancementManagerMixin.java delete mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/ClientAdvancementManagerMixin.java diff --git a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java index 7c4d0ea8..afdda715 100644 --- a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java +++ b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java @@ -245,12 +245,6 @@ public static class Advanced { @Config.LangKey("config.nomilabs.advanced.disable_xp_scaling") public boolean disableXpScaling = false; - @Config.Comment({"Whether to disable Advancements.", - "Increases Load Speed, and reduces log errors.", - "[default: false]"}) - @Config.LangKey("config.nomilabs.advanced.disable_advancements") - public boolean disableAdvancements = false; - @Config.Comment({"Whether to disable the Narrator.", "Fixes Crashes in Arm Macs, in some very specific environments.", "If your game is crashing, try enabling this!", diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementListMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementListMixin.java deleted file mode 100644 index e765fafc..00000000 --- a/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementListMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.nomiceu.nomilabs.mixin; - -import com.nomiceu.nomilabs.config.LabsConfig; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementList; -import net.minecraft.util.ResourceLocation; -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; - -import java.util.Map; - -@Mixin(value = AdvancementList.class) -public class AdvancementListMixin { - @Inject(method = "loadAdvancements(Ljava/util/Map;)V", at = @At("HEAD"), cancellable = true) - public void cancelAdvancements(Map advancementsIn, CallbackInfo ci) { - if (LabsConfig.advanced.disableAdvancements) ci.cancel(); - } -} diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementManagerMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementManagerMixin.java deleted file mode 100644 index 57a9d7f5..00000000 --- a/src/main/java/com/nomiceu/nomilabs/mixin/AdvancementManagerMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.nomiceu.nomilabs.mixin; - -import com.nomiceu.nomilabs.config.LabsConfig; -import net.minecraft.advancements.AdvancementList; -import net.minecraft.advancements.AdvancementManager; -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; - -@Mixin(value = AdvancementManager.class) -public class AdvancementManagerMixin { - @Shadow - @Final - private static AdvancementList ADVANCEMENT_LIST; - - @Inject(method = "reload()V", at = @At("HEAD"), cancellable = true) - public void reloadWithoutAdvancements(CallbackInfo ci) { - if (!LabsConfig.advanced.disableAdvancements) return; - ADVANCEMENT_LIST.clear(); - ci.cancel(); - } -} diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/ClientAdvancementManagerMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/ClientAdvancementManagerMixin.java deleted file mode 100644 index 4a6fb157..00000000 --- a/src/main/java/com/nomiceu/nomilabs/mixin/ClientAdvancementManagerMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.nomiceu.nomilabs.mixin; - -import com.nomiceu.nomilabs.config.LabsConfig; -import net.minecraft.advancements.AdvancementList; -import net.minecraft.client.multiplayer.ClientAdvancementManager; -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; - -@Mixin(value = ClientAdvancementManager.class) -public class ClientAdvancementManagerMixin { - @Shadow - @Final - private AdvancementList advancementList; - - @Inject(method = "read(Lnet/minecraft/network/play/server/SPacketAdvancementInfo;)V", at = @At("HEAD"), cancellable = true) - public void reloadWithoutAdvancements(CallbackInfo ci) { - if (!LabsConfig.advanced.disableAdvancements) return; - advancementList.clear(); - ci.cancel(); - } -} diff --git a/src/main/resources/assets/nomilabs/lang/en_us.lang b/src/main/resources/assets/nomilabs/lang/en_us.lang index d050cdc3..d9cff385 100644 --- a/src/main/resources/assets/nomilabs/lang/en_us.lang +++ b/src/main/resources/assets/nomilabs/lang/en_us.lang @@ -54,7 +54,6 @@ config.nomilabs.advanced=Advanced Settings config.nomilabs.advanced.tooltip=Advanced Settings config.nomilabs.advanced.allow_other_modes=Allow Other Modes config.nomilabs.advanced.disable_xp_scaling=Disable Anvil XP Scaling -config.nomilabs.advanced.disable_advancements=Disable Advancements config.nomilabs.advanced.disable_narrator=Disable Narrator config.nomilabs.advanced.enable_nomi_ceu_data_fixes=Enable Nomi-CEu Specific Data Fixes config.nomilabs.advanced.ignore_items=ITEM Missing Registry Ignore List diff --git a/src/main/resources/mixins.nomilabs.json b/src/main/resources/mixins.nomilabs.json index 2887a83b..b43bd622 100644 --- a/src/main/resources/mixins.nomilabs.json +++ b/src/main/resources/mixins.nomilabs.json @@ -6,15 +6,11 @@ "compatibilityLevel": "JAVA_8", "mixins": [ "AccessibleFluidRegistry", - "AdvancementListMixin", - "AdvancementManagerMixin", "FluidRegistryMixin", "ItemStackMixin", "NarratorMixin", "WorldLoadHandler" ], - "client": [ - "ClientAdvancementManagerMixin" - ], + "client": [], "server": [] }