package net.minecraft.server; import javax.annotation.Nullable; public class EntityHorseSkeleton extends EntityHorseAbstract { private final PathfinderGoalHorseTrap bF = new PathfinderGoalHorseTrap(this); private boolean bG; private int bH; public EntityHorseSkeleton(EntityTypes<? extends EntityHorseSkeleton> entitytypes, World world) { super(entitytypes, world); } @Override protected void initAttributes() { super.initAttributes(); this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(15.0D); this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.20000000298023224D); this.getAttributeInstance(EntityHorseSkeleton.attributeJumpStrength).setValue(this.eT()); } @Override protected void ez() {} @Override protected SoundEffect getSoundAmbient() { super.getSoundAmbient(); return this.a(TagsFluid.WATER) ? SoundEffects.ENTITY_SKELETON_HORSE_AMBIENT_WATER : SoundEffects.ENTITY_SKELETON_HORSE_AMBIENT; } @Override protected SoundEffect getSoundDeath() { super.getSoundDeath(); return SoundEffects.ENTITY_SKELETON_HORSE_DEATH; } @Override protected SoundEffect getSoundHurt(DamageSource damagesource) { super.getSoundHurt(damagesource); return SoundEffects.ENTITY_SKELETON_HORSE_HURT; } @Override protected SoundEffect getSoundSwim() { if (this.onGround) { if (!this.isVehicle()) { return SoundEffects.ENTITY_SKELETON_HORSE_STEP_WATER; } ++this.bE; if (this.bE > 5 && this.bE % 3 == 0) { return SoundEffects.ENTITY_SKELETON_HORSE_GALLOP_WATER; } if (this.bE <= 5) { return SoundEffects.ENTITY_SKELETON_HORSE_STEP_WATER; } } return SoundEffects.ENTITY_SKELETON_HORSE_SWIM; } @Override protected void d(float f) { if (this.onGround) { super.d(0.3F); } else { super.d(Math.min(0.1F, f * 25.0F)); } } @Override protected void eQ() { if (this.isInWater()) { this.a(SoundEffects.ENTITY_SKELETON_HORSE_JUMP_WATER, 0.4F, 1.0F); } else { super.eQ(); } } @Override public EnumMonsterType getMonsterType() { return EnumMonsterType.UNDEAD; } @Override public double aS() { return super.aS() - 0.1875D; } @Override public void movementTick() { super.movementTick(); if (this.eq() && this.bH++ >= 18000) { this.die(); } } @Override public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setBoolean("SkeletonTrap", this.eq()); nbttagcompound.setInt("SkeletonTrapTime", this.bH); } @Override public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.r(nbttagcompound.getBoolean("SkeletonTrap")); this.bH = nbttagcompound.getInt("SkeletonTrapTime"); } @Override public boolean bi() { return true; } @Override protected float ds() { return 0.96F; } public boolean eq() { return this.bG; } public void r(boolean flag) { if (flag != this.bG) { this.bG = flag; if (flag) { this.goalSelector.a(1, this.bF); } else { this.goalSelector.a((PathfinderGoal) this.bF); } } } @Nullable @Override public EntityAgeable createChild(EntityAgeable entityageable) { return (EntityAgeable) EntityTypes.SKELETON_HORSE.a(this.world); } @Override public boolean a(EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); if (itemstack.getItem() instanceof ItemMonsterEgg) { return super.a(entityhuman, enumhand); } else if (!this.isTamed()) { return false; } else if (this.isBaby()) { return super.a(entityhuman, enumhand); } else if (entityhuman.dT()) { this.e(entityhuman); return true; } else if (this.isVehicle()) { return super.a(entityhuman, enumhand); } else { if (!itemstack.isEmpty()) { if (itemstack.getItem() == Items.SADDLE && !this.eL()) { this.e(entityhuman); return true; } if (itemstack.a(entityhuman, (EntityLiving) this, enumhand)) { return true; } } this.g(entityhuman); return true; } } }