You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.2 KiB
Java
28 lines
1.2 KiB
Java
package com.zivilon.cinder_loe.mixins;
|
|
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Overwrite;
|
|
import lotr.common.item.LOTRWeaponStats;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.entity.SharedMonsterAttributes;
|
|
import net.minecraft.enchantment.EnchantmentHelper;
|
|
import net.minecraft.enchantment.Enchantment;
|
|
import lotr.common.enchant.LOTREnchantmentHelper;
|
|
|
|
@Mixin(EnchantmentHelper.class)
|
|
public class MixinEnchantmentHelper {
|
|
|
|
/**
|
|
* @author Shinare
|
|
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
|
|
*/
|
|
@Overwrite
|
|
public static int getKnockbackModifier(EntityLivingBase attacker, EntityLivingBase target) {
|
|
int vanilla_ench_level = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, attacker.getHeldItem());
|
|
int base_extra_knockback = LOTRWeaponStats.getBaseExtraKnockback(attacker.getHeldItem());
|
|
int modifier_extra_knockback = LOTREnchantmentHelper.calcExtraKnockback(attacker.getHeldItem());
|
|
if (target.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue() == 1.0D) return 0;
|
|
return vanilla_ench_level + base_extra_knockback + modifier_extra_knockback;
|
|
}
|
|
}
|