Remove unnecessary reflection
This commit is contained in:
@@ -10,6 +10,8 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.passive.AbstractHorse;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -30,6 +32,8 @@ import net.minecraft.world.World;
|
||||
@SuppressWarnings("deprecation") // It's what Entity does, so...
|
||||
public class EntitySpiritHorse extends EntityHorse {
|
||||
|
||||
public static final IAttribute JUMP_STRENGTH = AbstractHorse.JUMP_STRENGTH;
|
||||
|
||||
private int idleTimer = 0;
|
||||
|
||||
private int dispelTimer = 0;
|
||||
|
||||
@@ -11,13 +11,10 @@ import electroblob.wizardry.util.SpellModifiers;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.passive.AbstractHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -26,13 +23,6 @@ public class SummonSpiritHorse extends Spell {
|
||||
/** The string identifier for the potency attribute modifier. */
|
||||
private static final String POTENCY_ATTRIBUTE_MODIFIER = "potency";
|
||||
|
||||
private static final IAttribute JUMP_STRENGTH;
|
||||
// Why is this protected? Doesn't that defeat the point of the attribute system?
|
||||
static {
|
||||
// Great, now I have to reflect into this class too.
|
||||
JUMP_STRENGTH = ObfuscationReflectionHelper.getPrivateValue(AbstractHorse.class, null, "field_110271_bv");
|
||||
}
|
||||
|
||||
public static final IStoredVariable<UUID> UUID_KEY = IStoredVariable.StoredVariable.ofUUID("spiritHorseUUID", Persistence.ALWAYS);
|
||||
|
||||
public SummonSpiritHorse(){
|
||||
@@ -70,7 +60,7 @@ public class SummonSpiritHorse extends Spell {
|
||||
horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(
|
||||
new AttributeModifier(POTENCY_ATTRIBUTE_MODIFIER, modifiers.get(SpellModifiers.POTENCY) - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
// Jump strength increases ridiculously fast, so we're reducing the effect of the modifier by 75%
|
||||
horse.getEntityAttribute(JUMP_STRENGTH).applyModifier(new AttributeModifier(POTENCY_ATTRIBUTE_MODIFIER,
|
||||
horse.getEntityAttribute(EntitySpiritHorse.JUMP_STRENGTH).applyModifier(new AttributeModifier(POTENCY_ATTRIBUTE_MODIFIER,
|
||||
modifiers.amplified(SpellModifiers.POTENCY, 0.25f) - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
|
||||
data.setVariable(UUID_KEY, horse.getUniqueID());
|
||||
|
||||
Reference in New Issue
Block a user