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 fall(float f) { int i = (int) Math.ceil(f - 3F); if (i > 0) { attackEntityFrom(null, i); int j = worldObj.getBlockId( MathHelper.floor_double(posX), MathHelper.floor_double(posY - 0.20000000298023224D - (double) yOffset), MathHelper.floor_double(posZ)); if (j > 0) { StepSound stepsound = Block.blocksList[j].stepSound; worldObj.playSoundAtEntity( this, stepsound.func_1145_d(), stepsound.func_1147_b() * 0.5F, stepsound.func_1144_c() * 0.75F); } } }
/** Plays step sound at given x, y, z for the entity */ protected void playStepSound(int par1, int par2, int par3, int par4) { StepSound stepsound = Block.blocksList[par4].stepSound; if (worldObj.getBlockId(par1, par2 + 1, par3) == Block.snow.blockID) { stepsound = Block.snow.stepSound; worldObj.playSoundAtEntity( this, stepsound.getStepSound(), stepsound.getVolume() * 0.15F, stepsound.getPitch()); } else if (!Block.blocksList[par4].blockMaterial.isLiquid()) { worldObj.playSoundAtEntity( this, stepsound.getStepSound(), stepsound.getVolume() * 0.15F, stepsound.getPitch()); } }
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) { 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 c(double d1, double d2, double d3) { if (T) { z.d(d1, d2, d3); p = (z.a + z.d) / 2D; q = (z.b + (double) H) - (double) R; r = (z.c + z.f) / 2D; return; } double d4 = p; double d5 = r; double d6 = d1; double d7 = d2; double d8 = d3; AxisAlignedBB axisalignedbb = z.b(); boolean flag = A && p(); if (flag) { double d9 = 0.050000000000000003D; for (; d1 != 0.0D && l.a(this, z.c(d1, -1D, 0.0D)).size() == 0; d6 = d1) { if (d1 < d9 && d1 >= -d9) { d1 = 0.0D; continue; } if (d1 > 0.0D) { d1 -= d9; } else { d1 += d9; } } for (; d3 != 0.0D && l.a(this, z.c(0.0D, -1D, d3)).size() == 0; d8 = d3) { if (d3 < d9 && d3 >= -d9) { d3 = 0.0D; continue; } if (d3 > 0.0D) { d3 -= d9; } else { d3 += d9; } } } List list = l.a(this, z.a(d1, d2, d3)); for (int i1 = 0; i1 < list.size(); i1++) { d2 = ((AxisAlignedBB) list.get(i1)).b(z, d2); } z.d(0.0D, d2, 0.0D); if (!F && d7 != d2) { d1 = d2 = d3 = 0.0D; } boolean flag1 = A || d7 != d2 && d7 < 0.0D; for (int j1 = 0; j1 < list.size(); j1++) { d1 = ((AxisAlignedBB) list.get(j1)).a(z, d1); } z.d(d1, 0.0D, 0.0D); if (!F && d6 != d1) { d1 = d2 = d3 = 0.0D; } for (int k1 = 0; k1 < list.size(); k1++) { d3 = ((AxisAlignedBB) list.get(k1)).c(z, d3); } z.d(0.0D, 0.0D, d3); if (!F && d8 != d3) { d1 = d2 = d3 = 0.0D; } if (S > 0.0F && flag1 && R < 0.05F && (d6 != d1 || d8 != d3)) { double d10 = d1; double d12 = d2; double d14 = d3; d1 = d6; d2 = S; d3 = d8; AxisAlignedBB axisalignedbb1 = z.b(); z.b(axisalignedbb); List list1 = l.a(this, z.a(d1, d2, d3)); for (int j2 = 0; j2 < list1.size(); j2++) { d2 = ((AxisAlignedBB) list1.get(j2)).b(z, d2); } z.d(0.0D, d2, 0.0D); if (!F && d7 != d2) { d1 = d2 = d3 = 0.0D; } for (int k2 = 0; k2 < list1.size(); k2++) { d1 = ((AxisAlignedBB) list1.get(k2)).a(z, d1); } z.d(d1, 0.0D, 0.0D); if (!F && d6 != d1) { d1 = d2 = d3 = 0.0D; } for (int l2 = 0; l2 < list1.size(); l2++) { d3 = ((AxisAlignedBB) list1.get(l2)).c(z, d3); } z.d(0.0D, 0.0D, d3); if (!F && d8 != d3) { d1 = d2 = d3 = 0.0D; } if (d10 * d10 + d14 * d14 >= d1 * d1 + d3 * d3) { d1 = d10; d2 = d12; d3 = d14; z.b(axisalignedbb1); } else { R += 0.5D; } } p = (z.a + z.d) / 2D; q = (z.b + (double) H) - (double) R; r = (z.c + z.f) / 2D; B = d6 != d1 || d8 != d3; C = d7 != d2; A = d7 != d2 && d7 < 0.0D; D = B || C; a(d2, A); if (d6 != d1) { s = 0.0D; } if (d7 != d2) { t = 0.0D; } if (d8 != d3) { u = 0.0D; } double d11 = p - d4; double d13 = r - d5; if (M && !flag) { L += (double) MathHelper.a(d11 * d11 + d13 * d13) * 0.59999999999999998D; int k3 = MathHelper.b(p); int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H); int l1 = MathHelper.b(r); int i3 = l.a(k3, i4, l1); if (L > (float) b && i3 > 0) { b++; StepSound stepsound = Block.m[i3].bq; if (l.a(k3, i4 + 1, l1) == Block.aS.bh) { stepsound = Block.aS.bq; l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b()); } else if (!Block.m[i3].bs.d()) { l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b()); } Block.m[i3].b(l, k3, i4, l1, this); } } int l3 = MathHelper.b(z.a); int j4 = MathHelper.b(z.b); int i2 = MathHelper.b(z.c); int j3 = MathHelper.b(z.d); int k4 = MathHelper.b(z.e); int l4 = MathHelper.b(z.f); for (int i5 = l3; i5 <= j3; i5++) { for (int j5 = j4; j5 <= k4; j5++) { for (int k5 = i2; k5 <= l4; k5++) { int l5 = l.a(i5, j5, k5); if (l5 > 0) { Block.m[l5].a(l, i5, j5, k5, this); } } } } R *= 0.4F; boolean flag2 = r(); if (l.c(z)) { b(1); if (!flag2) { Z++; if (Z == 0) { Z = 300; } } } else if (Z <= 0) { Z = -Y; } if (flag2 && Z > 0) { l.a(this, "random.fizz", 0.7F, 1.6F + (W.nextFloat() - W.nextFloat()) * 0.4F); Z = -Y; } }
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()); } } }
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; } } }