Add max anvil cost config and EnchantCommand mixin

Introduces a configurable max anvil cost via the config and enforces it in AnvilScreenHandlerMixin. Adds EnchantCommandMixin to support custom enchantment levels in the /enchant command. Updates mod version to 1.10 and registers the new mixin in the mixins config.
This commit is contained in:
2025-12-28 19:37:26 +01:00
parent a560e64029
commit 86dd3c2b22
5 changed files with 72 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
package com.kasetoatz.superenchants.mixin;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.server.command.EnchantCommand;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import static com.kasetoatz.superenchants.util.Util.getCustomLevel;
@Mixin(EnchantCommand.class)
public class EnchantCommandMixin
{
@Redirect(method="execute", at= @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;getMaxLevel()I"))
private static int execute(Enchantment enchant)
{
int custom = getCustomLevel(enchant);
return (custom > 0) ? custom : enchant.getMaxLevel();
}
}