GenuineSounds

EntityItem Tick Fix Version 3

Jul 12th, 2012
283
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. public void onUpdate() {
  2.     if (age >= 6000)
  3.         setDead();
  4.     if (delayBeforeCanPickup > 0)
  5.         delayBeforeCanPickup--;
  6.     if (motionX != 0 || motionY != 0 || motionZ != 0 || motionX != -0 || motionY != -0 || motionZ != -0) {
  7.         super.onUpdate();
  8.         age = ticksExisted;
  9.         if ((Math.abs(motionX) + Math.abs(motionY) + Math.abs(motionZ)) <= 0.001)
  10.             motionX = motionY = motionZ = 0;
  11.         if (onGround)
  12.             motionY = 0;
  13.         motionY -= 0.04D;
  14.         if (worldObj.getBlockMaterial(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) == Material.lava) {
  15.             motionY = 0.2D;
  16.             motionX = (rand.nextFloat() - rand.nextFloat()) * 0.2F;
  17.             motionZ = (rand.nextFloat() - rand.nextFloat()) * 0.2F;
  18.             worldObj.playSoundAtEntity(this, "random.fizz", 0.4F, 2.0F + rand.nextFloat() * 0.4F);
  19.         }
  20.         pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2D, posZ);
  21.         moveEntity(motionX, motionY, motionZ);
  22.         float f = 0.98F;
  23.         if (onGround) {
  24.             f = 0.588F;
  25.             int i = worldObj.getBlockId(MathHelper.floor_double(posX), MathHelper.floor_double(boundingBox.minY) - 1, MathHelper.floor_double(posZ));
  26.             if (i > 0)
  27.                 f = Block.blocksList[i].slipperiness * 0.98F;
  28.         }
  29.         motionX *= f;
  30.         motionY *= 0.98D;
  31.         motionZ *= f;
  32.     } else {
  33.         ticksExisted = ++age;
  34.         prevPosX = posX;
  35.         prevPosY = posY;
  36.         prevPosZ = posZ;
  37.         prevRotationPitch = rotationPitch;
  38.         prevRotationYaw = rotationYaw;
  39.         int x = MathHelper.floor_double(posX);
  40.         int y = MathHelper.floor_double((boundingBox.minY + boundingBox.maxY) / 2D);
  41.         int z = MathHelper.floor_double(posZ);
  42.         int id = worldObj.getBlockId(x, y, z);
  43.         if (worldObj.getBlockId(x, y - 1, z) == 0 || (id != 0 && (Block.blocksList[id] != null && Block.blocksList[id].isOpaqueCube())))
  44.             motionY = -0.01;
  45.     }
  46. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment