Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onUpdate() {
- ticksExisted = ++age;
- if (age >= 6000)
- setDead();
- prevPosX = posX;
- prevPosY = posY;
- prevPosZ = posZ;
- if (delayBeforeCanPickup > 0)
- delayBeforeCanPickup--;
- if (motionX != 0 || motionY != 0 || motionZ != 0 || motionX != -0 || motionY != -0 || motionZ != -0) {
- ticksExisted--;
- super.onUpdate();
- if ((Math.abs(motionX) + Math.abs(motionY) + Math.abs(motionZ)) <= 0.001)
- motionX = motionY = motionZ = 0;
- if (onGround)
- motionY = 0;
- if (handleWaterMovement()) {
- if (!inWater) {
- float f = MathHelper.sqrt_double(motionX * motionX * 0.2 + motionY * motionY + motionZ * motionZ * 0.2) * 0.2F;
- if (f > 1.0F)
- f = 1.0F;
- worldObj.playSoundAtEntity(this, "random.splash", f, 1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.4F);
- float f1 = MathHelper.floor_double(boundingBox.minY);
- for (int l = 0; (float) l < 1.0F + width * 20F; l++) {
- float f2 = (rand.nextFloat() * 2.0F - 1.0F) * width;
- float f4 = (rand.nextFloat() * 2.0F - 1.0F) * width;
- worldObj.spawnParticle("bubble", posX + (double) f2, f1 + 1.0F, posZ + (double) f4, motionX, motionY - (double) (rand.nextFloat() * 0.2F), motionZ);
- }
- for (int i1 = 0; (float) i1 < 1.0F + width * 20F; i1++) {
- float f3 = (rand.nextFloat() * 2.0F - 1.0F) * width;
- float f5 = (rand.nextFloat() * 2.0F - 1.0F) * width;
- worldObj.spawnParticle("splash", posX + (double) f3, f1 + 1.0F, posZ + (double) f5, motionX, motionY, motionZ);
- }
- }
- fallDistance = 0.0F;
- inWater = true;
- } else
- inWater = false;
- motionY -= 0.04;
- if (worldObj.getBlockMaterial(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) == Material.lava) {
- motionY = 0.2;
- motionX = (rand.nextFloat() - rand.nextFloat()) * 0.2F;
- motionZ = (rand.nextFloat() - rand.nextFloat()) * 0.2F;
- worldObj.playSoundAtEntity(this, "random.fizz", 0.4F, 2.0F + rand.nextFloat() * 0.4F);
- }
- pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2D, posZ);
- moveEntity(motionX, motionY, motionZ);
- float f = 0.98F;
- if (onGround) {
- f = 0.588F;
- int i = worldObj.getBlockId(MathHelper.floor_double(posX), MathHelper.floor_double(boundingBox.minY) - 1, MathHelper.floor_double(posZ));
- if (i > 0)
- f = Block.blocksList[i].slipperiness * 0.98F;
- }
- motionX *= f;
- motionY *= 0.98D;
- motionZ *= f;
- } else if (worldObj.getBlockId(MathHelper.floor_double(posX), MathHelper.floor_double((boundingBox.minY + boundingBox.maxY) / 2D) - 1, MathHelper.floor_double(posZ)) == 0
- || worldObj.getBlockId(MathHelper.floor_double(posX), MathHelper.floor_double((boundingBox.minY + boundingBox.maxY) / 2D), MathHelper.floor_double(posZ)) != 0)
- motionY = -0.01; // Wake dormant entity up. Use actual calculations if block underneath is removed or entity is covered with a block.
- }
Advertisement