21 lines
716 B
Java
21 lines
716 B
Java
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();
|
|
}
|
|
}
|