Updated to Minecraft 1.1

This commit is contained in:
Erik Broes
2012-01-12 23:10:13 +01:00
parent dd5ef8725c
commit 7219d4dd85
82 changed files with 1472 additions and 1687 deletions

View File

@@ -28,8 +28,8 @@ public abstract class Entity {
private static int entityCount = 0;
public int id;
public double bb;
public boolean bc;
public double be;
public boolean bf;
public Entity passenger;
public Entity vehicle;
public World world;
@@ -49,76 +49,76 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox;
public boolean onGround;
public boolean positionChanged;
public boolean bw;
public boolean bx;
public boolean velocityChanged;
protected boolean bz;
public boolean bz;
public boolean bA;
public boolean velocityChanged;
protected boolean bC;
public boolean bD;
public boolean dead;
public float height;
public float width;
public float length;
public float bF;
public float bG;
public float bI;
public float bJ;
public float fallDistance; // CraftBukkit - private -> public
private int b;
public double bI;
public double bJ;
public double bK;
public float bL;
public float bM;
public boolean bN;
public double bL;
public double bM;
public double bN;
public float bO;
public float bP;
public boolean bQ;
public float bR;
protected Random random;
public int ticksLived;
public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public
protected boolean bS;
protected boolean bV;
public int noDamageTicks;
private boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
private double e;
private double f;
public boolean bW;
public int bX;
public int bY;
public int bZ;
public boolean ca;
public boolean cb;
public boolean bZ;
public int ca;
public int cb;
public int cc;
public boolean cd;
public boolean ce;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public Entity(World world) {
this.id = entityCount++;
this.bb = 1.0D;
this.bc = false;
this.be = 1.0D;
this.bf = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false;
this.bx = false;
this.bA = false;
this.velocityChanged = false;
this.bA = true;
this.bD = true;
this.dead = false;
this.height = 0.0F;
this.width = 0.6F;
this.length = 1.8F;
this.bF = 0.0F;
this.bG = 0.0F;
this.bI = 0.0F;
this.bJ = 0.0F;
this.fallDistance = 0.0F;
this.b = 1;
this.bL = 0.0F;
this.bM = 0.0F;
this.bN = false;
this.bO = 0.0F;
this.bP = 0.0F;
this.bQ = false;
this.bR = 0.0F;
this.random = new Random();
this.ticksLived = 0;
this.maxFireTicks = 1;
this.fireTicks = 0;
this.bS = false;
this.bV = false;
this.noDamageTicks = 0;
this.justCreated = true;
this.fireProof = false;
this.datawatcher = new DataWatcher();
this.bW = false;
this.bZ = false;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
@@ -188,21 +188,21 @@ public abstract class Entity {
float f = this.width / 2.0F;
float f1 = this.length;
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bL, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bL + (double) f1, d2 + (double) f);
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bO, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bO + (double) f1, d2 + (double) f);
}
public void w_() {
this.af();
public void y_() {
this.am();
}
public void af() {
public void am() {
// MethodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
}
++this.ticksLived;
this.bF = this.bG;
this.bI = this.bJ;
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -223,7 +223,7 @@ public abstract class Entity {
}
if (this.i_()) {
if (!this.bS && !this.justCreated) {
if (!this.bV && !this.justCreated) {
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) {
@@ -250,10 +250,10 @@ public abstract class Entity {
}
this.fallDistance = 0.0F;
this.bS = true;
this.bV = true;
this.fireTicks = 0;
} else {
this.bS = false;
this.bV = false;
}
if (this.world.isStatic) {
@@ -284,13 +284,13 @@ public abstract class Entity {
}
}
if (this.aA()) {
this.av();
if (this.aL()) {
this.aG();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
this.ao();
this.az();
}
if (!this.world.isStatic) {
@@ -302,7 +302,7 @@ public abstract class Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
}
protected void av() {
protected void aG() {
if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@@ -352,7 +352,7 @@ public abstract class Entity {
this.fireTicks = 0;
}
protected void ao() {
protected void az() {
this.die();
}
@@ -364,19 +364,19 @@ public abstract class Entity {
}
public void move(double d0, double d1, double d2) {
if (this.bN) {
if (this.bQ) {
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.bL;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else {
// MethodProfiler.a("move"); // CraftBukkit - not in production code
this.bL *= 0.4F;
this.bO *= 0.4F;
double d3 = this.locX;
double d4 = this.locZ;
if (this.bz) {
this.bz = false;
if (this.bC) {
this.bC = false;
d0 *= 0.25D;
d1 *= 0.05000000074505806D;
d2 *= 0.25D;
@@ -422,7 +422,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -437,7 +437,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bA && d5 != d0) {
if (!this.bD && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -448,7 +448,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bA && d7 != d2) {
if (!this.bD && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -458,13 +458,13 @@ public abstract class Entity {
double d10;
int k;
if (this.bM > 0.0F && flag1 && (flag || this.bL < 0.05F) && (d5 != d0 || d7 != d2)) {
if (this.bP > 0.0F && flag1 && (flag || this.bO < 0.05F) && (d5 != d0 || d7 != d2)) {
d9 = d0;
d10 = d1;
double d11 = d2;
d0 = d5;
d1 = (double) this.bM;
d1 = (double) this.bP;
d2 = d7;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@@ -476,7 +476,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -487,7 +487,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bA && d5 != d0) {
if (!this.bD && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -498,18 +498,18 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bA && d7 != d2) {
if (!this.bD && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
} else {
d1 = (double) (-this.bM);
d1 = (double) (-this.bP);
for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@@ -527,7 +527,7 @@ public abstract class Entity {
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
if (d12 > 0.0D) {
this.bL = (float) ((double) this.bL + d12 + 0.01D);
this.bO = (float) ((double) this.bO + d12 + 0.01D);
}
}
}
@@ -535,12 +535,12 @@ public abstract class Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
// MethodProfiler.a("rest"); // CraftBukkit - not in production code
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d5 != d0 || d7 != d2;
this.bw = d6 != d1;
this.bz = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D;
this.bx = this.positionChanged || this.bw;
this.bA = this.positionChanged || this.bz;
this.a(d1, this.onGround);
if (d5 != d0) {
this.motX = 0.0D;
@@ -581,7 +581,7 @@ public abstract class Entity {
// CraftBukkit end
if (this.g_() && !flag && this.vehicle == null) {
this.bG = (float) ((double) this.bG + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
this.bJ = (float) ((double) this.bJ + (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);
@@ -590,8 +590,8 @@ public abstract class Entity {
k = this.world.getTypeId(l, i1 - 1, j1);
}
if (this.bG > (float) this.b && k > 0) {
this.b = (int) this.bG + 1;
if (this.bJ > (float) this.b && k > 0) {
this.b = (int) this.bJ + 1;
this.a(l, i1, j1, k);
Block.byId[k].b(this.world, l, i1, j1, this);
}
@@ -618,7 +618,7 @@ public abstract class Entity {
}
}
boolean flag2 = this.ay();
boolean flag2 = this.aJ();
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
this.burn(1);
@@ -668,6 +668,21 @@ public abstract class Entity {
protected void a(double d0, boolean flag) {
if (flag) {
if (this.fallDistance > 0.0F) {
if (this instanceof EntityLiving) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k);
if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
l = this.world.getTypeId(i, j - 1, k);
}
if (l > 0) {
Block.byId[l].a(this.world, i, j, k, this, this.fallDistance);
}
}
this.b(this.fallDistance);
this.fallDistance = 0.0F;
}
@@ -708,12 +723,12 @@ public abstract class Entity {
}
}
public boolean ay() {
return this.bS || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
public boolean aJ() {
return this.bV || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
public boolean az() {
return this.bS;
public boolean aK() {
return this.bV;
}
public boolean i_() {
@@ -721,7 +736,7 @@ public abstract class Entity {
}
public boolean a(Material material) {
double d0 = this.locY + (double) this.x();
double d0 = this.locY + (double) this.y();
int i = MathHelper.floor(this.locX);
int j = MathHelper.d((float) MathHelper.floor(d0));
int k = MathHelper.floor(this.locZ);
@@ -737,11 +752,11 @@ public abstract class Entity {
}
}
public float x() {
public float y() {
return 0.0F;
}
public boolean aA() {
public boolean aL() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
@@ -795,7 +810,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
this.bL = 0.0F;
this.bO = 0.0F;
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@@ -811,9 +826,9 @@ public abstract class Entity {
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
this.bI = this.lastX = this.locX = d0;
this.bJ = this.lastY = this.locY = d1 + (double) this.height;
this.bK = this.lastZ = this.locZ = d2;
this.bL = this.lastX = this.locX = d0;
this.bM = this.lastY = this.locY = d1 + (double) this.height;
this.bN = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ);
@@ -873,8 +888,8 @@ public abstract class Entity {
d1 *= d3;
d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D;
d0 *= (double) (1.0F - this.bO);
d1 *= (double) (1.0F - this.bO);
d0 *= (double) (1.0F - this.bR);
d1 *= (double) (1.0F - this.bR);
this.b_(-d0, 0.0D, -d1);
entity.b_(d0, 0.0D, d1);
}
@@ -885,15 +900,15 @@ public abstract class Entity {
this.motX += d0;
this.motY += d1;
this.motZ += d2;
this.cb = true;
this.ce = true;
}
protected void aB() {
protected void aM() {
this.velocityChanged = true;
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aB();
this.aM();
return false;
}
@@ -908,7 +923,7 @@ public abstract class Entity {
public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.aC();
String s = this.aN();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@@ -920,7 +935,7 @@ public abstract class Entity {
}
public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ}));
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bO, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
@@ -970,9 +985,9 @@ public abstract class Entity {
}
// CraftBukkit end */
this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastX = this.bL = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
this.lastY = this.bM = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
this.lastZ = this.bN = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
this.fallDistance = nbttagcompound.getFloat("FallDistance");
@@ -1033,7 +1048,7 @@ public abstract class Entity {
// CraftBukkit end
}
protected final String aC() {
protected final String aN() {
return EntityTypes.b(this);
}
@@ -1089,13 +1104,13 @@ public abstract class Entity {
return !this.dead;
}
public boolean T() {
public boolean U() {
for (int i = 0; i < 8; ++i) {
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.width * 0.8F;
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.width * 0.8F;
int j = MathHelper.floor(this.locX + (double) f);
int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1);
int k = MathHelper.floor(this.locY + (double) this.y() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2);
if (this.world.e(j, k, l)) {
@@ -1114,14 +1129,14 @@ public abstract class Entity {
return null;
}
public void M() {
public void N() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
this.w_();
this.y_();
if (this.vehicle != null) {
this.vehicle.i();
this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
@@ -1171,10 +1186,10 @@ public abstract class Entity {
}
public void i() {
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.R(), this.locZ);
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.S(), this.locZ);
}
public double R() {
public double S() {
return (double) this.height;
}
@@ -1259,7 +1274,7 @@ public abstract class Entity {
return 0.1F;
}
public Vec3D ap() {
public Vec3D aA() {
return null;
}
@@ -1269,7 +1284,7 @@ public abstract class Entity {
return null;
}
public boolean z() {
public boolean A() {
return this.fireTicks > 0 || this.k(0);
}
@@ -1289,7 +1304,7 @@ public abstract class Entity {
this.a(3, flag);
}
public void g(boolean flag) {
public void h(boolean flag) {
this.a(4, flag);
}
@@ -1435,7 +1450,8 @@ public abstract class Entity {
}
public void s() {
this.bz = true;
this.bC = true;
this.fallDistance = 0.0F;
}
public String ad() {
@@ -1448,7 +1464,7 @@ public abstract class Entity {
return LocaleI18n.a("entity." + s + ".name");
}
public Entity[] aG() {
public Entity[] aR() {
return null;
}