diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/Entity.java')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 114 |
1 files changed, 56 insertions, 58 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 8cf70538..7851d560 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -55,8 +55,8 @@ public abstract class Entity { public boolean bA; public boolean dead; public float height; - public float length; public float width; + public float length; public float bF; public float bG; public float fallDistance; // CraftBukkit - private -> public @@ -72,10 +72,8 @@ public abstract class Entity { public int ticksLived; public int maxFireTicks; public int fireTicks; // CraftBukkit - private -> public - public int maxAirTicks; // CraftBukkit - protected -> public protected boolean bS; public int noDamageTicks; - public int airTicks; private boolean justCreated; protected boolean fireProof; protected DataWatcher datawatcher; @@ -100,8 +98,8 @@ public abstract class Entity { this.bA = true; this.dead = false; this.height = 0.0F; - this.length = 0.6F; - this.width = 1.8F; + this.width = 0.6F; + this.length = 1.8F; this.bF = 0.0F; this.bG = 0.0F; this.fallDistance = 0.0F; @@ -146,8 +144,8 @@ public abstract class Entity { } protected void b(float f, float f1) { - this.length = f; - this.width = f1; + this.width = f; + this.length = f1; } protected void c(float f, float f1) { @@ -186,8 +184,8 @@ public abstract class Entity { this.locX = d0; this.locY = d1; this.locZ = d2; - float f = this.length / 2.0F; - float f1 = this.width; + 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); } @@ -219,7 +217,7 @@ public abstract class Entity { int l = this.world.getTypeId(j, k, i); if (l > 0) { - this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); + this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); } } @@ -237,15 +235,15 @@ public abstract class Entity { float f2; float f3; - for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { - f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { + f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); } - for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { - f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { + f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ); } } @@ -326,22 +324,22 @@ public abstract class Entity { server.getPluginManager().callEvent(combustEvent); if (!combustEvent.isCancelled()) { - this.j(combustEvent.getDuration()); + this.setOnFire(combustEvent.getDuration()); } } else { // This will be called every single tick the entity is in lava, so don't throw an event. - this.j(15); + this.setOnFire(15); } return; } // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls this.damageEntity(DamageSource.LAVA, 4); - this.j(15); + this.setOnFire(15); } } - public void j(int i) { + public void setOnFire(int i) { int j = i * 20; if (this.fireTicks < j) { @@ -349,7 +347,7 @@ public abstract class Entity { } } - public void aw() { + public void extinguish() { this.fireTicks = 0; } @@ -631,11 +629,11 @@ public abstract class Entity { this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - this.j(event.getDuration()); + this.setOnFire(event.getDuration()); } } else { // CraftBukkit end - this.j(8); + this.setOnFire(8); } } } else if (this.fireTicks <= 0) { @@ -699,7 +697,7 @@ public abstract class Entity { } } - public final boolean ax() { + public final boolean isFireproof() { return this.fireProof; } @@ -921,8 +919,8 @@ public abstract class Entity { } public void d(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ})); - nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ})); + nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bL, 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 // TODO: make sure this is the best way to address this. @@ -935,11 +933,11 @@ public abstract class Entity { } // CraftBukkit end - nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] { this.yaw, this.pitch})); - nbttagcompound.a("FallDistance", this.fallDistance); - nbttagcompound.a("Fire", (short) this.fireTicks); - nbttagcompound.a("Air", (short) this.getAirTicks()); - nbttagcompound.a("OnGround", this.onGround); + nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch})); + nbttagcompound.setFloat("FallDistance", this.fallDistance); + nbttagcompound.setShort("Fire", (short) this.fireTicks); + nbttagcompound.setShort("Air", (short) this.getAirTicks()); + nbttagcompound.setBoolean("OnGround", this.onGround); // CraftBukkit start nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits()); @@ -950,13 +948,13 @@ public abstract class Entity { } public void e(NBTTagCompound nbttagcompound) { - NBTTagList nbttaglist = nbttagcompound.m("Pos"); - NBTTagList nbttaglist1 = nbttagcompound.m("Motion"); - NBTTagList nbttaglist2 = nbttagcompound.m("Rotation"); + NBTTagList nbttaglist = nbttagcompound.getList("Pos"); + NBTTagList nbttaglist1 = nbttagcompound.getList("Motion"); + NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation"); - this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; - this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; - this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; + this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data; + this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data; + this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data; /* CraftBukkit start - moved section down if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; @@ -971,15 +969,15 @@ public abstract class Entity { } // CraftBukkit end */ - this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; - this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; - this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; - this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; - this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; - this.fallDistance = nbttagcompound.h("FallDistance"); - this.fireTicks = nbttagcompound.e("Fire"); - this.setAirTicks(nbttagcompound.e("Air")); - this.onGround = nbttagcompound.n("OnGround"); + 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.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data; + this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data; + this.fallDistance = nbttagcompound.getFloat("FallDistance"); + this.fireTicks = nbttagcompound.getShort("Fire"); + this.setAirTicks(nbttagcompound.getShort("Air")); + this.onGround = nbttagcompound.getBoolean("OnGround"); this.setPosition(this.locX, this.locY, this.locZ); // CraftBukkit start @@ -1050,7 +1048,7 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { double d0 = adouble1[j]; - nbttaglist.a((NBTBase) (new NBTTagDouble((String) null, d0))); + nbttaglist.add(new NBTTagDouble((String) null, d0)); } return nbttaglist; @@ -1064,7 +1062,7 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { float f = afloat1[j]; - nbttaglist.a((NBTBase) (new NBTTagFloat((String) null, f))); + nbttaglist.add(new NBTTagFloat((String) null, f)); } return nbttaglist; @@ -1086,15 +1084,15 @@ public abstract class Entity { return entityitem; } - public boolean aj() { + public boolean isAlive() { return !this.dead; } public boolean T() { for (int i = 0; i < 8; ++i) { - float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.8F; + 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.length * 0.8F; + 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 l = MathHelper.floor(this.locZ + (double) f2); @@ -1180,7 +1178,7 @@ public abstract class Entity { } public double q() { - return (double) this.width * 0.75D; + return (double) this.length * 0.75D; } public void mount(Entity entity) { @@ -1213,7 +1211,7 @@ public abstract class Entity { } // CraftBukkit end - this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch); + this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.vehicle.passenger = null; } @@ -1228,7 +1226,7 @@ public abstract class Entity { this.vehicle.passenger = null; this.vehicle = null; - this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch); + this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch); } else { if (this.vehicle != null) { this.vehicle.passenger = null; @@ -1303,10 +1301,10 @@ public abstract class Entity { this.datawatcher.watch(1, Short.valueOf((short) i)); } - public void a(EntityWeatherStorm entityweatherstorm) { + public void a(EntityWeatherLighting entityweatherlighting) { // CraftBukkit start final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity(); - final org.bukkit.entity.Entity stormBukkitEntity = entityweatherstorm.getBukkitEntity(); + final org.bukkit.entity.Entity stormBukkitEntity = entityweatherlighting.getBukkitEntity(); final PluginManager pluginManager = Bukkit.getServer().getPluginManager(); if (thisBukkitEntity instanceof Painting) { @@ -1334,7 +1332,7 @@ public abstract class Entity { EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); pluginManager.callEvent(entityCombustEvent); if (!entityCombustEvent.isCancelled()) { - this.j(entityCombustEvent.getDuration()); + this.setOnFire(entityCombustEvent.getDuration()); } // CraftBukkit end } @@ -1433,7 +1431,7 @@ public abstract class Entity { s = "generic"; } - return StatisticCollector.a("entity." + s + ".name"); + return LocaleI18n.a("entity." + s + ".name"); } public Entity[] aG() { |