onPostMove(moveDx, moveDy, moveDz);
}
}
private void onPostMove(double moveDx, double moveDy, double moveDz) {
Entity handle = this.entity.getHandle(Entity.class);
// Update entity movement sounds
if (EntityRef.hasMovementSound(handle) && handle.vehicle == null) {
int bX = entity.loc.x.block();
int bY = MathUtil.floor(handle.locY - 0.2 - (double) handle.height);
int bZ = entity.loc.z.block();
Block block = handle.world.getType(bX, bY, bZ);
int j1 = handle.world.getType(bX, bY - 1, bZ).b();
// Magic values! *gasp* Bad, BAD Minecraft! Go sit in a corner!
if (j1 == 11 || j1 == 32 || j1 == 21) {
block = handle.world.getType(bX, bY - 1, bZ);
}
if (block != Blocks.LADDER) {
moveDy = 0.0;
}
handle.Q += MathUtil.length(moveDx, moveDz) * 0.6;
handle.O += MathUtil.length(moveDx, moveDy, moveDz) * 0.6;
if (handle.O > EntityRef.stepCounter.get(entity.getHandle()) && block != Blocks.AIR) {
EntityRef.stepCounter.set(entity.getHandle(), (int) handle.O + 1);
if (entity.isInWater(true)) {
float f = (float) Math.sqrt(entity.vel.y.squared() + 0.2 * entity.vel.xz.lengthSquared()) * 0.35f;
if (f > 1.0f) {
f = 1.0f;
}
entity.makeRandomSound(EntityRef.getSwimSound.invoke(handle), f, 1.0f);
}
entity.makeStepSound(bX, bY, bZ, CommonNMS.getMaterial(block));
block.b(handle.world, bX, bY, bZ, handle);
}
}
EntityRef.updateBlockCollision(handle);
// Fire tick calculation (check using block collision)
final boolean isInWater = handle.L(); // In water or raining
if (handle.world.e(handle.boundingBox.shrink(0.001, 0.001, 0.001))) {
onBurnDamage(1);
if (!isInWater) {
handle.fireTicks++;
if (handle.fireTicks <= 0) {
EntityCombustEvent event = new EntityCombustEvent(entity.getEntity(), 8);
if (!CommonUtil.callEvent(event).isCancelled()) {
handle.setOnFire(event.getDuration());
}
} else {
handle.setOnFire(8);
}
}
} else if (handle.fireTicks <= 0) {
handle.fireTicks = -handle.maxFireTicks;
}