2
0
Fork 0

Patch to remove negative modifiers from reforging

main
KeyLime17 6 months ago
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);
}
}
}

@ -47,6 +47,7 @@
"overrides.MixinLOTRTradeEntriesOverrides", "overrides.MixinLOTRTradeEntriesOverrides",
"overrides.MixinLOTRUnitTradeEntries", "overrides.MixinLOTRUnitTradeEntries",
"overrides.MixinLOTRBiome", "overrides.MixinLOTRBiome",
"overrides.MixinLOTREnchantmenHelper",
"MixinLOTREntityOrc", "MixinLOTREntityOrc",
"MixinEntityLivingBase", "MixinEntityLivingBase",
"MixinEntityPlayer", "MixinEntityPlayer",

Loading…
Cancel
Save