Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class EntityFallingSand extends Entity {
4
5 public int a;
6 public int b = 0;
7
8 public EntityFallingSand(World world) {
9 super(world);
10 }
11
12 public EntityFallingSand(World world, double d0, double d1, double d2, int i) {
13 super(world);
14 this.a = i;
15 this.aI = true;
16 this.b(0.98F, 0.98F);
17 this.height = this.width / 2.0F;
18 this.setPosition(d0, d1, d2);
19 this.motX = 0.0D;
20 this.motY = 0.0D;
21 this.motZ = 0.0D;
22 this.lastX = d0;
23 this.lastY = d1;
24 this.lastZ = d2;
25 }
26
27 protected boolean n() {
28 return false;
29 }
30
31 protected void b() {
32 }
33
34 public boolean l_() {
35 return !this.dead;
36 }
37
38 public void m_() {
39 if (this.a == 0) {
40 this.die();
41 } else {
42 this.lastX = this.locX;
43 this.lastY = this.locY;
44 this.lastZ = this.locZ;
45 ++this.b;
46 this.motY -= 0.03999999910593033D;
47 this.move(this.motX, this.motY, this.motZ);
48 this.motX *= 0.9800000190734863D;
49 this.motY *= 0.9800000190734863D;
50 this.motZ *= 0.9800000190734863D;
51 int i = MathHelper.floor(this.locX);
52 int j = MathHelper.floor(this.locY);
53 int k = MathHelper.floor(this.locZ);
54
55 if (this.world.getTypeId(i, j, k) == this.a) {
56 this.world.setTypeId(i, j, k, 0);
57 }
58
59 if (this.onGround) {
60 this.motX *= 0.699999988079071D;
61 this.motZ *= 0.699999988079071D;
62 this.motY *= -0.5D;
63 this.die();
64 if ((!this.world.a(this.a, i, j, k, true, 1) || BlockSand.c_(this.world, i, j - 1, k) || !this.world.setTypeId(i, j, k, this.a)) && !this.world.isStatic) {
65 this.b(this.a, 1);
66 }
67 } else if (this.b > 100 && !this.world.isStatic) {
68 this.b(this.a, 1);
69 this.die();
70 }
71 }
72 }
73
74 protected void b(NBTTagCompound nbttagcompound) {
75 nbttagcompound.a("Tile", (byte) this.a);
76 }
77
78 protected void a(NBTTagCompound nbttagcompound) {
79 this.a = nbttagcompound.c("Tile") & 255;
80 }
81}