diff --git a/README.md b/README.md index db93a115..7a1a182e 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ All changes are toggleable via config files. * **AI Improvements:** Replaces/removes entity AI for improved server performance * **Always Eat:** Allows the consumption of food at any time, regardless of the hunger bar * **Always Return to Main Menu:** Always returns the player to the main menu when quitting the game +* **Anvil XP Level Cap:** Sets the experience level cap for anvil recipes * **Armed Armor Stands:** Enables arms for armor stands by default * **Armor Curve:** Adjusts the armor scaling and degradation formulae for mobs and players * **Attributes:** Sets custom ranges for entity attributes diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 7385608c..6de751f3 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -92,6 +92,10 @@ public enum EnumBeacon public static class BlocksCategory { + @Config.LangKey("cfg.universaltweaks.tweaks.blocks.anvil") + @Config.Name("Anvil") + public final AnvilCategory ANVIL = new AnvilCategory(); + @Config.LangKey("cfg.universaltweaks.tweaks.blocks.betterplacement") @Config.Name("Better Placement") public final BetterPlacementCategory BETTER_PLACEMENT = new BetterPlacementCategory(); @@ -218,6 +222,14 @@ public static class BlocksCategory }) public int utVineSize = 0; + public static class AnvilCategory + { + @Config.RequiresMcRestart + @Config.Name("Anvil XP Level Cap") + @Config.Comment("Sets the experience level cap for anvil recipes") + public int utAnvilXPLevelCap = 40; + } + public static class BetterPlacementCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTContainerRepairMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTContainerRepairMixin.java new file mode 100644 index 00000000..c30d3c4d --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTContainerRepairMixin.java @@ -0,0 +1,18 @@ +package mod.acgaming.universaltweaks.tweaks.blocks.anvil.mixin; + +import net.minecraft.inventory.ContainerRepair; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(ContainerRepair.class) +public abstract class UTContainerRepairMixin +{ + @ModifyConstant(method = "updateRepairOutput", constant = @Constant(intValue = 40)) + private int utContainerRepair(int constant) + { + return UTConfigTweaks.BLOCKS.ANVIL.utAnvilXPLevelCap; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTGuiRepairMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTGuiRepairMixin.java new file mode 100644 index 00000000..7afbafe9 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/anvil/mixin/UTGuiRepairMixin.java @@ -0,0 +1,18 @@ +package mod.acgaming.universaltweaks.tweaks.blocks.anvil.mixin; + +import net.minecraft.client.gui.GuiRepair; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(GuiRepair.class) +public abstract class UTGuiRepairMixin +{ + @ModifyConstant(method = "drawGuiContainerForegroundLayer", constant = @Constant(intValue = 40)) + private int utGuiRepair(int constant) + { + return UTConfigTweaks.BLOCKS.ANVIL.utAnvilXPLevelCap; + } +} \ No newline at end of file diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 8e768eba..0774b820 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -120,6 +120,7 @@ cfg.universaltweaks.modintegration.tr=Tech Reborn cfg.universaltweaks.modintegration.woot=Woot cfg.universaltweaks.modintegration=Mod Integration +cfg.universaltweaks.tweaks.blocks.anvil=Anvil cfg.universaltweaks.tweaks.blocks.betterplacement=Better Placement cfg.universaltweaks.tweaks.blocks.blockdispenser=Block Dispenser cfg.universaltweaks.tweaks.blocks.breakablebedrock=Breakable Bedrock