Skip to content

Commit

Permalink
Merge pull request #370 from IcarussOne/main
Browse files Browse the repository at this point in the history
Disable Advancements Tweak
  • Loading branch information
ACGaming authored Feb 6, 2024
2 parents 392fca3 + 7f6584d commit 7ba49ad
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 entirely")
public boolean utDisableAdvancementsToggle = false;

@Config.RequiresMcRestart
@Config.Name("Disable Narrator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public List<String> 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");
Expand Down Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public static List<String> 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");
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.misc.advancements.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.advancements.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTAdvancementManagerMixin"]
}

0 comments on commit 7ba49ad

Please sign in to comment.