protected void a(int i, int j, int k, Block block) { StepSound stepsound = block.stepSound; if (this.world.getType(i, j + 1, k) == Blocks.SNOW) { stepsound = Blocks.SNOW.stepSound; } if (!block.getMaterial().isLiquid()) { int l = this.getType(); if (this.passenger != null && l != 1 && l != 2) { ++this.bP; if (this.bP > 5 && this.bP % 3 == 0) { this.makeSound( "mob.horse.gallop", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); if (l == 0 && this.random.nextInt(10) == 0) { this.makeSound( "mob.horse.breathe", stepsound.getVolume1() * 0.6F, stepsound.getVolume2()); } } else if (this.bP <= 5) { this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } } else if (stepsound == Block.f) { this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } else { this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } } }
protected void a(BlockPosition blockposition, Block block) { StepSound stepsound = block.stepSound; if (this.world.getType(blockposition.up()).getBlock() == Blocks.SNOW_LAYER) { stepsound = Blocks.SNOW_LAYER.stepSound; this.makeSound( stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } else if (!block.getMaterial().isLiquid()) { this.makeSound( stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } }
protected void b(float f) { if (f > 1.0F) { this.makeSound("mob.horse.land", 0.4F, 1.0F); } int i = MathHelper.f(f * 0.5F - 3.0F); if (i > 0) { // CraftBukkit start - fire EntityDamageEvent EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent( null, this, EntityDamageEvent.DamageCause.FALL, i); if (!event.isCancelled()) { float damage = (float) event.getDamage(); if (damage > 0) { this.getBukkitEntity().setLastDamageCause(event); this.damageEntity(DamageSource.FALL, damage); } } if (this.passenger != null) { EntityDamageEvent passengerEvent = CraftEventFactory.callEntityDamageEvent( null, this.passenger, EntityDamageEvent.DamageCause.FALL, i); if (!passengerEvent.isCancelled() && this.passenger != null) { // Check again in case of plugin float damage = (float) passengerEvent.getDamage(); if (damage > 0) { this.passenger.getBukkitEntity().setLastDamageCause(passengerEvent); this.passenger.damageEntity(DamageSource.FALL, damage); } } // CraftBukkit end } Block block = this.world.getType( MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ)); if (block.getMaterial() != Material.AIR) { StepSound stepsound = block.stepSound; this.world.makeSound( this, stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } }
protected void b(float f) { super.b(f); MobEffect mobeffect = this.getEffect(MobEffectList.JUMP); float f1 = mobeffect != null ? (float) (mobeffect.getAmplifier() + 1) : 0.0F; // CraftBukkit start float i = MathHelper.f(f - 3.0F - f1); if (i > 0) { EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent( null, this, EntityDamageEvent.DamageCause.FALL, i); if (event.isCancelled()) { return; } i = (float) event.getDamage(); if (i > 0) { this.getBukkitEntity().setLastDamageCause(event); } } // CraftBukkit end if (i > 0) { if (i > 4) { this.makeSound("damage.fallbig", 1.0F, 1.0F); } else { this.makeSound("damage.fallsmall", 1.0F, 1.0F); } this.damageEntity(DamageSource.FALL, (float) i); int j = this.world.getTypeId( MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ)); if (j > 0) { StepSound stepsound = Block.byId[j].stepSound; this.makeSound( stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } }
protected void b(float f) { super.b(f); MobEffect mobeffect = this.getEffect(MobEffectList.JUMP); float f1 = mobeffect != null ? (float) (mobeffect.getAmplifier() + 1) : 0.0F; int i = MathHelper.f(f - 3.0F - f1); if (i > 0) { this.makeSound(this.o(i), 1.0F, 1.0F); this.damageEntity(DamageSource.FALL, (float) i); int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int l = MathHelper.floor(this.locZ); Block block = this.world.getType(j, k, l); if (block.getMaterial() != Material.AIR) { StepSound stepsound = block.stepSound; this.makeSound( stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } }
public void move(double d0, double d1, double d2) { if (this.bt) { this.boundingBox.d(d0, d1, d2); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locY = this.boundingBox.b + (double) this.height - (double) this.br; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; } else { this.br *= 0.4F; double d3 = this.locX; double d4 = this.locZ; if (this.bf) { this.bf = false; d0 *= 0.25D; d1 *= 0.05000000074505806D; d2 *= 0.25D; this.motX = 0.0D; this.motY = 0.0D; this.motZ = 0.0D; } double d5 = d0; double d6 = d1; double d7 = d2; AxisAlignedBB axisalignedbb = this.boundingBox.clone(); boolean flag = this.onGround && this.isSneaking(); if (flag) { double d8; for (d8 = 0.05D; d0 != 0.0D && this.world.getEntities(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) { if (d0 < d8 && d0 >= -d8) { d0 = 0.0D; } else if (d0 > 0.0D) { d0 -= d8; } else { d0 += d8; } } for (; d2 != 0.0D && this.world.getEntities(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) { if (d2 < d8 && d2 >= -d8) { d2 = 0.0D; } else if (d2 > 0.0D) { d2 -= d8; } else { d2 += d8; } } } List list = this.world.getEntities(this, this.boundingBox.a(d0, d1, d2)); for (int i = 0; i < list.size(); ++i) { d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1); } this.boundingBox.d(0.0D, d1, 0.0D); if (!this.bg && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } boolean flag1 = this.onGround || d6 != d1 && d6 < 0.0D; int j; for (j = 0; j < list.size(); ++j) { d0 = ((AxisAlignedBB) list.get(j)).a(this.boundingBox, d0); } this.boundingBox.d(d0, 0.0D, 0.0D); if (!this.bg && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } for (j = 0; j < list.size(); ++j) { d2 = ((AxisAlignedBB) list.get(j)).c(this.boundingBox, d2); } this.boundingBox.d(0.0D, 0.0D, d2); if (!this.bg && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } double d9; double d10; int k; if (this.bs > 0.0F && flag1 && (flag || this.br < 0.05F) && (d5 != d0 || d7 != d2)) { d9 = d0; d10 = d1; double d11 = d2; d0 = d5; d1 = (double) this.bs; d2 = d7; AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); this.boundingBox.b(axisalignedbb); list = this.world.getEntities(this, this.boundingBox.a(d5, d1, d7)); for (k = 0; k < list.size(); ++k) { d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); } this.boundingBox.d(0.0D, d1, 0.0D); if (!this.bg && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } for (k = 0; k < list.size(); ++k) { d0 = ((AxisAlignedBB) list.get(k)).a(this.boundingBox, d0); } this.boundingBox.d(d0, 0.0D, 0.0D); if (!this.bg && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } for (k = 0; k < list.size(); ++k) { d2 = ((AxisAlignedBB) list.get(k)).c(this.boundingBox, d2); } this.boundingBox.d(0.0D, 0.0D, d2); if (!this.bg && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } if (!this.bg && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } else { d1 = (double) (-this.bs); for (k = 0; k < list.size(); ++k) { d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); } this.boundingBox.d(0.0D, d1, 0.0D); } if (d9 * d9 + d11 * d11 >= d0 * d0 + d2 * d2) { d0 = d9; d1 = d10; d2 = d11; this.boundingBox.b(axisalignedbb1); } else { double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b); if (d12 > 0.0D) { this.br = (float) ((double) this.br + d12 + 0.01D); } } } this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locY = this.boundingBox.b + (double) this.height - (double) this.br; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.positionChanged = d5 != d0 || d7 != d2; this.bc = d6 != d1; this.onGround = d6 != d1 && d6 < 0.0D; this.bd = this.positionChanged || this.bc; this.a(d1, this.onGround); if (d5 != d0) { this.motX = 0.0D; } if (d6 != d1) { this.motY = 0.0D; } if (d7 != d2) { this.motZ = 0.0D; } d9 = this.locX - d3; d10 = this.locZ - d4; int l; int i1; int j1; // CraftBukkit start if ((this.positionChanged) && (getBukkitEntity() instanceof Vehicle)) { Vehicle vehicle = (Vehicle) getBukkitEntity(); org.bukkit.World wrld = ((WorldServer) world).getWorld(); org.bukkit.block.Block block = wrld.getBlockAt( MathHelper.floor(locX), MathHelper.floor(locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(locZ)); if (d5 > d0) { block = block.getFace(BlockFace.SOUTH); } else if (d5 < d0) { block = block.getFace(BlockFace.NORTH); } else if (d7 > d2) { block = block.getFace(BlockFace.WEST); } else if (d7 < d2) { block = block.getFace(BlockFace.EAST); } VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block); ((WorldServer) world).getServer().getPluginManager().callEvent(event); } // CraftBukkit end if (this.n() && !flag && this.vehicle == null) { this.bm = (float) ((double) this.bm + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); l = MathHelper.floor(this.locX); i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); j1 = MathHelper.floor(this.locZ); k = this.world.getTypeId(l, i1, j1); if (this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) { k = this.world.getTypeId(l, i1 - 1, j1); } if (this.bm > (float) this.b && k > 0) { ++this.b; StepSound stepsound = Block.byId[k].stepSound; if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) { stepsound = Block.SNOW.stepSound; this.world.makeSound( this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } else if (!Block.byId[k].material.isLiquid()) { this.world.makeSound( this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } Block.byId[k].b(this.world, l, i1, j1, this); } } l = MathHelper.floor(this.boundingBox.a + 0.0010D); i1 = MathHelper.floor(this.boundingBox.b + 0.0010D); j1 = MathHelper.floor(this.boundingBox.c + 0.0010D); k = MathHelper.floor(this.boundingBox.d - 0.0010D); int k1 = MathHelper.floor(this.boundingBox.e - 0.0010D); int l1 = MathHelper.floor(this.boundingBox.f - 0.0010D); if (this.world.a(l, i1, j1, k, k1, l1)) { for (int i2 = l; i2 <= k; ++i2) { for (int j2 = i1; j2 <= k1; ++j2) { for (int k2 = j1; k2 <= l1; ++k2) { int l2 = this.world.getTypeId(i2, j2, k2); if (l2 > 0) { Block.byId[l2].a(this.world, i2, j2, k2, this); } } } } } boolean flag2 = this.ab(); if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) { this.a(1); if (!flag2) { ++this.fireTicks; // CraftBukkit start if (this.fireTicks <= 0) { // not on fire yet CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity damagee = this.getBukkitEntity(); EntityCombustEvent event = new EntityCombustEvent(damagee); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { this.fireTicks = 300; } } else { // CraftBukkit end - reset fire level back to max this.fireTicks = 300; } } } else if (this.fireTicks <= 0) { this.fireTicks = -this.maxFireTicks; } if (flag2 && this.fireTicks > 0) { this.world.makeSound( this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.fireTicks = -this.maxFireTicks; } } }