Patch to remove negative modifiers from reforging
parent
e9230f0832
commit
72decc5e52
@ -0,0 +1,30 @@
|
|||||||
|
package com.zivilon.cinder_loe.mixins.overrides;
|
||||||
|
|
||||||
|
import lotr.common.enchant.LOTREnchantment;
|
||||||
|
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(LOTREnchantmentHelper.class)
|
||||||
|
public class MixinLOTREnchantmenHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent negative modifiers (weak or detrimental enchants) from being applied.
|
||||||
|
*/
|
||||||
|
@Redirect(
|
||||||
|
method = "applyRandomEnchantments(Lnet/minecraft/item/ItemStack;Ljava/util/Random;ZZ)V",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Llotr/common/enchant/LOTREnchantmentHelper;setHasEnchant(Lnet/minecraft/item/ItemStack;Llotr/common/enchant/LOTREnchantment;)V"
|
||||||
|
),
|
||||||
|
remap = false
|
||||||
|
)
|
||||||
|
private static void skipNegativeEnchant(ItemStack itemstack, LOTREnchantment ench) {
|
||||||
|
// Only apply if enchant is beneficial
|
||||||
|
if (ench.isBeneficial()) {
|
||||||
|
LOTREnchantmentHelper.setHasEnchant(itemstack, ench);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue