diff options
Diffstat (limited to 'src/main/java/net/minecraft')
49 files changed, 1544 insertions, 1265 deletions
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java index 9adce396..f47babd8 100644 --- a/src/main/java/net/minecraft/server/BlockDispenser.java +++ b/src/main/java/net/minecraft/server/BlockDispenser.java @@ -23,29 +23,31 @@ public class BlockDispenser extends BlockContainer { } private void g(World world, int i, int j, int k) { - int l = world.getTypeId(i, j, k - 1); - int i1 = world.getTypeId(i, j, k + 1); - int j1 = world.getTypeId(i - 1, j, k); - int k1 = world.getTypeId(i + 1, j, k); - byte b0 = 3; - - if (Block.o[l] && !Block.o[i1]) { - b0 = 3; - } + if (!world.isStatic) { + int l = world.getTypeId(i, j, k - 1); + int i1 = world.getTypeId(i, j, k + 1); + int j1 = world.getTypeId(i - 1, j, k); + int k1 = world.getTypeId(i + 1, j, k); + byte b0 = 3; + + if (Block.o[l] && !Block.o[i1]) { + b0 = 3; + } - if (Block.o[i1] && !Block.o[l]) { - b0 = 2; - } + if (Block.o[i1] && !Block.o[l]) { + b0 = 2; + } - if (Block.o[j1] && !Block.o[k1]) { - b0 = 5; - } + if (Block.o[j1] && !Block.o[k1]) { + b0 = 5; + } - if (Block.o[k1] && !Block.o[j1]) { - b0 = 4; - } + if (Block.o[k1] && !Block.o[j1]) { + b0 = 4; + } - world.setData(i, j, k, b0); + world.setData(i, j, k, b0); + } } public int a(int i) { diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index 6a1f8342..89f8b01a 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -210,4 +210,8 @@ public class BlockDoor extends Block { public boolean canPlace(World world, int i, int j, int k) { return j >= 127 ? false : world.d(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k); } + + public static boolean e(int i) { + return (i & 4) != 0; + } } diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index 05a45eb3..3c5a063b 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -32,7 +32,7 @@ public class BlockLeaves extends BlockLeavesBase { if (l1 == Block.LEAVES.id) { int i2 = world.getData(i + i1, j + j1, k + k1); - world.setRawData(i + i1, j + j1, k + k1, i2 | 4); + world.setRawData(i + i1, j + j1, k + k1, i2 | 8); } } } @@ -44,7 +44,7 @@ public class BlockLeaves extends BlockLeavesBase { if (!world.isStatic) { int l = world.getData(i, j, k); - if ((l & 4) != 0) { + if ((l & 8) != 0) { byte b0 = 4; int i1 = b0 + 1; byte b1 = 32; @@ -114,7 +114,7 @@ public class BlockLeaves extends BlockLeavesBase { l1 = this.a[k1 * j1 + k1 * b1 + k1]; if (l1 >= 0) { - world.setData(i, j, k, l & -5); + world.setData(i, j, k, l & -9); } else { this.g(world, i, j, k); } @@ -137,13 +137,17 @@ public class BlockLeaves extends BlockLeavesBase { } public int a(Random random) { - return random.nextInt(16) == 0 ? 1 : 0; + return random.nextInt(20) == 0 ? 1 : 0; } public int a(int i, Random random) { return Block.SAPLING.id; } + protected int b(int i) { + return i & 3; + } + public boolean a() { return !this.b; } diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java index ccec76ba..55b4b5ed 100644 --- a/src/main/java/net/minecraft/server/BlockPumpkin.java +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -27,7 +27,7 @@ public class BlockPumpkin extends Block { ++k; } - return j == 0 && i == 2 ? k : (j == 1 && i == 5 ? k : (j == 2 && i == 3 ? k : (j == 3 && i == 4 ? k : this.textureId + 16))); + return j == 2 && i == 2 ? k : (j == 3 && i == 5 ? k : (j == 0 && i == 3 ? k : (j == 1 && i == 4 ? k : this.textureId + 16))); } } @@ -42,11 +42,11 @@ public class BlockPumpkin extends Block { public boolean canPlace(World world, int i, int j, int k) { int l = world.getTypeId(i, j, k); - return (l == 0 || Block.byId[l].material.isLiquid()) && world.d(i, j - 1, k); + return (l == 0 || Block.byId[l].material.isReplacable()) && world.d(i, j - 1, k); } public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) { - int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3; + int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3; world.setData(i, j, k, l); } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java index d9d473fb..bfd6434c 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -113,10 +113,10 @@ public class BlockRedstoneWire extends Block { // CraftBukkit end if (k1 != l1) { - world.h = true; + world.j = true; world.setData(i, j, k, l1); world.b(i, j, k, i, j, k); - world.h = false; + world.j = false; for (i2 = 0; i2 < 4; ++i2) { j2 = i; diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java index 5e2c4220..438f7752 100644 --- a/src/main/java/net/minecraft/server/BlockSoil.java +++ b/src/main/java/net/minecraft/server/BlockSoil.java @@ -17,7 +17,7 @@ public class BlockSoil extends Block { this.textureId = 87; this.a(true); this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F); - this.e(255); + this.f(255); } public AxisAlignedBB d(World world, int i, int j, int k) { @@ -34,9 +34,7 @@ public class BlockSoil extends Block { public void a(World world, int i, int j, int k, Random random) { if (random.nextInt(5) == 0) { - if (this.h(world, i, j, k)) { - world.setData(i, j, k, 7); - } else { + if (!this.h(world, i, j, k) && !world.q(i, j + 1, k)) { int l = world.getData(i, j, k); if (l > 0) { @@ -44,6 +42,8 @@ public class BlockSoil extends Block { } else if (!this.g(world, i, j, k)) { world.setTypeId(i, j, k, Block.DIRT.id); } + } else { + world.setData(i, j, k, 7); } } } diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java index 133b32b6..7a996584 100644 --- a/src/main/java/net/minecraft/server/BlockStationary.java +++ b/src/main/java/net/minecraft/server/BlockStationary.java @@ -30,11 +30,11 @@ public class BlockStationary extends BlockFluids { private void i(World world, int i, int j, int k) { int l = world.getData(i, j, k); - world.h = true; + world.j = true; world.setRawTypeIdAndData(i, j, k, this.id - 1, l); world.b(i, j, k, i, j, k); world.c(i, j, k, this.id - 1, this.b()); - world.h = false; + world.j = false; } public void a(World world, int i, int j, int k, Random random) { diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index a36b330f..ebf7e95d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -377,15 +377,15 @@ public class Chunk { k = this.entitySlices.length - 1; } - entity.bA = true; + entity.bB = true; entity.chunkX = this.x; - entity.bC = k; + entity.bD = k; entity.chunkZ = this.z; this.entitySlices[k].add(entity); } public void b(Entity entity) { - this.a(entity, entity.bC); + this.a(entity, entity.bD); } public void a(Entity entity, int i) { @@ -619,12 +619,6 @@ public class Chunk { } public void h() { - for (int i = 0; i < this.b.length; ++i) { - byte b0 = this.b[i]; - - if (b0 != 0 && Block.byId[b0 & 255] == null) { - this.b[i] = 0; - } - } + BlockRegister.a(this.b); } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 5255e861..f6f93d28 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -208,7 +208,7 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean unloadChunks() { - if (!this.world.w) { + if (!this.world.y) { // CraftBukkit start Server server = this.world.getServer(); for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) { @@ -240,6 +240,6 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean b() { - return !this.world.w; + return !this.world.y; } } diff --git a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java index 54447619..c974a55f 100644 --- a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java +++ b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java @@ -34,10 +34,10 @@ public class ConsoleCommandHandler { this.print(s1, "Save complete."); } else if (s.toLowerCase().startsWith("save-off")) { this.print(s1, "Disabling level saving.."); - worldserver.w = true; + worldserver.y = true; } else if (s.toLowerCase().startsWith("save-on")) { this.print(s1, "Enabling level saving.."); - worldserver.w = false; + worldserver.y = false; } else { String s2; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 9e551c8f..ec6bfc20 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -22,8 +22,8 @@ public abstract class Entity { private static int entityCount = 0; public int id; - public double aC; - public boolean aD; + public double aD; + public boolean aE; public Entity passenger; public Entity vehicle; public World world; @@ -43,87 +43,86 @@ public abstract class Entity { public final AxisAlignedBB boundingBox; public boolean onGround; public boolean positionChanged; - public boolean aX; public boolean aY; + public boolean aZ; public boolean velocityChanged; - public boolean ba; + public boolean bb; + public boolean bc; public boolean dead; public float height; public float length; public float width; - public float bf; - public float bg; + public float bh; + public float bi; public float fallDistance; // Craftbukkit made 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 float bn; public float bo; public boolean bp; + public float bq; protected Random random; public int ticksLived; public int maxFireTicks; public int fireTicks; public int maxAirTicks; // CraftBukkit -- protected->public - protected boolean bv; + protected boolean bw; public int noDamageTicks; public int airTicks; private boolean justCreated; - protected boolean by; + protected boolean bz; protected DataWatcher datawatcher; private double d; private double e; - public boolean bA; + public boolean bB; public int chunkX; - public int bC; + public int bD; public int chunkZ; public Entity(World world) { this.id = entityCount++; - this.aC = 1.0D; - this.aD = false; + this.aD = 1.0D; + this.aE = false; this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.onGround = false; - this.aY = false; + this.aZ = false; this.velocityChanged = false; - this.ba = true; + this.bc = true; this.dead = false; this.height = 0.0F; this.length = 0.6F; this.width = 1.8F; - this.bf = 0.0F; - this.bg = 0.0F; + this.bh = 0.0F; + this.bi = 0.0F; this.fallDistance = 0.0F; this.b = 1; - this.bl = 0.0F; - this.bm = 0.0F; - this.bn = false; + this.bn = 0.0F; this.bo = 0.0F; this.bp = false; + this.bq = 0.0F; this.random = new Random(); this.ticksLived = 0; this.maxFireTicks = 1; this.fireTicks = 0; this.maxAirTicks = 300; - this.bv = false; + this.bw = false; this.noDamageTicks = 0; this.airTicks = 300; this.justCreated = true; - this.by = false; + this.bz = false; this.datawatcher = new DataWatcher(); - this.bA = false; + this.bB = false; this.world = world; this.setPosition(0.0D, 0.0D, 0.0D); this.datawatcher.a(0, Byte.valueOf((byte) 0)); - this.a(); + this.b(); } - protected abstract void a(); + protected abstract void b(); - public DataWatcher T() { + public DataWatcher W() { return this.datawatcher; } @@ -161,10 +160,10 @@ public abstract class Entity { } f1 = 0; } - - this.yaw = f % 360f; - this.pitch = f1 % 360f; // Craftbukkit end + + this.yaw = f % 360.0F; + this.pitch = f1 % 360.0F; } public void setPosition(double d0, double d1, double d2) { @@ -174,27 +173,27 @@ public abstract class Entity { float f = this.length / 2.0F; float f1 = this.width; - 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.bn, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bn + (double) f1, d2 + (double) f); } - public void f_() { - this.L(); + public void p_() { + this.N(); } - public void L() { + public void N() { if (this.vehicle != null && this.vehicle.dead) { this.vehicle = null; } ++this.ticksLived; - this.bf = this.bg; + this.bh = this.bi; this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; this.lastPitch = this.pitch; this.lastYaw = this.yaw; - if (this.g_()) { - if (!this.bv && !this.justCreated) { + if (this.f_()) { + if (!this.bw && !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) { @@ -222,16 +221,16 @@ public abstract class Entity { } this.fallDistance = 0.0F; - this.bv = true; + this.bw = true; this.fireTicks = 0; } else { - this.bv = false; + this.bw = false; } if (this.world.isStatic) { this.fireTicks = 0; } else if (this.fireTicks > 0) { - if (this.by) { + if (this.bz) { this.fireTicks -= 4; if (this.fireTicks < 0) { this.fireTicks = 0; @@ -262,12 +261,12 @@ public abstract class Entity { } } - if (this.V()) { - this.U(); + if (this.aa()) { + this.X(); } if (this.locY < -64.0D) { - this.R(); + this.U(); } if (!this.world.isStatic) { @@ -278,8 +277,8 @@ public abstract class Entity { this.justCreated = false; } - protected void U() { - if (!this.by) { + protected void X() { + if (!this.bz) { // CraftBukkit start -- TODO: this event spams! if (this instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); @@ -316,7 +315,7 @@ public abstract class Entity { } } - protected void R() { + protected void U() { this.die(); } @@ -324,18 +323,29 @@ public abstract class Entity { AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2); List list = this.world.getEntities(this, axisalignedbb); - return list.size() > 0 ? false : !this.world.b(axisalignedbb); + return list.size() > 0 ? false : !this.world.c(axisalignedbb); } public void move(double d0, double d1, double d2) { - if (this.bn) { + if (this.bp) { 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.bn; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; } else { double d3 = this.locX; double d4 = this.locZ; + + if (this.bb) { + this.bb = false; + d0 *= 0.25D; + d1 *= 0.05000000074505806D; + d2 *= 0.25D; + this.motX = 0.0D; + this.motY = 0.0D; + this.motZ = 0.0D; + } + double d5 = d0; double d6 = d1; double d7 = d2; @@ -373,7 +383,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.ba && d6 != d1) { + if (!this.bc && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -388,7 +398,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.ba && d5 != d0) { + if (!this.bc && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -399,7 +409,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.ba && d7 != d2) { + if (!this.bc && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -409,13 +419,13 @@ public abstract class Entity { double d10; int k; - if (this.bm > 0.0F && flag1 && this.bl < 0.05F && (d5 != d0 || d7 != d2)) { + if (this.bo > 0.0F && flag1 && this.bn < 0.05F && (d5 != d0 || d7 != d2)) { d9 = d0; d10 = d1; double d11 = d2; d0 = d5; - d1 = (double) this.bm; + d1 = (double) this.bo; d2 = d7; AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); @@ -427,7 +437,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.ba && d6 != d1) { + if (!this.bc && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -438,7 +448,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.ba && d5 != d0) { + if (!this.bc && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -449,7 +459,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.ba && d7 != d2) { + if (!this.bc && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -461,17 +471,17 @@ public abstract class Entity { d2 = d11; this.boundingBox.b(axisalignedbb1); } else { - this.bl = (float) ((double) this.bl + 0.5D); + this.bn = (float) ((double) this.bn + 0.5D); } } 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.bn; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.positionChanged = d5 != d0 || d7 != d2; - this.aX = d6 != d1; + this.aY = d6 != d1; this.onGround = d6 != d1 && d6 < 0.0D; - this.aY = this.positionChanged || this.aX; + this.aZ = this.positionChanged || this.aY; this.a(d1, this.onGround); if (d5 != d0) { this.motX = 0.0D; @@ -512,13 +522,13 @@ public abstract class Entity { } // CraftBukkit end - if (this.l() && !flag) { - this.bg = (float) ((double) this.bg + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); + if (this.n() && !flag) { + this.bi = (float) ((double) this.bi + (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); k = this.world.getTypeId(l, i1, j1); - if (this.bg > (float) this.b && k > 0) { + if (this.bi > (float) this.b && k > 0) { ++this.b; StepSound stepsound = Block.byId[k].stepSound; @@ -554,10 +564,10 @@ public abstract class Entity { } } - this.bl *= 0.4F; - boolean flag2 = this.g_(); + this.bn *= 0.4F; + boolean flag2 = this.Y(); - if (this.world.c(this.boundingBox)) { + if (this.world.d(this.boundingBox)) { this.a(1); if (!flag2) { ++this.fireTicks; @@ -589,7 +599,7 @@ public abstract class Entity { } } - protected boolean l() { + protected boolean n() { return true; } @@ -604,12 +614,12 @@ public abstract class Entity { } } - public AxisAlignedBB d() { + public AxisAlignedBB e_() { return null; } protected void a(int i) { - if (!this.by) { + if (!this.bz) { // CraftBukkit start if (this instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); @@ -633,12 +643,20 @@ public abstract class Entity { protected void a(float f) {} - public boolean g_() { + public boolean Y() { + return this.bw || this.world.q(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + } + + public boolean Z() { + return this.bw; + } + + public boolean f_() { return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D), Material.WATER, this); } public boolean a(Material material) { - double d0 = this.locY + (double) this.q(); + double d0 = this.locY + (double) this.s(); int i = MathHelper.floor(this.locX); int j = MathHelper.d((float) MathHelper.floor(d0)); int k = MathHelper.floor(this.locZ); @@ -654,11 +672,11 @@ public abstract class Entity { } } - public float q() { + public float s() { return 0.0F; } - public boolean V() { + public boolean aa() { return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); } @@ -696,7 +714,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.bn = 0.0F; double d3 = (double) (this.lastYaw - f); if (d3 < -180.0D) { @@ -712,9 +730,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.bk = this.lastX = this.locX = d0; + this.bl = this.lastY = this.locY = d1 + (double) this.height; + this.bm = this.lastZ = this.locZ = d2; this.yaw = f; this.pitch = f1; this.setPosition(this.locX, this.locY, this.locZ); @@ -774,8 +792,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.bq); + d1 *= (double) (1.0F - this.bq); this.f(-d0, 0.0D, -d1); entity.f(d0, 0.0D, d1); } @@ -788,27 +806,27 @@ public abstract class Entity { this.motZ += d2; } - protected void W() { + protected void ab() { this.velocityChanged = true; } public boolean damageEntity(Entity entity, int i) { - this.W(); + this.ab(); return false; } - public boolean d_() { + public boolean o_() { return false; } - public boolean e_() { + public boolean d_() { return false; } public void c(Entity entity, int i) {} public boolean c(NBTTagCompound nbttagcompound) { - String s = this.X(); + String s = this.ac(); if (!this.dead && s != null) { nbttagcompound.setString("id", s); @@ -828,7 +846,7 @@ public abstract class Entity { nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("OnGround", this.onGround); nbttagcompound.setString("World", world.worldData.name); // CraftBukkit - this.a(nbttagcompound); + this.b(nbttagcompound); } public void e(NBTTagCompound nbttagcompound) { @@ -840,7 +858,7 @@ public abstract class Entity { this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; - //CraftBukkit Start + // CraftBukkit Start //Exempt Vehicles from notch's sanity check if (!(this.getBukkitEntity() instanceof CraftVehicle)) { if (Math.abs(this.motX) > 10.0D) { @@ -855,11 +873,11 @@ public abstract class Entity { this.motZ = 0.0D; } } - //CraftBukkit End + // 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.lastX = this.bk = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; + this.lastY = this.bl = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; + this.lastZ = this.bm = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a % 6.2831855F; this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a % 6.2831855F; this.fallDistance = nbttagcompound.g("FallDistance"); @@ -886,17 +904,17 @@ public abstract class Entity { // CraftBukkit end this.setPosition(this.locX, this.locY, this.locZ); - this.b(nbttagcompound); + this.a(nbttagcompound); } - protected final String X() { + protected final String ac() { return EntityTypes.b(this); } - protected abstract void b(NBTTagCompound nbttagcompound); - protected abstract void a(NBTTagCompound nbttagcompound); + protected abstract void b(NBTTagCompound nbttagcompound); + protected NBTTagList a(double... adouble) { NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; @@ -941,13 +959,13 @@ public abstract class Entity { return entityitem; } - public boolean N() { + public boolean P() { return !this.dead; } - public boolean E() { + public boolean H() { int i = MathHelper.floor(this.locX); - int j = MathHelper.floor(this.locY + (double) this.q()); + int j = MathHelper.floor(this.locY + (double) this.s()); int k = MathHelper.floor(this.locZ); return this.world.d(i, j, k); @@ -961,15 +979,15 @@ public abstract class Entity { return null; } - public void o_() { + public void B() { if (this.vehicle.dead) { this.vehicle = null; } else { this.motX = 0.0D; this.motY = 0.0D; this.motZ = 0.0D; - this.f_(); - this.vehicle.h_(); + this.p_(); + this.vehicle.f(); this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw); for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) { @@ -1015,15 +1033,15 @@ public abstract class Entity { } } - public void h_() { - this.passenger.setPosition(this.locX, this.locY + this.k() + this.passenger.C(), this.locZ); + public void f() { + this.passenger.setPosition(this.locX, this.locY + this.m() + this.passenger.F(), this.locZ); } - public double C() { + public double F() { return (double) this.height; } - public double k() { + public double m() { return (double) this.width * 0.75D; } @@ -1093,11 +1111,11 @@ public abstract class Entity { } } - public Vec3D S() { + public Vec3D V() { return null; } - public void Y() {} + public void ad() {} public ItemStack[] getEquipment() { return null; @@ -1124,4 +1142,14 @@ public abstract class Entity { this.datawatcher.b(0, Byte.valueOf((byte) (b0 & ~(1 << i)))); } } + + public void a(EntityWeatherStorm entityweatherstorm) { + this.a(5); + ++this.fireTicks; + if (this.fireTicks == 0) { + this.fireTicks = 300; + } + } + + public void a(EntityLiving entityliving) {} } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 140ae882..f123c12d 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -37,7 +37,7 @@ public class EntityArrow extends Entity { super(world); this.shooter = entityliving; this.b(0.5F, 0.5F); - this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.s(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -49,7 +49,7 @@ public class EntityArrow extends Entity { this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); } - protected void a() {} + protected void b() {} public void a(double d0, double d1, double d2, float f, float f1) { float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); @@ -73,8 +73,8 @@ public class EntityArrow extends Entity { this.h = 0; } - public void f_() { - super.f_(); + public void p_() { + super.p_(); if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) { float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); @@ -127,7 +127,7 @@ public class EntityArrow extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) { + if (entity1.o_() && (entity1 != this.shooter || this.i >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -234,7 +234,7 @@ public class EntityArrow extends Entity { float f3 = 0.99F; f1 = 0.03F; - if (this.g_()) { + if (this.Z()) { for (int k = 0; k < 4; ++k) { float f4 = 0.25F; @@ -251,7 +251,7 @@ public class EntityArrow extends Entity { this.setPosition(this.locX, this.locY, this.locZ); } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.c); nbttagcompound.a("yTile", (short) this.d); nbttagcompound.a("zTile", (short) this.e); @@ -260,7 +260,7 @@ public class EntityArrow extends Entity { nbttagcompound.a("inGround", (byte) (this.g ? 1 : 0)); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.c = nbttagcompound.d("xTile"); this.d = nbttagcompound.d("yTile"); this.e = nbttagcompound.d("zTile"); diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 365c0a80..26b16fa8 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -53,26 +53,26 @@ public class EntityBoat extends Entity { this.damage = 0; this.b = 0; this.c = 1; - this.aD = true; + this.aE = true; this.b(1.5F, 0.6F); this.height = this.width / 2.0F; } - protected boolean l() { + protected boolean n() { return false; } - protected void a() {} + protected void b() {} public AxisAlignedBB a_(Entity entity) { return entity.boundingBox; } - public AxisAlignedBB d() { + public AxisAlignedBB e_() { return this.boundingBox; } - public boolean e_() { + public boolean d_() { return true; } @@ -94,7 +94,7 @@ public class EntityBoat extends Entity { // CraftBukkit end } - public double k() { + public double m() { return (double) this.width * 0.0D - 0.30000001192092896D; } @@ -116,7 +116,7 @@ public class EntityBoat extends Entity { this.c = -this.c; this.b = 10; this.damage += i * 10; - this.W(); + this.ab(); if (this.damage > 40) { // CraftBukkit start @@ -148,11 +148,11 @@ public class EntityBoat extends Entity { } } - public boolean d_() { + public boolean o_() { return !this.dead; } - public void f_() { + public void p_() { // CraftBukkit start double prevX = this.locX; double prevY = this.locY; @@ -161,7 +161,7 @@ public class EntityBoat extends Entity { float prevPitch = this.pitch; // CraftBukkit end - super.f_(); + super.p_(); if (this.b > 0) { --this.b; } @@ -354,7 +354,7 @@ public class EntityBoat extends Entity { for (int l = 0; l < list.size(); ++l) { Entity entity = (Entity) list.get(l); - if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) { + if (entity != this.passenger && entity.d_() && entity instanceof EntityBoat) { entity.collide(this); } } @@ -366,19 +366,19 @@ public class EntityBoat extends Entity { } } - public void h_() { + public void f() { if (this.passenger != null) { double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; - this.passenger.setPosition(this.locX + d0, this.locY + this.k() + this.passenger.C(), this.locZ + d1); + this.passenger.setPosition(this.locX + d0, this.locY + this.m() + this.passenger.F(), this.locZ + d1); } } - protected void a(NBTTagCompound nbttagcompound) {} - protected void b(NBTTagCompound nbttagcompound) {} + protected void a(NBTTagCompound nbttagcompound) {} + public boolean a(EntityHuman entityhuman) { if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) { return true; diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java index e14d4ea6..d1cd432a 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -15,31 +15,31 @@ public class EntityCow extends EntityAnimal { this.b(0.9F, 1.3F); } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); } - protected String e() { + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + protected String g() { return "mob.cow"; } - protected String f() { + protected String h() { return "mob.cowhurt"; } - protected String g() { + protected String i() { return "mob.cowhurt"; } - protected float i() { + protected float k() { return 0.4F; } - protected int h() { + protected int j() { return Item.LEATHER.id; } diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index 8b73c92d..25cb344b 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -18,12 +18,12 @@ public class EntityCreature extends EntityLiving { super(world); } - protected boolean u() { + protected boolean w() { return false; } protected void c_() { - this.e = this.u(); + this.e = this.w(); float f = 16.0F; if (this.target == null) { @@ -46,7 +46,7 @@ public class EntityCreature extends EntityLiving { if (this.target != null) { this.pathEntity = this.world.findPath(this, this.target, f); } - } else if (!this.target.N()) { + } else if (!this.target.P()) { // CraftBukkit start EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED); CraftServer server = ((WorldServer) this.world).getServer(); @@ -97,9 +97,9 @@ public class EntityCreature extends EntityLiving { } } - int l1 = MathHelper.floor(this.boundingBox.b); - boolean flag1 = this.g_(); - boolean flag2 = this.V(); + int l1 = MathHelper.floor(this.boundingBox.b + 0.5D); + boolean flag1 = this.Z(); + boolean flag2 = this.aa(); this.pitch = 0.0F; if (this.pathEntity != null && this.random.nextInt(100) != 0) { @@ -116,7 +116,7 @@ public class EntityCreature extends EntityLiving { } } - this.ax = false; + this.ay = false; if (vec3d != null) { double d1 = vec3d.a - this.locX; double d2 = vec3d.c - this.locZ; @@ -125,7 +125,7 @@ public class EntityCreature extends EntityLiving { float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; float f5 = f4 - this.yaw; - for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) { + for (this.aw = this.aA; f5 < -180.0F; f5 += 360.0F) { ; } @@ -149,12 +149,12 @@ public class EntityCreature extends EntityLiving { this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F; - this.au = -MathHelper.sin(f5) * this.av * 1.0F; - this.av = MathHelper.cos(f5) * this.av * 1.0F; + this.av = -MathHelper.sin(f5) * this.aw * 1.0F; + this.aw = MathHelper.cos(f5) * this.aw * 1.0F; } if (d3 > 0.0D) { - this.ax = true; + this.ay = true; } } @@ -162,12 +162,12 @@ public class EntityCreature extends EntityLiving { this.a(this.target, 30.0F, 30.0F); } - if (this.positionChanged) { - this.ax = true; + if (this.positionChanged && !this.C()) { + this.ay = true; } if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) { - this.ax = true; + this.ay = true; } } else { super.c_(); @@ -185,15 +185,15 @@ public class EntityCreature extends EntityLiving { return null; } - public boolean b() { + public boolean d() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); - return super.b() && this.a(i, j, k) >= 0.0F; + return super.d() && this.a(i, j, k) >= 0.0F; } - public boolean z() { + public boolean C() { return this.pathEntity != null; } @@ -201,7 +201,7 @@ public class EntityCreature extends EntityLiving { this.pathEntity = pathentity; } - public Entity A() { + public Entity D() { return this.target; } diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index cc6a97a6..e7c2bfe2 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -16,23 +16,28 @@ public class EntityCreeper extends EntityMonster { this.texture = "/mob/creeper.png"; } - protected void a() { - super.a(); + protected void b() { + super.b(); this.datawatcher.a(16, Byte.valueOf((byte) -1)); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); + this.datawatcher.a(17, Byte.valueOf((byte) 0)); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); + if (this.datawatcher.a(17) == 1) { + nbttagcompound.a("powered", true); + } } - public void f_() { + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + this.datawatcher.b(17, Byte.valueOf((byte) (nbttagcompound.m("powered") ? 1 : 0))); + } + + public void p_() { this.b = this.fuseTicks; if (this.world.isStatic) { - int i = this.v(); + int i = this.x(); if (i > 0 && this.fuseTicks == 0) { this.world.makeSound(this, "random.fuse", 1.0F, 0.5F); @@ -48,14 +53,14 @@ public class EntityCreeper extends EntityMonster { } } - super.f_(); + super.p_(); } - protected String f() { + protected String h() { return "mob.creeper"; } - protected String g() { + protected String i() { return "mob.creeperdeath"; } @@ -67,7 +72,7 @@ public class EntityCreeper extends EntityMonster { } protected void a(Entity entity, float f) { - int i = this.v(); + int i = this.x(); if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { this.e(-1); @@ -102,15 +107,24 @@ public class EntityCreeper extends EntityMonster { } } - protected int h() { + public boolean t() { + return this.datawatcher.a(17) == 1; + } + + protected int j() { return Item.SULPHUR.id; } - private int v() { + private int x() { return this.datawatcher.a(16); } private void e(int i) { this.datawatcher.b(16, Byte.valueOf((byte) i)); } + + public void a(EntityWeatherStorm entityweatherstorm) { + super.a(entityweatherstorm); + this.datawatcher.b(17, Byte.valueOf((byte) 1)); + } } diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 32efe891..3fdc78d2 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -30,13 +30,13 @@ public class EntityEgg extends Entity { this.b(0.25F, 0.25F); } - protected void a() {} + protected void b() {} public EntityEgg(World world, EntityLiving entityliving) { super(world); this.thrower = entityliving; this.b(0.25F, 0.25F); - this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.s(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -80,11 +80,11 @@ public class EntityEgg extends Entity { this.h = 0; } - public void f_() { - this.bi = this.locX; - this.bj = this.locY; - this.bk = this.locZ; - super.f_(); + public void p_() { + this.bk = this.locX; + this.bl = this.locY; + this.bm = this.locZ; + super.p_(); if (this.a > 0) { --this.a; } @@ -129,7 +129,7 @@ public class EntityEgg extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.thrower || this.i >= 5)) { + if (entity1.o_() && (entity1 != this.thrower || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -301,7 +301,7 @@ public class EntityEgg extends Entity { float f2 = 0.99F; float f3 = 0.03F; - if (this.g_()) { + if (this.Z()) { for (int i1 = 0; i1 < 4; ++i1) { float f4 = 0.25F; @@ -318,7 +318,7 @@ public class EntityEgg extends Entity { this.setPosition(this.locX, this.locY, this.locZ); } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.b); nbttagcompound.a("yTile", (short) this.c); nbttagcompound.a("zTile", (short) this.d); @@ -327,7 +327,7 @@ public class EntityEgg extends Entity { nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0)); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.b = nbttagcompound.d("xTile"); this.c = nbttagcompound.d("yTile"); this.d = nbttagcompound.d("zTile"); diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index cee2b283..108a177c 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -31,7 +31,7 @@ public class EntityFireball extends Entity { this.b(1.0F, 1.0F); } - protected void a() {} + protected void b() {} public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { super(world); @@ -51,8 +51,8 @@ public class EntityFireball extends Entity { this.d = d2 / d3 * 0.1D; } - public void f_() { - super.f_(); + public void p_() { + super.p_(); this.fireTicks = 10; if (this.a > 0) { --this.a; @@ -97,7 +97,7 @@ public class EntityFireball extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.shooter || this.l >= 25)) { + if (entity1.o_() && (entity1 != this.shooter || this.l >= 25)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -187,7 +187,7 @@ public class EntityFireball extends Entity { this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; float f2 = 0.95F; - if (this.g_()) { + if (this.Z()) { for (int k = 0; k < 4; ++k) { float f3 = 0.25F; @@ -207,7 +207,7 @@ public class EntityFireball extends Entity { this.setPosition(this.locX, this.locY, this.locZ); } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.e); nbttagcompound.a("yTile", (short) this.f); nbttagcompound.a("zTile", (short) this.g); @@ -216,7 +216,7 @@ public class EntityFireball extends Entity { nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0)); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.e = nbttagcompound.d("xTile"); this.f = nbttagcompound.d("yTile"); this.g = nbttagcompound.d("zTile"); @@ -225,14 +225,14 @@ public class EntityFireball extends Entity { this.i = nbttagcompound.c("inGround") == 1; } - public boolean d_() { + public boolean o_() { return true; } public boolean damageEntity(Entity entity, int i) { - this.W(); + this.ab(); if (entity != null) { - Vec3D vec3d = entity.S(); + Vec3D vec3d = entity.V(); if (vec3d != null) { this.motX = vec3d.a; diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index 486a862a..76ac38bf 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -34,7 +34,7 @@ public class EntityFish extends Entity { this.b(0.25F, 0.25F); } - protected void a() {} + protected void b() {} public EntityFish(World world, EntityHuman entityhuman) { super(world); @@ -77,8 +77,8 @@ public class EntityFish extends Entity { this.i = 0; } - public void f_() { - super.f_(); + public void p_() { + super.p_(); if (this.l > 0) { double d0 = this.locX + (this.m - this.locX) / (double) this.l; double d1 = this.locY + (this.n - this.locY) / (double) this.l; @@ -101,9 +101,9 @@ public class EntityFish extends Entity { this.c(this.yaw, this.pitch); } else { if (!this.world.isStatic) { - ItemStack itemstack = this.owner.A(); + ItemStack itemstack = this.owner.D(); - if (this.owner.dead || !this.owner.N() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.g(this.owner) > 1024.0D) { + if (this.owner.dead || !this.owner.P() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.g(this.owner) > 1024.0D) { this.die(); this.owner.hookedFish = null; return; @@ -166,7 +166,7 @@ public class EntityFish extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.owner || this.j >= 5)) { + if (entity1.o_() && (entity1 != this.owner || this.j >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -267,26 +267,34 @@ public class EntityFish extends Entity { if (d6 > 0.0D) { if (this.k > 0) { --this.k; - } else if (this.random.nextInt(500) == 0) { - this.k = this.random.nextInt(30) + 10; - this.motY -= 0.20000000298023224D; - this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); - float f3 = (float) MathHelper.floor(this.boundingBox.b); - - int l; - float f4; - float f5; - - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - this.world.a("bubble", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); + } else { + short short1 = 500; + + if (this.world.q(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) { + short1 = 300; } - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - this.world.a("splash", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY, this.motZ); + if (this.random.nextInt(short1) == 0) { + this.k = this.random.nextInt(30) + 10; + this.motY -= 0.20000000298023224D; + this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + float f3 = (float) MathHelper.floor(this.boundingBox.b); + + float f4; + int l; + float f5; + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); + } + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ); + } } } } @@ -310,7 +318,7 @@ public class EntityFish extends Entity { } } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.d); nbttagcompound.a("yTile", (short) this.e); nbttagcompound.a("zTile", (short) this.f); @@ -319,7 +327,7 @@ public class EntityFish extends Entity { nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.d = nbttagcompound.d("xTile"); this.e = nbttagcompound.d("yTile"); this.f = nbttagcompound.d("zTile"); @@ -354,7 +362,7 @@ public class EntityFish extends Entity { entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D; entityitem.motZ = d7 * d9; this.world.addEntity(entityitem); - this.owner.a(StatisticList.x, 1); + this.owner.a(StatisticList.B, 1); b0 = 1; } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index a33b0fe6..0ac7ff0b 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -39,10 +39,11 @@ public abstract class EntityHuman extends EntityLiving { public boolean sleeping; public boolean fauxSleeping; // CraftBukkit end - private ChunkCoordinates b; + private ChunkCoordinates a; public int sleepTicks; // CraftBukkit (public) - public float z; public float A; + public float B; + private ChunkCoordinates c; private ChunkCoordinates d; private int e = 0; public EntityFish hookedFish = null; @@ -56,25 +57,25 @@ public abstract class EntityHuman extends EntityLiving { this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F); this.health = 20; - this.P = "humanoid"; - this.O = 180.0F; + this.Q = "humanoid"; + this.P = 180.0F; this.maxFireTicks = 20; this.texture = "/mob/char.png"; } - protected void a() { - super.a(); + protected void b() { + super.b(); this.datawatcher.a(16, Byte.valueOf((byte) 0)); } - public void f_() { + public void p_() { if (this.isSleeping()) { ++this.sleepTicks; if (this.sleepTicks > 100) { this.sleepTicks = 100; } - if (!this.m()) { + if (!this.o()) { this.a(true, true, false); } else if (!this.world.isStatic && this.world.d()) { this.a(false, true, true); @@ -86,9 +87,9 @@ public abstract class EntityHuman extends EntityLiving { } } - super.f_(); + super.p_(); if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) { - this.u(); + this.x(); this.activeContainer = this.defaultContainer; } @@ -127,21 +128,29 @@ public abstract class EntityHuman extends EntityLiving { this.w += d0 * 0.25D; this.y += d2 * 0.25D; this.x += d1 * 0.25D; - this.a(StatisticList.j, 1); + this.a(StatisticList.k, 1); + if (this.vehicle == null) { + this.d = null; + } } - protected boolean p_() { + protected boolean A() { return this.health <= 0 || this.isSleeping(); } - protected void u() { + protected void x() { this.activeContainer = this.defaultContainer; } - public void o_() { - super.o_(); + public void B() { + double d0 = this.locX; + double d1 = this.locY; + double d2 = this.locZ; + + super.B(); this.n = this.o; this.o = 0.0F; + this.h(this.locX - d0, this.locY - d1, this.locZ - d2); } protected void c_() { @@ -155,17 +164,17 @@ public abstract class EntityHuman extends EntityLiving { this.q = 0; } - this.V = (float) this.q / 8.0F; + this.W = (float) this.q / 8.0F; } - public void r() { + public void u() { if (this.world.spawnMonsters == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { this.b(1); } this.inventory.f(); this.n = this.o; - super.r(); + super.u(); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); // CraftBukkit -- Math -> TrigMath float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; @@ -183,7 +192,7 @@ public abstract class EntityHuman extends EntityLiving { } this.o += (f - this.o) * 0.4F; - this.ae += (f1 - this.ae) * 0.8F; + this.af += (f1 - this.af) * 0.8F; if (this.health > 0) { List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D)); @@ -214,26 +223,26 @@ public abstract class EntityHuman extends EntityLiving { this.inventory.h(); if (entity != null) { - this.motX = (double) (-MathHelper.cos((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F); - this.motZ = (double) (-MathHelper.sin((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F); + this.motX = (double) (-MathHelper.cos((this.ab + this.yaw) * 3.1415927F / 180.0F) * 0.1F); + this.motZ = (double) (-MathHelper.sin((this.ab + this.yaw) * 3.1415927F / 180.0F) * 0.1F); } else { this.motX = this.motZ = 0.0D; } this.height = 0.1F; - this.a(StatisticList.u, 1); + this.a(StatisticList.y, 1); } public void c(Entity entity, int i) { this.m += i; if (entity instanceof EntityHuman) { - this.a(StatisticList.w, 1); + this.a(StatisticList.A, 1); } else { - this.a(StatisticList.v, 1); + this.a(StatisticList.z, 1); } } - public void z() { + public void C() { this.a(this.inventory.a(this.inventory.itemInHandIndex, 1), false); } @@ -243,7 +252,7 @@ public abstract class EntityHuman extends EntityLiving { public void a(ItemStack itemstack, boolean flag) { if (itemstack != null) { - EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.q(), this.locZ, itemstack); + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.s(), this.locZ, itemstack); entityitem.pickupDelay = 40; float f = 0.1F; @@ -287,7 +296,7 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end this.a(entityitem); - this.a(StatisticList.r, 1); + this.a(StatisticList.v, 1); } } @@ -313,8 +322,8 @@ public abstract class EntityHuman extends EntityLiving { return this.inventory.b(block); } - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.l("Inventory"); this.inventory.b(nbttaglist); @@ -322,25 +331,25 @@ public abstract class EntityHuman extends EntityLiving { this.sleeping = nbttagcompound.m("Sleeping"); this.sleepTicks = nbttagcompound.d("SleepTimer"); if (this.sleeping) { - this.b = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + this.a = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); this.a(true, true, false); } if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) { - this.d = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("SpawnZ")); + this.c = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("SpawnZ")); } } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList())); nbttagcompound.a("Dimension", this.dimension); nbttagcompound.a("Sleeping", this.sleeping); nbttagcompound.a("SleepTimer", (short) this.sleepTicks); - if (this.d != null) { - nbttagcompound.a("SpawnX", this.d.x); - nbttagcompound.a("SpawnY", this.d.y); - nbttagcompound.a("SpawnZ", this.d.z); + if (this.c != null) { + nbttagcompound.a("SpawnX", this.c.x); + nbttagcompound.a("SpawnY", this.c.y); + nbttagcompound.a("SpawnZ", this.c.z); } } @@ -350,16 +359,16 @@ public abstract class EntityHuman extends EntityLiving { public void receive(Entity entity, int i) {} - public float q() { + public float s() { return 0.12F; } - protected void l_() { + protected void j_() { this.height = 1.62F; } public boolean damageEntity(Entity entity, int i) { - this.at = 0; + this.au = 0; if (this.health <= 0) { return false; } else { @@ -410,32 +419,38 @@ public abstract class EntityHuman extends EntityLiving { this.a((EntityLiving) object, false); } - this.a(StatisticList.t, i); + this.a(StatisticList.x, i); return super.damageEntity(entity, i); } } } + protected boolean t() { + return false; + } + protected void a(EntityLiving entityliving, boolean flag) { if (!(entityliving instanceof EntityCreeper) && !(entityliving instanceof EntityGhast)) { if (entityliving instanceof EntityWolf) { EntityWolf entitywolf = (EntityWolf) entityliving; - if (entitywolf.y() && this.name.equals(entitywolf.v())) { + if (entitywolf.m_() && this.name.equals(entitywolf.x())) { return; } } - List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D)); - Iterator iterator = list.iterator(); + if (!(entityliving instanceof EntityHuman) || this.t()) { + List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D)); + Iterator iterator = list.iterator(); - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); - EntityWolf entitywolf1 = (EntityWolf) entity; + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + EntityWolf entitywolf1 = (EntityWolf) entity; - if (entitywolf1.y() && entitywolf1.A() == null && this.name.equals(entitywolf1.v()) && (!flag || !entitywolf1.w())) { - entitywolf1.b(false); - entitywolf1.c(entityliving); + if (entitywolf1.m_() && entitywolf1.D() == null && this.name.equals(entitywolf1.x()) && (!flag || !entitywolf1.isSitting())) { + entitywolf1.setSitting(false); + entitywolf1.c(entityliving); + } } } } @@ -459,31 +474,31 @@ public abstract class EntityHuman extends EntityLiving { public void c(Entity entity) { if (!entity.a(this)) { - ItemStack itemstack = this.A(); + ItemStack itemstack = this.D(); if (itemstack != null && entity instanceof EntityLiving) { itemstack.a((EntityLiving) entity); if (itemstack.count <= 0) { itemstack.a(this); - this.B(); + this.E(); } } } } - public ItemStack A() { + public ItemStack D() { return this.inventory.getItemInHand(); } - public void B() { + public void E() { this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); } - public double C() { + public double F() { return (double) (this.height - 0.5F); } - public void m_() { + public void k_() { this.q = -1; this.p = true; } @@ -492,6 +507,10 @@ public abstract class EntityHuman extends EntityLiving { int i = this.inventory.a(entity); if (i > 0) { + if (this.motY < 0.0D) { + ++i; + } + // CraftBukkit start if (entity instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); @@ -511,22 +530,22 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end entity.damageEntity(this, i); - ItemStack itemstack = this.A(); + ItemStack itemstack = this.D(); if (itemstack != null && entity instanceof EntityLiving) { itemstack.a((EntityLiving) entity, this); if (itemstack.count <= 0) { itemstack.a(this); - this.B(); + this.E(); } } if (entity instanceof EntityLiving) { - if (entity.N()) { + if (entity.P()) { this.a((EntityLiving) entity, true); } - this.a(StatisticList.s, i); + this.a(StatisticList.w, i); } } } @@ -541,12 +560,12 @@ public abstract class EntityHuman extends EntityLiving { } } - public boolean E() { - return !this.sleeping && super.E(); + public boolean H() { + return !this.sleeping && super.H(); } public EnumBedError a(int i, int j, int k) { - if (!this.isSleeping() && this.N()) { + if (!this.isSleeping() && this.P()) { if (this.world.worldProvider.c) { return EnumBedError.NOT_POSSIBLE_HERE; } else if (this.world.d()) { @@ -599,7 +618,7 @@ public abstract class EntityHuman extends EntityLiving { this.sleeping = true; this.sleepTicks = 0; - this.b = new ChunkCoordinates(i, j, k); + this.a = new ChunkCoordinates(i, j, k); this.motX = this.motZ = this.motY = 0.0D; if (!this.world.isStatic) { this.world.everyoneSleeping(); @@ -615,31 +634,31 @@ public abstract class EntityHuman extends EntityLiving { } private void e(int i) { - this.z = 0.0F; this.A = 0.0F; + this.B = 0.0F; switch (i) { case 0: - this.A = -1.8F; + this.B = -1.8F; break; case 1: - this.z = 1.8F; + this.A = 1.8F; break; case 2: - this.A = 1.8F; + this.B = 1.8F; break; case 3: - this.z = -1.8F; + this.A = -1.8F; } } public void a(boolean flag, boolean flag1, boolean flag2) { this.b(0.6F, 1.8F); - this.l_(); - ChunkCoordinates chunkcoordinates = this.b; - ChunkCoordinates chunkcoordinates1 = this.b; + this.j_(); + ChunkCoordinates chunkcoordinates = this.a; + ChunkCoordinates chunkcoordinates1 = this.a; if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false); @@ -678,16 +697,16 @@ public abstract class EntityHuman extends EntityLiving { } if (flag2) { - this.a(this.b); + this.a(this.a); } } - private boolean m() { - return this.world.getTypeId(this.b.x, this.b.y, this.b.z) == Block.BED.id; + private boolean o() { + return this.world.getTypeId(this.a.x, this.a.y, this.a.z) == Block.BED.id; } public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates) { - IChunkProvider ichunkprovider = world.n(); + IChunkProvider ichunkprovider = world.o(); ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4); ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4); @@ -712,23 +731,27 @@ public abstract class EntityHuman extends EntityLiving { public void a(String s) {} - public ChunkCoordinates H() { - return this.d; + public ChunkCoordinates K() { + return this.c; } public void a(ChunkCoordinates chunkcoordinates) { if (chunkcoordinates != null) { - this.d = new ChunkCoordinates(chunkcoordinates); + this.c = new ChunkCoordinates(chunkcoordinates); } else { - this.d = null; + this.c = null; } } + public void a(Statistic statistic) { + this.a(statistic, 1); + } + public void a(Statistic statistic, int i) {} - protected void I() { - super.I(); - this.a(StatisticList.q, 1); + protected void L() { + super.L(); + this.a(StatisticList.u, 1); } public void a(float f, float f1) { @@ -741,42 +764,69 @@ public abstract class EntityHuman extends EntityLiving { } private void g(double d0, double d1, double d2) { - int i; + if (this.vehicle == null) { + int i; - if (this.a(Material.WATER)) { - i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); - if (i > 0) { - this.a(StatisticList.p, i); - } - } else if (this.g_()) { - i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); - if (i > 0) { - this.a(StatisticList.l, i); - } - } else if (this.n()) { - if (d1 > 0.0D) { - this.a(StatisticList.n, (int) Math.round(d1 * 100.0D)); + if (this.a(Material.WATER)) { + i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.q, i); + } + } else if (this.Z()) { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.m, i); + } + } else if (this.p()) { + if (d1 > 0.0D) { + this.a(StatisticList.o, (int) Math.round(d1 * 100.0D)); + } + } else if (this.onGround) { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.l, i); + } + } else { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 25) { + this.a(StatisticList.p, i); + } } - } else if (this.onGround) { - i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + } + } + + private void h(double d0, double d1, double d2) { + if (this.vehicle != null) { + int i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + if (i > 0) { - this.a(StatisticList.k, i); - } - } else { - i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); - if (i > 25) { - this.a(StatisticList.o, i); + if (this.vehicle instanceof EntityMinecart) { + this.a(StatisticList.r, i); + if (this.d == null) { + this.d = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + } else if (this.d.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000.0D) { + this.a(AchievementList.q, 1); + } + } else if (this.vehicle instanceof EntityBoat) { + this.a(StatisticList.s, i); + } else if (this.vehicle instanceof EntityPig) { + this.a(StatisticList.t, i); + } } } } protected void a(float f) { if (f >= 2.0F) { - this.a(StatisticList.m, (int) Math.round((double) f * 100.0D)); + this.a(StatisticList.n, (int) Math.round((double) f * 100.0D)); } super.a(f); } - public void J() {} + public void a(EntityLiving entityliving) { + if (entityliving instanceof EntityMonster) { + this.a((Statistic) AchievementList.s); + } + } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index 3540abd4..e61127df 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -1,7 +1,6 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end @@ -27,7 +26,7 @@ public class EntityItem extends Entity { this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); } - protected boolean l() { + protected boolean n() { return false; } @@ -37,10 +36,10 @@ public class EntityItem extends Entity { this.height = this.width / 2.0F; } - protected void a() {} + protected void b() {} - public void f_() { - super.f_(); + public void p_() { + super.p_(); if (this.pickupDelay > 0) { --this.pickupDelay; } @@ -83,7 +82,7 @@ public class EntityItem extends Entity { } } - public boolean g_() { + public boolean f_() { return this.world.a(this.boundingBox, Material.WATER, this); } @@ -170,7 +169,7 @@ public class EntityItem extends Entity { } public boolean damageEntity(Entity entity, int i) { - this.W(); + this.ab(); this.f -= i; if (this.f <= 0) { this.die(); @@ -179,13 +178,13 @@ public class EntityItem extends Entity { return false; } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("Health", (short) ((byte) this.f)); nbttagcompound.a("Age", (short) this.b); nbttagcompound.a("Item", this.itemStack.a(new NBTTagCompound())); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.f = nbttagcompound.d("Health") & 255; this.b = nbttagcompound.d("Age"); NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item"); @@ -200,13 +199,22 @@ public class EntityItem extends Entity { // CraftBukkit start if (this.pickupDelay == 0) { Player player = (Player) entityhuman.getBukkitEntity(); - PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (Item) this.getBukkitEntity()); + PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity()); ((WorldServer) world).getServer().getPluginManager().callEvent(event); if (event.isCancelled() || !entityhuman.inventory.canHold(this.itemStack)) { return; } // CraftBukkit end + + if (this.itemStack.id == Block.LOG.id) { + entityhuman.a((Statistic) AchievementList.g); + } + + if (this.itemStack.id == Item.LEATHER.id) { + entityhuman.a((Statistic) AchievementList.t); + } + this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityhuman.receive(this, i); this.die(); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 730602fc..c4e1c2e1 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -18,108 +18,108 @@ import org.bukkit.event.entity.EntityDeathEvent; public abstract class EntityLiving extends Entity { public int maxNoDamageTicks = 20; - public float D; public float E; - public float F = 0.0F; + public float F; public float G = 0.0F; - protected float H; + public float H = 0.0F; protected float I; protected float J; protected float K; - protected boolean L = true; + protected float L; + protected boolean M = true; protected String texture = "/mob/char.png"; - protected boolean N = true; - protected float O = 0.0F; - protected String P = null; - protected float Q = 1.0F; - protected int R = 0; - protected float S = 0.0F; - public boolean T = false; - public float U; + protected boolean O = true; + protected float P = 0.0F; + protected String Q = null; + protected float R = 1.0F; + protected int S = 0; + protected float T = 0.0F; + public boolean U = false; public float V; + public float W; public int health = 10; - public int X; + public int Y; private int a; public int hurtTicks; - public int Z; - public float aa = 0.0F; + public int aa; + public float ab = 0.0F; public int deathTicks = 0; public int attackTicks = 0; - public float ad; public float ae; - protected boolean af = false; - public int ag = -1; - public float ah = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D); - public float ai; + public float af; + protected boolean ag = false; + public int ah = -1; + public float ai = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D); public float aj; public float ak; - protected int al; - protected double am; + public float al; + protected int am; protected double an; protected double ao; protected double ap; protected double aq; - float ar = 0.0F; + protected double ar; + float as = 0.0F; public int lastDamage = 0; // CraftBukkit protected -> public - protected int at = 0; - protected float au; + protected int au = 0; protected float av; protected float aw; - protected boolean ax = false; - protected float ay = 0.0F; - protected float az = 0.7F; + protected float ax; + protected boolean ay = false; + protected float az = 0.0F; + protected float aA = 0.7F; private Entity b; - protected int aA = 0; + protected int aB = 0; public EntityLiving(World world) { super(world); - this.aD = true; - this.E = (float) (Math.random() + 1.0D) * 0.01F; + this.aE = true; + this.F = (float) (Math.random() + 1.0D) * 0.01F; this.setPosition(this.locX, this.locY, this.locZ); - this.D = (float) Math.random() * 12398.0F; + this.E = (float) Math.random() * 12398.0F; this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D); - this.bm = 0.5F; + this.bo = 0.5F; } - protected void a() {} + protected void b() {} public boolean e(Entity entity) { - return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.q(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.q(), entity.locZ)) == null; + return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.s(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.s(), entity.locZ)) == null; } - public boolean d_() { + public boolean o_() { return !this.dead; } - public boolean e_() { + public boolean d_() { return !this.dead; } - public float q() { + public float s() { return this.width * 0.85F; } - public int c() { + public int e() { return 80; } - public void K() { - String s = this.e(); + public void M() { + String s = this.g(); if (s != null) { - this.world.makeSound(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.world.makeSound(this, s, this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } } - public void L() { - this.U = this.V; - super.L(); + public void N() { + this.V = this.W; + super.N(); if (this.random.nextInt(1000) < this.a++) { - this.a = -this.c(); - this.K(); + this.a = -this.e(); + this.M(); } - if (this.N() && this.E()) { + if (this.P() && this.H()) { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity victim = this.getBukkitEntity(); @@ -135,13 +135,13 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - if (this.by || this.world.isStatic) { + if (this.bz || this.world.isStatic) { this.fireTicks = 0; } int i; - if (this.N() && this.a(Material.WATER) && !this.b_()) { + if (this.P() && this.a(Material.WATER) && !this.b_()) { --this.airTicks; if (this.airTicks == -20) { this.airTicks = 0; @@ -174,7 +174,7 @@ public abstract class EntityLiving extends Entity { this.airTicks = this.maxAirTicks; } - this.ad = this.ae; + this.ae = this.af; if (this.attackTicks > 0) { --this.attackTicks; } @@ -190,7 +190,7 @@ public abstract class EntityLiving extends Entity { if (this.health <= 0) { ++this.deathTicks; if (this.deathTicks > 20) { - this.Q(); + this.T(); this.die(); for (i = 0; i < 20; ++i) { @@ -203,13 +203,13 @@ public abstract class EntityLiving extends Entity { } } - this.K = this.J; - this.G = this.F; + this.L = this.K; + this.H = this.G; this.lastYaw = this.yaw; this.lastPitch = this.pitch; } - public void M() { + public void O() { for (int i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; @@ -220,22 +220,22 @@ public abstract class EntityLiving extends Entity { } } - public void o_() { - super.o_(); - this.H = this.I; - this.I = 0.0F; + public void B() { + super.B(); + this.I = this.J; + this.J = 0.0F; } - public void f_() { - super.f_(); - this.r(); + public void p_() { + super.p_(); + this.u(); double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = MathHelper.a(d0 * d0 + d1 * d1); - float f1 = this.F; + float f1 = this.G; float f2 = 0.0F; - this.H = this.I; + this.I = this.J; float f3 = 0.0F; if (f > 0.05F) { @@ -245,7 +245,7 @@ public abstract class EntityLiving extends Entity { f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; } - if (this.V > 0.0F) { + if (this.W > 0.0F) { f1 = this.yaw; } @@ -253,11 +253,11 @@ public abstract class EntityLiving extends Entity { f3 = 0.0F; } - this.I += (f3 - this.I) * 0.3F; + this.J += (f3 - this.J) * 0.3F; float f4; - for (f4 = f1 - this.F; f4 < -180.0F; f4 += 360.0F) { + for (f4 = f1 - this.G; f4 < -180.0F; f4 += 360.0F) { ; } @@ -265,11 +265,11 @@ public abstract class EntityLiving extends Entity { f4 -= 360.0F; } - this.F += f4 * 0.3F; + this.G += f4 * 0.3F; float f5; - for (f5 = this.yaw - this.F; f5 < -180.0F; f5 += 360.0F) { + for (f5 = this.yaw - this.G; f5 < -180.0F; f5 += 360.0F) { ; } @@ -287,9 +287,9 @@ public abstract class EntityLiving extends Entity { f5 = 75.0F; } - this.F = this.yaw - f5; + this.G = this.yaw - f5; if (f5 * f5 > 2500.0F) { - this.F += f5 * 0.2F; + this.G += f5 * 0.2F; } if (flag) { @@ -304,12 +304,12 @@ public abstract class EntityLiving extends Entity { this.lastYaw += 360.0F; } - while (this.F - this.G < -180.0F) { - this.G -= 360.0F; + while (this.G - this.H < -180.0F) { + this.H -= 360.0F; } - while (this.F - this.G >= 180.0F) { - this.G += 360.0F; + while (this.G - this.H >= 180.0F) { + this.H += 360.0F; } while (this.pitch - this.lastPitch < -180.0F) { @@ -320,7 +320,7 @@ public abstract class EntityLiving extends Entity { this.lastPitch += 360.0F; } - this.J += f2; + this.K += f2; } protected void b(float f, float f1) { @@ -342,11 +342,11 @@ public abstract class EntityLiving extends Entity { if (this.world.isStatic) { return false; } else { - this.at = 0; + this.au = 0; if (this.health <= 0) { return false; } else { - this.aj = 1.5F; + this.ak = 1.5F; boolean flag = true; if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { @@ -359,16 +359,16 @@ public abstract class EntityLiving extends Entity { flag = false; } else { this.lastDamage = i; - this.X = this.health; + this.Y = this.health; this.noDamageTicks = this.maxNoDamageTicks; this.c(i); - this.hurtTicks = this.Z = 10; + this.hurtTicks = this.aa = 10; } - this.aa = 0.0F; + this.ab = 0.0F; if (flag) { this.world.a(this, (byte) 2); - this.W(); + this.ab(); if (entity != null) { double d0 = entity.locX - this.locX; @@ -378,21 +378,21 @@ public abstract class EntityLiving extends Entity { d0 = (Math.random() - Math.random()) * 0.01D; } - this.aa = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw; + this.ab = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw; this.a(entity, i, d0, d1); } else { - this.aa = (float) ((int) (Math.random() * 2.0D) * 180); + this.ab = (float) ((int) (Math.random() * 2.0D) * 180); } } if (this.health <= 0) { if (flag) { - this.world.makeSound(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.world.makeSound(this, this.i(), this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } this.a(entity); } else if (flag) { - this.world.makeSound(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.world.makeSound(this, this.h(), this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } return true; @@ -404,19 +404,19 @@ public abstract class EntityLiving extends Entity { this.health -= i; } - protected float i() { + protected float k() { return 1.0F; } - protected String e() { + protected String g() { return null; } - protected String f() { + protected String h() { return "random.hurt"; } - protected String g() { + protected String i() { return "random.hurt"; } @@ -436,20 +436,24 @@ public abstract class EntityLiving extends Entity { } public void a(Entity entity) { - if (this.R >= 0 && entity != null) { - entity.c(this, this.R); + if (this.S >= 0 && entity != null) { + entity.c(this, this.S); + } + + if (entity != null) { + entity.a(this); } - this.af = true; + this.ag = true; if (!this.world.isStatic) { - this.p(); + this.r(); } this.world.a(this, (byte) 3); } - protected void p() { - int i = this.h(); + protected void r() { + int i = this.j(); // CraftBukkit start - whole method List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); @@ -471,7 +475,7 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - protected int h() { + protected int j() { return 0; } @@ -505,7 +509,7 @@ public abstract class EntityLiving extends Entity { public void a(float f, float f1) { double d0; - if (this.g_()) { + if (this.Z()) { d0 = this.locY; this.a(f, f1, 0.02F); this.move(this.motX, this.motY, this.motZ); @@ -516,7 +520,7 @@ public abstract class EntityLiving extends Entity { if (this.positionChanged && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } - } else if (this.V()) { + } else if (this.aa()) { d0 = this.locY; this.a(f, f1, 0.02F); this.move(this.motX, this.motY, this.motZ); @@ -552,7 +556,7 @@ public abstract class EntityLiving extends Entity { } } - if (this.n()) { + if (this.p()) { this.fallDistance = 0.0F; if (this.motY < -0.15D) { this.motY = -0.15D; @@ -564,7 +568,7 @@ public abstract class EntityLiving extends Entity { } this.move(this.motX, this.motY, this.motZ); - if (this.positionChanged && this.n()) { + if (this.positionChanged && this.p()) { this.motY = 0.2D; } @@ -574,7 +578,7 @@ public abstract class EntityLiving extends Entity { this.motZ *= (double) f2; } - this.ai = this.aj; + this.aj = this.ak; d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F; @@ -583,26 +587,26 @@ public abstract class EntityLiving extends Entity { f4 = 1.0F; } - this.aj += (f4 - this.aj) * 0.4F; - this.ak += this.aj; + this.ak += (f4 - this.ak) * 0.4F; + this.al += this.ak; } - public boolean n() { + public boolean p() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); - return this.world.getTypeId(i, j, k) == Block.LADDER.id || this.world.getTypeId(i, j + 1, k) == Block.LADDER.id; + return this.world.getTypeId(i, j, k) == Block.LADDER.id; } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("Health", (short) this.health); nbttagcompound.a("HurtTime", (short) this.hurtTicks); nbttagcompound.a("DeathTime", (short) this.deathTicks); nbttagcompound.a("AttackTime", (short) this.attackTicks); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.health = nbttagcompound.d("Health"); if (!nbttagcompound.hasKey("Health")) { this.health = 10; @@ -613,7 +617,7 @@ public abstract class EntityLiving extends Entity { this.attackTicks = nbttagcompound.d("AttackTime"); } - public boolean N() { + public boolean P() { return !this.dead && this.health > 0; } @@ -621,15 +625,15 @@ public abstract class EntityLiving extends Entity { return false; } - public void r() { - if (this.al > 0) { - double d0 = this.locX + (this.am - this.locX) / (double) this.al; - double d1 = this.locY + (this.an - this.locY) / (double) this.al; - double d2 = this.locZ + (this.ao - this.locZ) / (double) this.al; + public void u() { + if (this.am > 0) { + double d0 = this.locX + (this.an - this.locX) / (double) this.am; + double d1 = this.locY + (this.ao - this.locY) / (double) this.am; + double d2 = this.locZ + (this.ap - this.locZ) / (double) this.am; double d3; - for (d3 = this.ap - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { + for (d3 = this.aq - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { ; } @@ -637,69 +641,68 @@ public abstract class EntityLiving extends Entity { d3 -= 360.0D; } - this.yaw = (float) ((double) this.yaw + d3 / (double) this.al); - this.pitch = (float) ((double) this.pitch + (this.aq - (double) this.pitch) / (double) this.al); - --this.al; + this.yaw = (float) ((double) this.yaw + d3 / (double) this.am); + this.pitch = (float) ((double) this.pitch + (this.ar - (double) this.pitch) / (double) this.am); + --this.am; this.setPosition(d0, d1, d2); this.c(this.yaw, this.pitch); } - if (this.p_()) { - this.ax = false; - this.au = 0.0F; + if (this.A()) { + this.ay = false; this.av = 0.0F; this.aw = 0.0F; - } else if (!this.T) { + this.ax = 0.0F; + } else if (!this.U) { this.c_(); } - boolean flag = this.g_(); - boolean flag1 = this.V(); + boolean flag = this.Z(); + boolean flag1 = this.aa(); - if (this.ax) { + if (this.ay) { if (flag) { this.motY += 0.03999999910593033D; } else if (flag1) { this.motY += 0.03999999910593033D; } else if (this.onGround) { - this.I(); + this.L(); } } - this.au *= 0.98F; this.av *= 0.98F; - this.aw *= 0.9F; - this.a(this.au, this.av); + this.aw *= 0.98F; + this.ax *= 0.9F; + this.a(this.av, this.aw); List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - if (entity.e_()) { + if (entity.d_()) { entity.collide(this); } } } } - protected boolean p_() { + protected boolean A() { return this.health <= 0; } - protected void I() { + protected void L() { this.motY = 0.41999998688697815D; } - protected boolean s() { + protected boolean l_() { return true; } - protected void c_() { - ++this.at; + protected void Q() { EntityHuman entityhuman = this.world.a(this, -1.0D); - if (this.s() && entityhuman != null) { + if (this.l_() && entityhuman != null) { double d0 = entityhuman.locX - this.locX; double d1 = entityhuman.locY - this.locY; double d2 = entityhuman.locZ - this.locZ; @@ -709,53 +712,59 @@ public abstract class EntityLiving extends Entity { this.die(); } - if (this.at > 600 && this.random.nextInt(800) == 0) { + if (this.au > 600 && this.random.nextInt(800) == 0) { if (d3 < 1024.0D) { - this.at = 0; + this.au = 0; } else { this.die(); } } } + } + + protected void c_() { + ++this.au; + EntityHuman entityhuman = this.world.a(this, -1.0D); - this.au = 0.0F; + this.Q(); this.av = 0.0F; + this.aw = 0.0F; float f = 8.0F; if (this.random.nextFloat() < 0.02F) { entityhuman = this.world.a(this, (double) f); if (entityhuman != null) { this.b = entityhuman; - this.aA = 10 + this.random.nextInt(20); + this.aB = 10 + this.random.nextInt(20); } else { - this.aw = (this.random.nextFloat() - 0.5F) * 20.0F; + this.ax = (this.random.nextFloat() - 0.5F) * 20.0F; } } if (this.b != null) { - this.a(this.b, 10.0F, (float) this.n_()); - if (this.aA-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) { + this.a(this.b, 10.0F, (float) this.v()); + if (this.aB-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) { this.b = null; } } else { if (this.random.nextFloat() < 0.05F) { - this.aw = (this.random.nextFloat() - 0.5F) * 20.0F; + this.ax = (this.random.nextFloat() - 0.5F) * 20.0F; } - this.yaw += this.aw; - this.pitch = this.ay; + this.yaw += this.ax; + this.pitch = this.az; } - boolean flag = this.g_(); - boolean flag1 = this.V(); + boolean flag = this.Z(); + boolean flag1 = this.aa(); if (flag || flag1) { - this.ax = this.random.nextFloat() < 0.8F; + this.ay = this.random.nextFloat() < 0.8F; } } - protected int n_() { - return 10; + protected int v() { + return 40; } public void a(Entity entity, float f, float f1) { @@ -766,24 +775,24 @@ public abstract class EntityLiving extends Entity { if (entity instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) entity; - d2 = this.locY + (double) this.q() - (entityliving.locY + (double) entityliving.q()); + d2 = this.locY + (double) this.s() - (entityliving.locY + (double) entityliving.s()); } else { - d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.q()); + d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.s()); } double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1); float f2 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; - float f3 = (float) (Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D); + float f3 = (float) (-(Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D)); this.pitch = -this.b(this.pitch, f3, f1); this.yaw = this.b(this.yaw, f2, f); } - public boolean O() { + public boolean R() { return this.b != null; } - public Entity P() { + public Entity S() { return this.b; } @@ -809,13 +818,13 @@ public abstract class EntityLiving extends Entity { return f + f3; } - public void Q() {} + public void T() {} - public boolean b() { - return this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); + public boolean d() { + return this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); } - protected void R() { + protected void U() { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); DamageCause damageType = EntityDamageEvent.DamageCause.VOID; @@ -833,7 +842,7 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - public Vec3D S() { + public Vec3D V() { return this.b(1.0F); } @@ -861,7 +870,7 @@ public abstract class EntityLiving extends Entity { } } - public int j() { + public int l() { return 4; } diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index c9465cdd..1c689f72 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -51,26 +51,26 @@ public class EntityMinecart extends Entity implements IInventory { this.b = 0; this.c = 1; this.i = false; - this.aD = true; + this.aE = true; this.b(0.98F, 0.7F); this.height = this.width / 2.0F; } - protected boolean l() { + protected boolean n() { return false; } - protected void a() {} + protected void b() {} public AxisAlignedBB a_(Entity entity) { return entity.boundingBox; } - public AxisAlignedBB d() { + public AxisAlignedBB e_() { return null; } - public boolean e_() { + public boolean d_() { return true; } @@ -94,7 +94,7 @@ public class EntityMinecart extends Entity implements IInventory { // CraftBukkit end } - public double k() { + public double m() { return (double) this.width * 0.0D - 0.30000001192092896D; } @@ -117,7 +117,7 @@ public class EntityMinecart extends Entity implements IInventory { this.c = -this.c; this.b = 10; - this.W(); + this.ab(); this.damage += i * 10; if (this.damage > 40) { @@ -147,7 +147,7 @@ public class EntityMinecart extends Entity implements IInventory { } } - public boolean d_() { + public boolean o_() { return !this.dead; } @@ -182,7 +182,7 @@ public class EntityMinecart extends Entity implements IInventory { super.die(); } - public void f_() { + public void p_() { // CraftBukkit start double prevX = this.locX; double prevY = this.locY; @@ -233,7 +233,7 @@ public class EntityMinecart extends Entity implements IInventory { int j = MathHelper.floor(this.locY); int k = MathHelper.floor(this.locZ); - if (this.world.getTypeId(i, j - 1, k) == Block.RAILS.id) { + if (BlockMinecartTrack.g(this.world, i, j - 1, k)) { --j; } @@ -242,32 +242,46 @@ public class EntityMinecart extends Entity implements IInventory { boolean flag = false; d0 = 0.0078125D; - if (this.world.getTypeId(i, j, k) == Block.RAILS.id) { + int l = this.world.getTypeId(i, j, k); + + if (BlockMinecartTrack.c(l)) { Vec3D vec3d = this.g(this.locX, this.locY, this.locZ); - int l = this.world.getData(i, j, k); + int i1 = this.world.getData(i, j, k); this.locY = (double) j; - if (l >= 2 && l <= 5) { + boolean flag1 = false; + boolean flag2 = false; + + if (l == Block.GOLDEN_RAIL.id) { + flag1 = (i1 & 8) != 0; + flag2 = !flag1; + } + + if (((BlockMinecartTrack) Block.byId[l]).d()) { + i1 &= 7; + } + + if (i1 >= 2 && i1 <= 5) { this.locY = (double) (j + 1); } - if (l == 2) { + if (i1 == 2) { this.motX -= d0; } - if (l == 3) { + if (i1 == 3) { this.motX += d0; } - if (l == 4) { + if (i1 == 4) { this.motZ += d0; } - if (l == 5) { + if (i1 == 5) { this.motZ -= d0; } - int[][] aint = matrix[l]; + int[][] aint = matrix[i1]; double d5 = (double) (aint[1][0] - aint[0][0]); double d6 = (double) (aint[1][2] - aint[0][2]); double d7 = Math.sqrt(d5 * d5 + d6 * d6); @@ -282,7 +296,22 @@ public class EntityMinecart extends Entity implements IInventory { this.motX = d9 * d5 / d7; this.motZ = d9 * d6 / d7; - double d10 = 0.0D; + double d10; + + if (flag2) { + d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); + if (d10 < 0.03D) { + this.motX *= 0.0D; + this.motY *= 0.0D; + this.motZ *= 0.0D; + } else { + this.motX *= 0.5D; + this.motY *= 0.0D; + this.motZ *= 0.5D; + } + } + + d10 = 0.0D; double d11 = (double) i + 0.5D + (double) aint[0][0] * 0.5D; double d12 = (double) k + 0.5D + (double) aint[0][2] * 0.5D; double d13 = (double) i + 0.5D + (double) aint[1][0] * 0.5D; @@ -301,39 +330,39 @@ public class EntityMinecart extends Entity implements IInventory { this.locZ = (double) k + 0.5D; d10 = this.locX - (double) i; } else { - d15 = this.locX - d11; - d17 = this.locZ - d12; - d16 = (d15 * d5 + d17 * d6) * 2.0D; - d10 = d16; + d16 = this.locX - d11; + d15 = this.locZ - d12; + d17 = (d16 * d5 + d15 * d6) * 2.0D; + d10 = d17; } this.locX = d11 + d5 * d10; this.locZ = d12 + d6 * d10; this.setPosition(this.locX, this.locY + (double) this.height, this.locZ); - d15 = this.motX; - d17 = this.motZ; + d16 = this.motX; + d15 = this.motZ; if (this.passenger != null) { + d16 *= 0.75D; d15 *= 0.75D; - d17 *= 0.75D; } - if (d15 < -d4) { - d15 = -d4; + if (d16 < -d4) { + d16 = -d4; } - if (d15 > d4) { - d15 = d4; + if (d16 > d4) { + d16 = d4; } - if (d17 < -d4) { - d17 = -d4; + if (d15 < -d4) { + d15 = -d4; } - if (d17 > d4) { - d17 = d4; + if (d15 > d4) { + d15 = d4; } - this.move(d15, 0.0D, d17); + this.move(d16, 0.0D, d15); if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) { this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ); } else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) { @@ -347,11 +376,11 @@ public class EntityMinecart extends Entity implements IInventory { this.motZ *= 0.996999979019165D; } else { if (this.type == 2) { - d16 = (double) MathHelper.a(this.f * this.f + this.g * this.g); - if (d16 > 0.01D) { + d17 = (double) MathHelper.a(this.f * this.f + this.g * this.g); + if (d17 > 0.01D) { flag = true; - this.f /= d16; - this.g /= d16; + this.f /= d17; + this.g /= d17; double d18 = 0.04D; this.motX *= 0.800000011920929D; @@ -385,18 +414,19 @@ public class EntityMinecart extends Entity implements IInventory { this.setPosition(this.locX, vec3d1.b, this.locZ); } - int i1 = MathHelper.floor(this.locX); - int j1 = MathHelper.floor(this.locZ); + int j1 = MathHelper.floor(this.locX); + int k1 = MathHelper.floor(this.locZ); - if (i1 != i || j1 != k) { + if (j1 != i || k1 != k) { d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); - this.motX = d9 * (double) (i1 - i); - this.motZ = d9 * (double) (j1 - k); + this.motX = d9 * (double) (j1 - i); + this.motZ = d9 * (double) (k1 - k); } - if (this.type == 2) { - double d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g); + double d20; + if (this.type == 2) { + d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g); if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) { this.f /= d20; this.g /= d20; @@ -409,6 +439,28 @@ public class EntityMinecart extends Entity implements IInventory { } } } + + if (flag1) { + d20 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); + if (d20 > 0.01D) { + double d21 = 0.04D; + + this.motX += this.motX / d20 * d21; + this.motZ += this.motZ / d20 * d21; + } else if (i1 == 1) { + if (this.world.d(i - 1, j, k)) { + this.motX = 0.02D; + } else if (this.world.d(i + 1, j, k)) { + this.motX = -0.02D; + } + } else if (i1 == 0) { + if (this.world.d(i, j, k - 1)) { + this.motZ = 0.02D; + } else if (this.world.d(i, j, k + 1)) { + this.motZ = -0.02D; + } + } + } } else { if (this.motX < -d4) { this.motX = -d4; @@ -445,27 +497,27 @@ public class EntityMinecart extends Entity implements IInventory { } this.pitch = 0.0F; - double d21 = this.lastX - this.locX; - double d22 = this.lastZ - this.locZ; + double d22 = this.lastX - this.locX; + double d23 = this.lastZ - this.locZ; - if (d21 * d21 + d22 * d22 > 0.0010D) { - this.yaw = (float) (Math.atan2(d22, d21) * 180.0D / 3.141592653589793D); + if (d22 * d22 + d23 * d23 > 0.0010D) { + this.yaw = (float) (Math.atan2(d23, d22) * 180.0D / 3.141592653589793D); if (this.i) { this.yaw += 180.0F; } } - double d23; + double d24; - for (d23 = (double) (this.yaw - this.lastYaw); d23 >= 180.0D; d23 -= 360.0D) { + for (d24 = (double) (this.yaw - this.lastYaw); d24 >= 180.0D; d24 -= 360.0D) { ; } - while (d23 < -180.0D) { - d23 += 360.0D; + while (d24 < -180.0D) { + d24 += 360.0D; } - if (d23 < -170.0D || d23 >= 170.0D) { + if (d24 < -170.0D || d24 >= 170.0D) { this.yaw += 180.0F; this.i = !this.i; } @@ -490,10 +542,10 @@ public class EntityMinecart extends Entity implements IInventory { List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { - for (int k1 = 0; k1 < list.size(); ++k1) { - Entity entity = (Entity) list.get(k1); + for (int l1 = 0; l1 < list.size(); ++l1) { + Entity entity = (Entity) list.get(l1); - if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) { + if (entity != this.passenger && entity.d_() && entity instanceof EntityMinecart) { entity.collide(this); } } @@ -519,19 +571,25 @@ public class EntityMinecart extends Entity implements IInventory { int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); - if (this.world.getTypeId(i, j - 1, k) == Block.RAILS.id) { + if (BlockMinecartTrack.g(this.world, i, j - 1, k)) { --j; } - if (this.world.getTypeId(i, j, k) == Block.RAILS.id) { - int l = this.world.getData(i, j, k); + int l = this.world.getTypeId(i, j, k); + + if (BlockMinecartTrack.c(l)) { + int i1 = this.world.getData(i, j, k); d1 = (double) j; - if (l >= 2 && l <= 5) { + if (((BlockMinecartTrack) Block.byId[l]).d()) { + i1 &= 7; + } + + if (i1 >= 2 && i1 <= 5) { d1 = (double) (j + 1); } - int[][] aint = matrix[l]; + int[][] aint = matrix[i1]; double d3 = 0.0D; double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D; double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D; @@ -574,7 +632,7 @@ public class EntityMinecart extends Entity implements IInventory { } } - protected void a(NBTTagCompound nbttagcompound) { + protected void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("Type", this.type); if (this.type == 2) { nbttagcompound.a("PushX", this.f); @@ -597,7 +655,7 @@ public class EntityMinecart extends Entity implements IInventory { } } - protected void b(NBTTagCompound nbttagcompound) { + protected void a(NBTTagCompound nbttagcompound) { this.type = nbttagcompound.e("Type"); if (this.type == 2) { this.f = nbttagcompound.h("PushX"); @@ -666,8 +724,8 @@ public class EntityMinecart extends Entity implements IInventory { d1 *= d3; d0 *= 0.10000000149011612D; d1 *= 0.10000000149011612D; - d0 *= (double) (1.0F - this.bo); - d1 *= (double) (1.0F - this.bo); + d0 *= (double) (1.0F - this.bq); + d1 *= (double) (1.0F - this.bq); d0 *= 0.5D; d1 *= 0.5D; if (entity instanceof EntityMinecart) { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index b464df95..bc8be4d2 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -20,18 +20,18 @@ public class EntityMonster extends EntityCreature implements IMonster { this.health = 20; } - public void r() { + public void u() { float f = this.c(1.0F); if (f > 0.5F) { - this.at += 2; + this.au += 2; } - super.r(); + super.u(); } - public void f_() { - super.f_(); + public void p_() { + super.p_(); if (this.world.spawnMonsters == 0) { this.die(); } @@ -106,15 +106,15 @@ public class EntityMonster extends EntityCreature implements IMonster { return 0.5F - this.world.l(i, j, k); } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); } - public boolean b() { + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public boolean d() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); @@ -124,7 +124,15 @@ public class EntityMonster extends EntityCreature implements IMonster { } else { int l = this.world.getLightLevel(i, j, k); - return l <= this.random.nextInt(8) && super.b(); + if (this.world.u()) { + int i1 = this.world.f; + + this.world.f = 10; + l = this.world.getLightLevel(i, j, k); + this.world.f = i1; + } + + return l <= this.random.nextInt(8) && super.d(); } } } diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 3f8e1823..87a6b022 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -18,31 +18,31 @@ public class EntityPigZombie extends EntityZombie { public EntityPigZombie(World world) { super(world); this.texture = "/mob/pigzombie.png"; - this.az = 0.5F; + this.aA = 0.5F; this.damage = 5; - this.by = true; + this.bz = true; } - public void f_() { - this.az = this.target != null ? 0.95F : 0.5F; + public void p_() { + this.aA = this.target != null ? 0.95F : 0.5F; if (this.soundDelay > 0 && --this.soundDelay == 0) { - this.world.makeSound(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F); + this.world.makeSound(this, "mob.zombiepig.zpigangry", this.k() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F); } - super.f_(); + super.p_(); } - public boolean b() { - return this.world.spawnMonsters > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); + public boolean d() { + return this.world.spawnMonsters > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); nbttagcompound.a("Anger", (short) this.angerLevel); } - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); this.angerLevel = nbttagcompound.d("Anger"); } @@ -50,8 +50,8 @@ public class EntityPigZombie extends EntityZombie { return this.angerLevel == 0 ? null : super.findTarget(); } - public void r() { - super.r(); + public void u() { + super.u(); } public boolean damageEntity(Entity entity, int i) { @@ -101,19 +101,19 @@ public class EntityPigZombie extends EntityZombie { this.soundDelay = this.random.nextInt(40); } - protected String e() { + protected String g() { return "mob.zombiepig.zpig"; } - protected String f() { + protected String h() { return "mob.zombiepig.zpighurt"; } - protected String g() { + protected String i() { return "mob.zombiepig.zpigdeath"; } - protected int h() { + protected int j() { return Item.GRILLED_PORK.id; } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 3adb9b44..bf8a065c 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -25,10 +25,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double e; public List f = new LinkedList(); public Set g = new HashSet(); - private int bE = -99999999; - private int bF = 60; - private ItemStack[] bG = new ItemStack[] { null, null, null, null, null}; - private int bH = 0; + private int bF = -99999999; + private int bG = 60; + private ItemStack[] bH = new ItemStack[] { null, null, null, null, null}; + private int bI = 0; public boolean h; public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { @@ -46,7 +46,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); this.b = minecraftserver; - this.bm = 0.0F; + this.bo = 0.0F; iteminworldmanager.player = this; this.name = s; this.itemInWorldManager = iteminworldmanager; @@ -65,28 +65,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public ItemStack[] getEquipment() { - return this.bG; + return this.bH; } - protected void l_() { + protected void j_() { this.height = 0.0F; } - public float q() { + public float s() { return 1.62F; } - public void f_() { + public void p_() { this.itemInWorldManager.a(); - --this.bF; + --this.bG; this.activeContainer.a(); for (int i = 0; i < 5; ++i) { ItemStack itemstack = this.b_(i); - if (itemstack != this.bG[i]) { + if (itemstack != this.bH[i]) { this.b.tracker.a(this, new Packet5EntityEquipment(this.id, i, itemstack)); - this.bG[i] = itemstack; + this.bH[i] = itemstack; } } } @@ -127,7 +127,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public boolean damageEntity(Entity entity, int i) { - if (this.bF > 0) { + if (this.bG > 0) { return false; } else { if (!this.b.pvpMode) { @@ -148,12 +148,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } + protected boolean t() { + return this.b.pvpMode; + } + public void b(int i) { super.b(i); } public void a(boolean flag) { - super.f_(); + super.p_(); if (flag && !this.f.isEmpty()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0); @@ -179,9 +183,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - if (this.health != this.bE) { + if (this.health != this.bF) { this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health)); - this.bE = this.health; + this.bF = this.health; } } @@ -195,8 +199,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void r() { - super.r(); + public void u() { + super.u(); } public void receive(Entity entity, int i) { @@ -214,7 +218,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.activeContainer.a(); } - public void m_() { + public void k_() { if (!this.p) { this.q = -1; this.p = true; @@ -222,7 +226,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void t() {} + public void w() {} public EnumBedError a(int i, int j, int k) { EnumBedError enumbederror = super.a(i, j, k); @@ -265,44 +269,44 @@ public class EntityPlayer extends EntityHuman implements ICrafting { super.a(d0, flag); } - private void aa() { - this.bH = this.bH % 100 + 1; + private void af() { + this.bI = this.bI % 100 + 1; } public void b(int i, int j, int k) { - this.aa(); - this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 1, "Crafting", 9)); + this.af(); + this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bI, 1, "Crafting", 9)); this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k); - this.activeContainer.f = this.bH; + this.activeContainer.f = this.bI; this.activeContainer.a((ICrafting) this); } public void a(IInventory iinventory) { - this.aa(); - this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 0, iinventory.getName(), iinventory.getSize())); + this.af(); + this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bI, 0, iinventory.getName(), iinventory.getSize())); this.activeContainer = new ContainerChest(this.inventory, iinventory); - this.activeContainer.f = this.bH; + this.activeContainer.f = this.bI; this.activeContainer.a((ICrafting) this); } public void a(TileEntityFurnace tileentityfurnace) { - this.aa(); - this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 2, tileentityfurnace.getName(), tileentityfurnace.getSize())); + this.af(); + this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bI, 2, tileentityfurnace.getName(), tileentityfurnace.getSize())); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); - this.activeContainer.f = this.bH; + this.activeContainer.f = this.bI; this.activeContainer.a((ICrafting) this); } public void a(TileEntityDispenser tileentitydispenser) { - this.aa(); - this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 3, tileentitydispenser.getName(), tileentitydispenser.getSize())); + this.af(); + this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bI, 3, tileentitydispenser.getName(), tileentitydispenser.getSize())); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); - this.activeContainer.f = this.bH; + this.activeContainer.f = this.bI; this.activeContainer.a((ICrafting) this); } public void a(Container container, int i, ItemStack itemstack) { - if (!(container.a(i) instanceof SlotResult)) { + if (!(container.b(i) instanceof SlotResult)) { if (!this.h) { this.netServerHandler.sendPacket(new Packet103SetSlot(container.f, i, itemstack)); } @@ -320,31 +324,44 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(ItemStack itemstack) {} - public void u() { + public void x() { this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.f)); - this.w(); + this.z(); } - public void v() { + public void y() { if (!this.h) { this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j())); } } - public void w() { + public void z() { this.activeContainer.a((EntityHuman) this); this.activeContainer = this.defaultContainer; } public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) { - this.au = f; - this.av = f1; - this.ax = flag; + this.av = f; + this.aw = f1; + this.ay = flag; this.setSneak(flag1); this.pitch = f2; this.yaw = f3; } + public void a(Statistic statistic, int i) { + if (statistic != null) { + if (!statistic.g) { + while (i > 100) { + this.netServerHandler.sendPacket(new Packet200Statistic(statistic.e, 100)); + i -= 100; + } + + this.netServerHandler.sendPacket(new Packet200Statistic(statistic.e, i)); + } + } + } + // Craftbukkit start @Override public String toString() { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index fbb88a5d..753e5619 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -20,19 +20,19 @@ public class EntitySkeleton extends EntityMonster { this.texture = "/mob/skeleton.png"; } - protected String e() { + protected String g() { return "mob.skeleton"; } - protected String f() { + protected String h() { return "mob.skeletonhurt"; } - protected String g() { + protected String i() { return "mob.skeletonhurt"; } - public void r() { + public void u() { if (this.world.d()) { float f = this.c(1.0F); @@ -51,7 +51,7 @@ public class EntitySkeleton extends EntityMonster { } } - super.r(); + super.u(); } protected void a(Entity entity, float f) { @@ -77,19 +77,19 @@ public class EntitySkeleton extends EntityMonster { } } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); } - protected int h() { + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + protected int j() { return Item.ARROW.id; } - protected void p() { + protected void r() { // CraftBukkit start - whole method List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 2bd1eee4..60d442e0 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -26,13 +26,13 @@ public class EntitySnowball extends Entity { this.b(0.25F, 0.25F); } - protected void a() {} + protected void b() {} public EntitySnowball(World world, EntityLiving entityliving) { super(world); this.shooter = entityliving; this.b(0.25F, 0.25F); - this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.s(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -76,11 +76,11 @@ public class EntitySnowball extends Entity { this.h = 0; } - public void f_() { - this.bi = this.locX; - this.bj = this.locY; - this.bk = this.locZ; - super.f_(); + public void p_() { + this.bk = this.locX; + this.bl = this.locY; + this.bm = this.locZ; + super.p_(); if (this.a > 0) { --this.a; } @@ -125,7 +125,7 @@ public class EntitySnowball extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) { + if (entity1.o_() && (entity1 != this.shooter || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -213,7 +213,7 @@ public class EntitySnowball extends Entity { float f2 = 0.99F; float f3 = 0.03F; - if (this.g_()) { + if (this.Z()) { for (int l = 0; l < 4; ++l) { float f4 = 0.25F; @@ -230,7 +230,7 @@ public class EntitySnowball extends Entity { this.setPosition(this.locX, this.locY, this.locZ); } - public void a(NBTTagCompound nbttagcompound) { + public void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.b); nbttagcompound.a("yTile", (short) this.c); nbttagcompound.a("zTile", (short) this.d); @@ -239,7 +239,7 @@ public class EntitySnowball extends Entity { nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0)); } - public void b(NBTTagCompound nbttagcompound) { + public void a(NBTTagCompound nbttagcompound) { this.b = nbttagcompound.d("xTile"); this.c = nbttagcompound.d("yTile"); this.d = nbttagcompound.d("zTile"); diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index 5c2ed922..d3c717fc 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -13,14 +13,14 @@ public class EntitySpider extends EntityMonster { super(world); this.texture = "/mob/spider.png"; this.b(1.4F, 0.9F); - this.az = 0.8F; + this.aA = 0.8F; } - public double k() { + public double m() { return (double) this.width * 0.75D - 0.5D; } - protected boolean l() { + protected boolean n() { return false; } @@ -36,15 +36,15 @@ public class EntitySpider extends EntityMonster { } } - protected String e() { + protected String g() { return "mob.spider"; } - protected String f() { + protected String h() { return "mob.spider"; } - protected String g() { + protected String i() { return "mob.spiderdeath"; } @@ -83,19 +83,19 @@ public class EntitySpider extends EntityMonster { } } - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); } - protected int h() { + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + protected int j() { return Item.STRING.id; } - public boolean n() { + public boolean p() { return this.positionChanged; } } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index 456b9af6..b54f9a77 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -13,7 +13,7 @@ public class EntityTNTPrimed extends Entity { public EntityTNTPrimed(World world) { super(world); this.a = 0; - this.aD = true; + this.aE = true; this.b(0.98F, 0.98F); this.height = this.width / 2.0F; } @@ -32,17 +32,17 @@ public class EntityTNTPrimed extends Entity { this.lastZ = d2; } - protected void a() {} + protected void b() {} - protected boolean l() { + protected boolean n() { return false; } - public boolean d_() { + public boolean o_() { return !this.dead; } - public void f_() { + public void p_() { this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; @@ -83,11 +83,11 @@ public class EntityTNTPrimed extends Entity { // CraftBukkit end } - protected void a(NBTTagCompound nbttagcompound) { + protected void b(NBTTagCompound nbttagcompound) { nbttagcompound.a("Fuse", (byte) this.a); } - protected void b(NBTTagCompound nbttagcompound) { + protected void a(NBTTagCompound nbttagcompound) { this.a = nbttagcompound.c("Fuse"); } } diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index d31dde9e..b5156c16 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -102,7 +102,7 @@ public class EntityTrackerEntry { this.a((Packet) object); } - DataWatcher datawatcher = this.tracker.T(); + DataWatcher datawatcher = this.tracker.W(); if (datawatcher.a()) { this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher))); diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index a6e5979d..4651e052 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -10,11 +10,11 @@ public class EntityZombie extends EntityMonster { public EntityZombie(World world) { super(world); this.texture = "/mob/zombie.png"; - this.az = 0.5F; + this.aA = 0.5F; this.damage = 5; } - public void r() { + public void u() { if (this.world.d()) { float f = this.c(1.0F); @@ -31,22 +31,22 @@ public class EntityZombie extends EntityMonster { } } - super.r(); + super.u(); } - protected String e() { + protected String g() { return "mob.zombie"; } - protected String f() { + protected String h() { return "mob.zombiehurt"; } - protected String g() { + protected String i() { return "mob.zombiedeath"; } - protected int h() { + protected int j() { return Item.FEATHER.id; } } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 57c131f3..d7adddff 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -180,7 +180,7 @@ public class Explosion { } } - public void b() { + public void a(boolean flag) { this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); ArrayList arraylist = new ArrayList(); @@ -196,7 +196,7 @@ public class Explosion { for (int j = arraylist.size() - 1; j >= 0; j--) { ChunkPosition cpos = (ChunkPosition) arraylist.get(j); org.bukkit.block.Block block = world.getBlockAt(cpos.x, cpos.y, cpos.z); - if (!block.getType().equals(org.bukkit.Material.AIR)) { + if (block.getType() != org.bukkit.Material.AIR) { blockList.add(block); } } @@ -217,7 +217,7 @@ public class Explosion { int l = chunkposition.z; int i1 = this.world.getTypeId(j, k, l); - for (int j1 = 0; j1 < 1; ++j1) { + if (flag) { double d0 = (double) ((float) j + this.world.random.nextFloat()); double d1 = (double) ((float) k + this.world.random.nextFloat()); double d2 = (double) ((float) l + this.world.random.nextFloat()); diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 7b2178f6..f9fea29f 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -114,7 +114,7 @@ public class ItemInWorldManager { Block block = Block.byId[i1]; float f = block.getDamage(this.player) * (float) (l + 1); - if (f >= 1.0F) { + if (f >= 0.7F) { this.d(i, j, k); } else if (!this.i) { this.i = true; @@ -164,13 +164,13 @@ public class ItemInWorldManager { int l = this.world.getTypeId(i, j, k); int i1 = this.world.getData(i, j, k); boolean flag = this.c(i, j, k); - ItemStack itemstack = this.player.A(); + ItemStack itemstack = this.player.D(); if (itemstack != null) { itemstack.a(l, i, j, k, this.player); if (itemstack.count == 0) { itemstack.a(this.player); - this.player.B(); + this.player.E(); } } diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java index aecaa6fd..5e83b1ad 100644 --- a/src/main/java/net/minecraft/server/ItemMinecart.java +++ b/src/main/java/net/minecraft/server/ItemMinecart.java @@ -19,7 +19,7 @@ public class ItemMinecart extends Item { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { int i1 = world.getTypeId(i, j, k); - if (i1 == Block.RAILS.id) { + if (BlockMinecartTrack.c(i1)) { if (!world.isStatic) { // CraftBukkit start - Minecarts PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 1768ed6f..b7b7fd35 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -56,7 +56,7 @@ public final class ItemStack { boolean flag = this.getItem().a(this, entityhuman, world, i, j, k, l); if (flag) { - entityhuman.a(StatisticList.A[this.id], 1); + entityhuman.a(StatisticList.E[this.id], 1); } return flag; @@ -120,7 +120,7 @@ public final class ItemStack { this.damage += i; if (this.damage > this.i()) { if (entity instanceof EntityHuman) { - ((EntityHuman) entity).a(StatisticList.B[this.id], 1); + ((EntityHuman) entity).a(StatisticList.F[this.id], 1); } --this.count; @@ -137,7 +137,7 @@ public final class ItemStack { boolean flag = Item.byId[this.id].a(this, entityliving, (EntityLiving) entityhuman); if (flag) { - entityhuman.a(StatisticList.A[this.id], 1); + entityhuman.a(StatisticList.E[this.id], 1); } } @@ -145,7 +145,7 @@ public final class ItemStack { boolean flag = Item.byId[this.id].a(this, i, j, k, l, entityhuman); if (flag) { - entityhuman.a(StatisticList.A[this.id], 1); + entityhuman.a(StatisticList.E[this.id], 1); } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index c66f0e09..68b9ff17 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -40,12 +40,13 @@ public class MinecraftServer implements Runnable, ICommandListener { int ticks = 0; public String i; public int j; - private List q = new ArrayList(); - private List r = Collections.synchronizedList(new ArrayList()); + private List r = new ArrayList(); + private List s = Collections.synchronizedList(new ArrayList()); public EntityTracker tracker; public boolean onlineMode; public boolean spawnAnimals; public boolean pvpMode; + public boolean o; // CraftBukkit start public int spawnProtection; @@ -83,7 +84,7 @@ public class MinecraftServer implements Runnable, ICommandListener { System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); // CraftBukkit end - log.info("Starting minecraft server version Beta 1.3"); + log.info("Starting minecraft server version Beta 1.5_02"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { log.warning("**** NOT ENOUGH RAM!"); log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); @@ -96,6 +97,7 @@ public class MinecraftServer implements Runnable, ICommandListener { this.onlineMode = this.propertyManager.getBoolean("online-mode", true); this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true); this.pvpMode = this.propertyManager.getBoolean("pvp", true); + this.o = this.propertyManager.getBoolean("allow-flight", false); this.spawnProtection = this.propertyManager.getInt("spawn-protection", 16); // CraftBukkit Configurable spawn protection start InetAddress inetaddress = null; @@ -369,8 +371,8 @@ public class MinecraftServer implements Runnable, ICommandListener { this.serverConfigurationManager.b(); this.tracker.a(); - for (j = 0; j < this.q.size(); ++j) { - ((IUpdatePlayerListBox) this.q.get(j)).a(); + for (j = 0; j < this.r.size(); ++j) { + ((IUpdatePlayerListBox) this.r.get(j)).a(); } try { @@ -381,23 +383,25 @@ public class MinecraftServer implements Runnable, ICommandListener { } public void issueCommand(String s, ICommandListener icommandlistener) { - this.r.add(new ServerCommand(s, icommandlistener)); + this.s.add(new ServerCommand(s, icommandlistener)); } public void b() { - while (this.r.size() > 0) { - ServerCommand servercommand = (ServerCommand) this.r.remove(0); + while (this.s.size() > 0) { + ServerCommand servercommand = (ServerCommand) this.s.remove(0); - // this.consoleCommandHandler.a(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand + // this.consoleCommandHandler.handle(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand server.dispatchCommand(console, servercommand); // CraftBukkit } } public void a(IUpdatePlayerListBox iupdateplayerlistbox) { - this.q.add(iupdateplayerlistbox); + this.r.add(iupdateplayerlistbox); } public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[]) + StatisticList.a(); + try { MinecraftServer minecraftserver = new MinecraftServer(options); diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 97557a12..db4ad260 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -63,8 +63,8 @@ public class NetLoginHandler extends NetHandler { public void a(Packet1Login packet1login) { this.g = packet1login.name; - if (packet1login.a != 10) { - if (packet1login.a > 10) { + if (packet1login.a != 11) { + if (packet1login.a > 11) { this.disconnect("Outdated server!"); } else { this.disconnect("Outdated client!"); @@ -73,21 +73,24 @@ public class NetLoginHandler extends NetHandler { if (!this.server.onlineMode) { this.b(packet1login); } else { - (new ThreadLoginVerifier(this, packet1login, this.server.server)).start(); + (new ThreadLoginVerifier(this, packet1login, this.server.server)).start(); // CraftBukkit } } } public void b(Packet1Login packet1login) { - EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name, packet1login.c); + EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name); if (entityplayer != null) { a.info(this.b() + " logged in with entity id " + entityplayer.id); ChunkCoordinates chunkcoordinates = entityplayer.world.getSpawn(); // CraftBukkit NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer); - netserverhandler.sendPacket(new Packet1Login("", "", entityplayer.id, entityplayer.world.getSeed(), (byte) entityplayer.world.worldProvider.dimension)); // CraftBukkit + netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, entityplayer.world.getSeed(), (byte) entityplayer.world.worldProvider.dimension)); // CraftBukkit netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z)); + if (((WorldServer) entityplayer.world).v()) { // CraftBukkit + netserverhandler.sendPacket(new Packet70Bed(1)); + } // this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event this.server.serverConfigurationManager.a(entityplayer); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); @@ -112,6 +115,10 @@ public class NetLoginHandler extends NetHandler { return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString(); } + public boolean c() { + return true; + } + static String a(NetLoginHandler netloginhandler) { return netloginhandler.i; } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 8734ec9b..4e6fd153 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -30,12 +30,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public EntityPlayer player; // CraftBukkit - private->public private int f; private int g; - private boolean h; + private int h; + private boolean i; private double x; private double y; private double z; - private boolean l = true; - private Map m = new HashMap(); + private boolean m = true; + private Map n = new HashMap(); public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; @@ -62,13 +63,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // Store the last block right clicked and what type it was private int lastMaterial; - public CraftPlayer getPlayer() { + public Player getPlayer() { return (this.player == null) ? null : (CraftPlayer) player.getBukkitEntity(); } // CraftBukkit end public void a() { - this.h = false; + this.i = false; this.networkManager.a(); if (this.f - this.g > 20) { this.sendPacket(new Packet0KeepAlive()); @@ -102,13 +103,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet10Flying packet10flying) { - this.h = true; + this.i = true; double d0; - if (!this.l) { + if (!this.m) { d0 = packet10flying.y - this.y; if (packet10flying.x == this.x && d0 * d0 < 0.01D && packet10flying.z == this.z) { - this.l = true; + this.m = true; } } @@ -175,7 +176,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } // CraftBukkit end - if (this.l) { + if (this.m) { double d1; double d2; double d3; @@ -185,7 +186,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { float f = this.player.yaw; float f1 = this.player.pitch; - this.player.vehicle.h_(); + this.player.vehicle.f(); d1 = this.player.locX; d2 = this.player.locY; d3 = this.player.locZ; @@ -214,7 +215,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } if (this.player.vehicle != null) { - this.player.vehicle.h_(); + this.player.vehicle.f(); } this.minecraftServer.serverConfigurationManager.b(this.player); @@ -245,56 +246,58 @@ public class NetServerHandler extends NetHandler implements ICommandListener { d2 = packet10flying.y; d3 = packet10flying.z; d4 = packet10flying.stance - packet10flying.y; - if (d4 > 1.65D || d4 < 0.1D) { + if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) { this.disconnect("Illegal stance"); a.warning(this.player.name + " had an illegal stance: " + d4); - d4 = 1.62D; // CraftBukkit - reset the stance to 'the normal' height + return; + } + + if (Math.abs(packet10flying.x) > 3.2E7D || Math.abs(packet10flying.z) > 3.2E7D) { + this.disconnect("Illegal position"); + return; } } - // Craftbukkit start - better fix for invalid position issues; should be fixed in 1.5 + if (packet10flying.hasLook) { + f2 = packet10flying.yaw; + f3 = packet10flying.pitch; + } + + this.player.a(true); + this.player.bn = 0.0F; + this.player.setLocation(this.x, this.y, this.z, f2, f3); d4 = d1 - this.player.locX; double d6 = d2 - this.player.locY; double d7 = d3 - this.player.locZ; - float f4 = 0.0625F; - - if (d6 > -0.5D || d6 < 0.5D) { - d6 = 0.0D; - } - - d7 = d3 - this.player.locZ; double d8 = d4 * d4 + d6 * d6 + d7 * d7; - boolean flag1 = false; - if (d8 > 6.25D && !this.player.isSleeping()) { - flag1 = true; - a.warning(this.player.name + " moved wrongly!"); - System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); - System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ); + if (d8 > 100.0D) { + a.warning(this.player.name + " moved too quickly!"); + this.disconnect("You moved too quickly :( (Hacking?)"); + return; } + float f4 = 0.0625F; + // CraftBukkit + boolean flag = ((WorldServer) this.player.world).getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0; + this.player.move(d4, d6, d7); d4 = d1 - this.player.locX; d6 = d2 - this.player.locY; - if (d6 > -0.5D || d6 < 0.5D) { d6 = 0.0D; } d7 = d3 - this.player.locZ; + d8 = d4 * d4 + d6 * d6 + d7 * d7; + boolean flag1 = false; - if (packet10flying.hasLook) { - f2 = packet10flying.yaw; - f3 = packet10flying.pitch; + if (d8 > 0.0625D && !this.player.isSleeping()) { + flag1 = true; + a.warning(this.player.name + " moved wrongly!"); + System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); + System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ); } - // Craftbukkit end - - this.player.a(true); - this.player.bl = 0.0F; - this.player.setLocation(this.x, this.y, this.z, f2, f3); - - // CraftBukkit - boolean flag = ((WorldServer) this.player.world).getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0; this.player.setLocation(d1, d2, d3, f2, f3); // CraftBukkit @@ -305,6 +308,22 @@ public class NetServerHandler extends NetHandler implements ICommandListener { return; } + AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().b((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D); + + // CraftBukkit + if (!this.minecraftServer.o && !((WorldServer) this.player.world).b(axisalignedbb)) { + if (d6 >= -0.03125D) { + ++this.h; + if (this.h > 80) { + a.warning(this.player.name + " was kicked for floating too long!"); + this.disconnect("Flying is not enabled on this server"); + return; + } + } + } else { + this.h = 0; + } + this.player.onGround = packet10flying.g; this.minecraftServer.serverConfigurationManager.b(this.player); this.player.b(this.player.locY - d0, packet10flying.g); @@ -339,7 +358,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { f1 = to.getPitch(); // CraftBukkit end - this.l = false; + this.m = false; this.x = d0; this.y = d1; this.z = d2; @@ -352,7 +371,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet14BlockDig packet14blockdig) { if (packet14blockdig.e == 4) { - this.player.z(); + this.player.C(); } else { // CraftBukkit boolean flag = ((WorldServer) this.player.world).weirdIsOpCache = this.minecraftServer.serverConfigurationManager.isOp(this.player.name); @@ -617,7 +636,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { private void handleCommand(String s) { // CraftBukkit start - CraftPlayer player = getPlayer(); + CraftPlayer player = (CraftPlayer) getPlayer(); PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s); server.getPluginManager().callEvent(event); @@ -704,7 +723,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { server.getPluginManager().callEvent(event); // CraftBukkit end - this.player.m_(); + this.player.k_(); } } @@ -726,7 +745,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.player.setSneak(false); } else if (packet19entityaction.animation == 3) { this.player.a(false, true, true); - this.l = false; + this.m = false; } } @@ -764,28 +783,28 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.player = this.minecraftServer.serverConfigurationManager.d(this.player); // CraftBukkit start - CraftPlayer player = getPlayer(); + CraftPlayer player = (CraftPlayer) getPlayer(); player.setHandle(this.player); // CraftBukkit end } } public void a(Packet101CloseWindow packet101closewindow) { - this.player.w(); + this.player.z(); } public void a(Packet102WindowClick packet102windowclick) { if (this.player.activeContainer.f == packet102windowclick.a && this.player.activeContainer.c(this.player)) { - ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, this.player); + ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player); if (ItemStack.equals(packet102windowclick.e, itemstack)) { this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)); this.player.h = true; this.player.activeContainer.a(); - this.player.v(); + this.player.y(); this.player.h = false; } else { - this.m.put(Integer.valueOf(this.player.activeContainer.f), Short.valueOf(packet102windowclick.d)); + this.n.put(Integer.valueOf(this.player.activeContainer.f), Short.valueOf(packet102windowclick.d)); this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)); this.player.activeContainer.a(this.player, false); ArrayList arraylist = new ArrayList(); @@ -800,7 +819,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet106Transaction packet106transaction) { - Short oshort = (Short) this.m.get(Integer.valueOf(this.player.activeContainer.f)); + Short oshort = (Short) this.n.get(Integer.valueOf(this.player.activeContainer.f)); if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.f == packet106transaction.a && !this.player.activeContainer.c(this.player)) { this.player.activeContainer.a(this.player, true); @@ -875,4 +894,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } } } + + public boolean c() { + return true; + } } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index 6fd24057..7a85b1d2 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -1,15 +1,16 @@ package net.minecraft.server; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.net.Socket; import java.net.SocketAddress; +import java.io.IOException; // CraftBukkit -- instead of SocketException import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.io.IOException; // CraftBukkit - public class NetworkManager { public static final Object a = new Object(); @@ -42,10 +43,13 @@ public class NetworkManager { this.n = nethandler; try { - socket.setSoTimeout(30000); // Craftbukkit start + socket.setSoTimeout(30000); socket.setTrafficClass(24); + + // CraftBukkit start -- cant compile these outside the try this.input = new DataInputStream(socket.getInputStream()); this.output = new DataOutputStream(socket.getOutputStream()); + // CraftBukkit end } catch (IOException socketexception) { System.err.println(socketexception.getMessage()); } @@ -106,6 +110,8 @@ public class NetworkManager { if (flag) { Thread.sleep(10L); + } else { + this.output.flush(); } } catch (InterruptedException interruptedexception) { ; @@ -118,7 +124,7 @@ public class NetworkManager { private void f() { try { - Packet packet = Packet.b(this.input); + Packet packet = Packet.a(this.input, this.n.c()); if (packet != null) { this.k.add(packet); diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java deleted file mode 100644 index faf80557..00000000 --- a/src/main/java/net/minecraft/server/Packet.java +++ /dev/null @@ -1,248 +0,0 @@ -package net.minecraft.server; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.EOFException; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -// Craftbukkit start -import java.net.SocketException; -import java.net.SocketTimeoutException; -// Craftbukkit end - -public abstract class Packet { - - private static Map a = new HashMap(); - private static Map b = new HashMap(); - public final long timestamp = System.currentTimeMillis(); - public boolean k = false; - private static HashMap c; - private static int d; - - public Packet() {} - - static void a(int i, Class oclass) { - if (a.containsKey(Integer.valueOf(i))) { - throw new IllegalArgumentException("Duplicate packet id:" + i); - } else if (b.containsKey(oclass)) { - throw new IllegalArgumentException("Duplicate packet class:" + oclass); - } else { - a.put(Integer.valueOf(i), oclass); - b.put(oclass, Integer.valueOf(i)); - } - } - - // CraftBukkit start - private static Map<Integer,Class<?>> e = new HashMap<Integer,Class<?>>(); - private static Map<Class<?>,Integer> f = new HashMap<Class<?>,Integer>(); - - static void b(int i, Class<?> oclass) { - if (e.containsKey(Integer.valueOf(i))) { - throw new IllegalArgumentException("Duplicate packet id:" + i); - } else if (f.containsKey(oclass)) { - throw new IllegalArgumentException("Duplicate packet class:" + oclass); - } else { - e.put(Integer.valueOf(i), oclass); - f.put(oclass, Integer.valueOf(i)); - } - } - // CraftBukkit end - - public static Packet a(int i) { - try { - Class oclass = (Class) a.get(Integer.valueOf(i)); - - return oclass == null ? null : (Packet) oclass.newInstance(); - } catch (Exception exception) { - exception.printStackTrace(); - System.out.println("Skipping packet with id " + i); - return null; - } - } - - public final int b() { - // CraftBukkit b->f - return ((Integer) f.get(this.getClass())).intValue(); - } - - // CraftBukkit - public static Packet b(DataInputStream datainputstream) throws IOException { - boolean flag = false; - Packet packet = null; - - int i; - - try { - i = datainputstream.read(); - if (i == -1) { - return null; - } - - packet = a(i); - if (packet == null) { - throw new IOException("Bad packet id " + i); - } - - packet.a(datainputstream); - } catch (EOFException eofexception) { - System.out.println("Reached end of stream"); - return null; - } - - // Craftbukkit start - catch (SocketTimeoutException exception) { - System.out.println("Read timed out"); - return null; - } catch (SocketException exception) { - System.out.println("Connection reset"); - return null; - } - // Craftbukkit end - - PacketCounter packetcounter = (PacketCounter) c.get(Integer.valueOf(i)); - - if (packetcounter == null) { - packetcounter = new PacketCounter((EmptyClass1) null); - c.put(Integer.valueOf(i), packetcounter); - } - - packetcounter.a(packet.a()); - ++d; - if (d % 1000 == 0) { - ; - } - - return packet; - } - - // CraftBukkit - public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException { - dataoutputstream.write(packet.b()); - packet.a(dataoutputstream); - } - - public abstract void a(DataInputStream datainputstream); - - public abstract void a(DataOutputStream dataoutputstream); - - public abstract void a(NetHandler nethandler); - - public abstract int a(); - - static { - // CraftBukkit start -- accepted packets from CLIENT - a(0, Packet0KeepAlive.class); - a(1, Packet1Login.class); - a(2, Packet2Handshake.class); - a(3, Packet3Chat.class); - //a(4, Packet4UpdateTime.class); - //a(5, Packet5EntityEquipment.class); - //a(6, Packet6SpawnPosition.class); - a(7, Packet7UseEntity.class); - //a(8, Packet8UpdateHealth.class); - a(9, Packet9Respawn.class); - a(10, Packet10Flying.class); - a(11, Packet11PlayerPosition.class); - a(12, Packet12PlayerLook.class); - a(13, Packet13PlayerLookMove.class); - a(14, Packet14BlockDig.class); - a(15, Packet15Place.class); - a(16, Packet16BlockItemSwitch.class); - //a(17, Packet17.class); - a(18, Packet18ArmAnimation.class); - a(19, Packet19EntityAction.class); - //a(20, Packet20NamedEntitySpawn.class); - //a(21, Packet21PickupSpawn.class); - //a(22, Packet22Collect.class); - //a(23, Packet23VehicleSpawn.class); - //a(24, Packet24MobSpawn.class); - //a(25, Packet25EntityPainting.class); - a(27, Packet27.class); - //a(28, Packet28EntityVelocity.class); - //a(29, Packet29DestroyEntity.class); - //a(30, Packet30Entity.class); - //a(31, Packet31RelEntityMove.class); - //a(32, Packet32EntityLook.class); - //a(33, Packet33RelEntityMoveLook.class); - //a(34, Packet34EntityTeleport.class); - //a(38, Packet38EntityStatus.class); - //a(39, Packet39AttachEntity.class); - //a(40, Packet40EntityMetadata.class); - //a(50, Packet50PreChunk.class); - //a(51, Packet51MapChunk.class); - //a(52, Packet52MultiBlockChange.class); - //a(53, Packet53BlockChange.class); - //a(54, Packet54PlayNoteBlock.class); - //a(60, Packet60Explosion.class); - //a(100, Packet100OpenWindow.class); - a(101, Packet101CloseWindow.class); - a(102, Packet102WindowClick.class); - //a(103, Packet103SetSlot.class); - //a(104, Packet104WindowItems.class); - //a(105, Packet105CraftProgressBar.class); - a(106, Packet106Transaction.class); - a(130, Packet130UpdateSign.class); - a(255, Packet255KickDisconnect.class); - - // CraftBukkit packets send from SERVER - b(0, Packet0KeepAlive.class); - b(1, Packet1Login.class); - b(2, Packet2Handshake.class); - b(3, Packet3Chat.class); - b(4, Packet4UpdateTime.class); - b(5, Packet5EntityEquipment.class); - b(6, Packet6SpawnPosition.class); - //b(7, Packet7UseEntity.class); - b(8, Packet8UpdateHealth.class); - b(9, Packet9Respawn.class); - //b(10, Packet10Flying.class); - //b(11, Packet11PlayerPosition.class); - //b(12, Packet12PlayerLook.class); - b(13, Packet13PlayerLookMove.class); - //b(14, Packet14BlockDig.class); - //b(15, Packet15Place.class); - //b(16, Packet16BlockItemSwitch.class); - b(17, Packet17.class); - b(18, Packet18ArmAnimation.class); - //b(19, Packet19EntityAction.class); - b(20, Packet20NamedEntitySpawn.class); - b(21, Packet21PickupSpawn.class); - b(22, Packet22Collect.class); - b(23, Packet23VehicleSpawn.class); - b(24, Packet24MobSpawn.class); - b(25, Packet25EntityPainting.class); - //b(27, Packet27.class); - b(28, Packet28EntityVelocity.class); - b(29, Packet29DestroyEntity.class); - //b(30, Packet30Entity.class); - b(31, Packet31RelEntityMove.class); - b(32, Packet32EntityLook.class); - b(33, Packet33RelEntityMoveLook.class); - b(34, Packet34EntityTeleport.class); - b(38, Packet38EntityStatus.class); - b(39, Packet39AttachEntity.class); - b(40, Packet40EntityMetadata.class); - b(50, Packet50PreChunk.class); - b(51, Packet51MapChunk.class); - b(52, Packet52MultiBlockChange.class); - b(53, Packet53BlockChange.class); - b(54, Packet54PlayNoteBlock.class); - b(60, Packet60Explosion.class); - b(70, Packet70Bed.class); - b(100, Packet100OpenWindow.class); - b(101, Packet101CloseWindow.class); - //b(102, Packet102WindowClick.class); - b(103, Packet103SetSlot.class); - b(104, Packet104WindowItems.class); - b(105, Packet105CraftProgressBar.class); - b(106, Packet106Transaction.class); - b(130, Packet130UpdateSign.class); - b(255, Packet255KickDisconnect.class); - // CraftBukkit end - - c = new HashMap(); - d = 0; - } -} diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 4a3f77df..f31caa01 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -71,7 +71,7 @@ public class ServerConfigurationManager { public void setPlayerFileData(WorldServer worldserver) { if (this.playerFileData != null) return; // CraftBukkit - this.playerFileData = worldserver.o().d(); + this.playerFileData = worldserver.p().d(); } public int a() { @@ -118,11 +118,12 @@ public class ServerConfigurationManager { this.playerFileData.a(entityplayer); entityplayer.world.kill(entityplayer); // CraftBukkit this.players.remove(entityplayer); + ((WorldServer) entityplayer.world).manager.removePlayer(entityplayer); return playerQuitEvent.getQuitMessage(); // CraftBukkit } - public EntityPlayer a(NetLoginHandler netloginhandler, String s, String s1) { + public EntityPlayer a(NetLoginHandler netloginhandler, String s) { // CraftBukkit start - note: this entire method needs to be changed // Instead of kicking then returning, we need to store the kick reason // in the event, check with plugins to see if it's ok, and THEN kick @@ -173,7 +174,7 @@ public class ServerConfigurationManager { ((WorldServer) entityplayer.world).manager.removePlayer(entityplayer); this.players.remove(entityplayer); entityplayer.world.removeEntity(entityplayer); - ChunkCoordinates chunkcoordinates = entityplayer.H(); + ChunkCoordinates chunkcoordinates = entityplayer.K(); EntityPlayer entityplayer1 = new EntityPlayer(this.server, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world)); entityplayer1.id = entityplayer.id; @@ -225,7 +226,7 @@ public class ServerConfigurationManager { // CraftBukkit end this.players.add(entityplayer1); entityplayer1.syncInventory(); - entityplayer1.t(); + entityplayer1.w(); return entityplayer1; } diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java index e549a7fc..2b7fde25 100644 --- a/src/main/java/net/minecraft/server/Slot.java +++ b/src/main/java/net/minecraft/server/Slot.java @@ -16,7 +16,7 @@ public class Slot { } public void a(ItemStack itemstack) { - this.b(); + this.c(); } public boolean isAllowed(ItemStack itemstack) { @@ -27,16 +27,20 @@ public class Slot { return this.inventory.getItem(this.index); } + public boolean b() { + return this.getItem() != null; + } + public void c(ItemStack itemstack) { this.inventory.setItem(this.index, itemstack); - this.b(); + this.c(); } - public void b() { + public void c() { this.inventory.update(); } - public int c() { + public int d() { return this.inventory.getMaxStackSize(); } @@ -48,7 +52,7 @@ public class Slot { return iinventory == this.inventory && i == this.index; } - public boolean d() { + public boolean e() { return false; } } diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java index 60bd1425..4ab2c930 100644 --- a/src/main/java/net/minecraft/server/ThreadCommandReader.java +++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java @@ -3,10 +3,13 @@ package net.minecraft.server; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; + +// CraftBukkit start import java.io.PrintStream; import java.util.logging.Level; import java.util.logging.Logger; import jline.ConsoleReader; +// CraftBukkit end public class ThreadCommandReader extends Thread { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index d0e1ff35..1bd71584 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -102,7 +102,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { return this.burnTime > 0; } - public void i_() { + public void g_() { boolean flag = this.burnTime > 0; boolean flag1 = false; @@ -179,7 +179,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } else { int i = itemstack.getItem().id; - return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : 0))); + return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : (i == Block.SAPLING.id ? 100 : 0)))); } } diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index 5e739c3e..ee36b470 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -19,7 +19,7 @@ public class TileEntityMobSpawner extends TileEntity { return this.world.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null; } - public void i_() { + public void g_() { this.c = this.b; if (this.a()) { double d0 = (double) ((float) this.e + this.world.random.nextFloat()); @@ -69,7 +69,7 @@ public class TileEntityMobSpawner extends TileEntity { double d5 = (double) this.g + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D; entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F); - if (entityliving.b()) { + if (entityliving.d()) { this.world.addEntity(entityliving); for (int k = 0; k < 20; ++k) { @@ -80,13 +80,13 @@ public class TileEntityMobSpawner extends TileEntity { this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); } - entityliving.M(); + entityliving.O(); this.c(); } } } - super.i_(); + super.g_(); } } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 5ccebcc8..598d5c2e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -19,38 +19,45 @@ import org.bukkit.event.entity.CreatureSpawnEvent; public class World implements IBlockAccess { public boolean a = false; - private List u = new ArrayList(); + private List w = new ArrayList(); public List entityList = new ArrayList(); - private List v = new ArrayList(); - private TreeSet w = new TreeSet(); - private Set x = new HashSet(); + private List x = new ArrayList(); + private TreeSet y = new TreeSet(); + private Set z = new HashSet(); public List c = new ArrayList(); public List players = new ArrayList(); - private long y = 16777215L; - public int e = 0; - protected int f = (new Random()).nextInt(); - protected int g = 1013904223; - public boolean h = false; - private long z = System.currentTimeMillis(); - protected int i = 40; + public List e = new ArrayList(); + private long A = 16777215L; + public int f = 0; + protected int g = (new Random()).nextInt(); + protected int h = 1013904223; + private float B; + private float C; + private float D; + private float E; + private int F = 0; + public int i = 0; + public boolean j = false; + private long G = System.currentTimeMillis(); + protected int k = 40; public int spawnMonsters; public Random random = new Random(); - public boolean l = false; + public boolean n = false; public final WorldProvider worldProvider; - protected List n = new ArrayList(); + protected List p = new ArrayList(); public IChunkProvider chunkProvider; // CraftBukkit protected->public - protected final IDataManager p; + protected final IDataManager r; public WorldData worldData; // CraftBukkit protected->public public boolean isLoading; - private boolean A; - private ArrayList B = new ArrayList(); - private int C = 0; + private boolean H; + private ArrayList I = new ArrayList(); + private int J = 0; public boolean allowMonsters = true; // CraftBukkit private->public public boolean allowAnimals = true; // CraftBukkit private->public - static int s = 0; - private Set F = new HashSet(); - private int G; - private List H; + static int u = 0; + private Set M = new HashSet(); + private int N; + private List O; public boolean isStatic; public WorldChunkManager getWorldChunkManager() { @@ -58,12 +65,12 @@ public class World implements IBlockAccess { } public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider) { - this.G = this.random.nextInt(12000); - this.H = new ArrayList(); + this.N = this.random.nextInt(12000); + this.O = new ArrayList(); this.isStatic = false; - this.p = idatamanager; + this.r = idatamanager; this.worldData = idatamanager.c(); - this.l = this.worldData == null; + this.n = this.worldData == null; if (worldprovider != null) { this.worldProvider = worldprovider; } else if (this.worldData != null && this.worldData.h() == -1) { @@ -88,10 +95,11 @@ public class World implements IBlockAccess { } this.g(); + this.x(); } protected IChunkProvider b() { - IChunkLoader ichunkloader = this.p.a(this.worldProvider); + IChunkLoader ichunkloader = this.r.a(this.worldProvider); return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.c()); } @@ -127,7 +135,7 @@ public class World implements IBlockAccess { iprogressupdate.a("Saving level"); } - this.t(); + this.w(); if (iprogressupdate != null) { iprogressupdate.b("Saving chunks"); } @@ -136,9 +144,9 @@ public class World implements IBlockAccess { } } - private void t() { - this.j(); - this.p.a(this.worldData, this.players); + private void w() { + this.k(); + this.r.a(this.worldData, this.players); } public int getTypeId(int i, int j, int k) { @@ -313,8 +321,8 @@ public class World implements IBlockAccess { } public void notify(int i, int j, int k) { - for (int l = 0; l < this.n.size(); ++l) { - ((IWorldAccess) this.n.get(l)).a(i, j, k); + for (int l = 0; l < this.p.size(); ++l) { + ((IWorldAccess) this.p.get(l)).a(i, j, k); } } @@ -335,14 +343,14 @@ public class World implements IBlockAccess { } public void h(int i, int j, int k) { - for (int l = 0; l < this.n.size(); ++l) { - ((IWorldAccess) this.n.get(l)).a(i, j, k, i, j, k); + for (int l = 0; l < this.p.size(); ++l) { + ((IWorldAccess) this.p.get(l)).a(i, j, k, i, j, k); } } public void b(int i, int j, int k, int l, int i1, int j1) { - for (int k1 = 0; k1 < this.n.size(); ++k1) { - ((IWorldAccess) this.n.get(k1)).a(i, j, k, l, i1, j1); + for (int k1 = 0; k1 < this.p.size(); ++k1) { + ((IWorldAccess) this.p.get(k1)).a(i, j, k, l, i1, j1); } } @@ -356,7 +364,7 @@ public class World implements IBlockAccess { } private void k(int i, int j, int k, int l) { - if (!this.h && !this.isStatic) { + if (!this.j && !this.isStatic) { Block block = Block.byId[this.getTypeId(i, j, k)]; if (block != null) { @@ -421,7 +429,7 @@ public class World implements IBlockAccess { if (j < 0) { return 0; } else if (j >= 128) { - l = 15 - this.e; + l = 15 - this.f; if (l < 0) { l = 0; } @@ -432,7 +440,7 @@ public class World implements IBlockAccess { i &= 15; k &= 15; - return chunk.c(i, j, k, this.e); + return chunk.c(i, j, k, this.f); } } else { return 15; @@ -521,8 +529,8 @@ public class World implements IBlockAccess { chunk.a(enumskyblock, i & 15, j, k & 15, l); - for (int i1 = 0; i1 < this.n.size(); ++i1) { - ((IWorldAccess) this.n.get(i1)).a(i, j, k); + for (int i1 = 0; i1 < this.p.size(); ++i1) { + ((IWorldAccess) this.p.get(i1)).a(i, j, k); } } } @@ -535,7 +543,7 @@ public class World implements IBlockAccess { } public boolean d() { - return this.e < 4; + return this.f < 4; } public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) { @@ -687,29 +695,34 @@ public class World implements IBlockAccess { } public void makeSound(Entity entity, String s, float f, float f1) { - for (int i = 0; i < this.n.size(); ++i) { - ((IWorldAccess) this.n.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); + for (int i = 0; i < this.p.size(); ++i) { + ((IWorldAccess) this.p.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); } } public void makeSound(double d0, double d1, double d2, String s, float f, float f1) { - for (int i = 0; i < this.n.size(); ++i) { - ((IWorldAccess) this.n.get(i)).a(s, d0, d1, d2, f, f1); + for (int i = 0; i < this.p.size(); ++i) { + ((IWorldAccess) this.p.get(i)).a(s, d0, d1, d2, f, f1); } } public void a(String s, int i, int j, int k) { - for (int l = 0; l < this.n.size(); ++l) { - ((IWorldAccess) this.n.get(l)).a(s, i, j, k); + for (int l = 0; l < this.p.size(); ++l) { + ((IWorldAccess) this.p.get(l)).a(s, i, j, k); } } public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) { - for (int i = 0; i < this.n.size(); ++i) { - ((IWorldAccess) this.n.get(i)).a(s, d0, d1, d2, d3, d4, d5); + for (int i = 0; i < this.p.size(); ++i) { + ((IWorldAccess) this.p.get(i)).a(s, d0, d1, d2, d3, d4, d5); } } + public boolean a(Entity entity) { + this.e.add(entity); + return true; + } + public boolean addEntity(Entity entity) { int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); @@ -740,20 +753,20 @@ public class World implements IBlockAccess { this.getChunkAt(i, j).a(entity); this.entityList.add(entity); - this.b(entity); + this.c(entity); return true; } } - protected void b(Entity entity) { - for (int i = 0; i < this.n.size(); ++i) { - ((IWorldAccess) this.n.get(i)).a(entity); + protected void c(Entity entity) { + for (int i = 0; i < this.p.size(); ++i) { + ((IWorldAccess) this.p.get(i)).a(entity); } } - protected void c(Entity entity) { - for (int i = 0; i < this.n.size(); ++i) { - ((IWorldAccess) this.n.get(i)).b(entity); + protected void d(Entity entity) { + for (int i = 0; i < this.p.size(); ++i) { + ((IWorldAccess) this.p.get(i)).b(entity); } } @@ -783,20 +796,20 @@ public class World implements IBlockAccess { int i = entity.chunkX; int j = entity.chunkZ; - if (entity.bA && this.isChunkLoaded(i, j)) { + if (entity.bB && this.isChunkLoaded(i, j)) { this.getChunkAt(i, j).b(entity); } this.entityList.remove(entity); - this.c(entity); + this.d(entity); } public void addIWorldAccess(IWorldAccess iworldaccess) { - this.n.add(iworldaccess); + this.p.add(iworldaccess); } public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) { - this.B.clear(); + this.I.clear(); int i = MathHelper.floor(axisalignedbb.a); int j = MathHelper.floor(axisalignedbb.d + 1.0D); int k = MathHelper.floor(axisalignedbb.b); @@ -811,7 +824,7 @@ public class World implements IBlockAccess { Block block = Block.byId[this.getTypeId(k1, i2, l1)]; if (block != null) { - block.a(this, k1, i2, l1, axisalignedbb, this.B); + block.a(this, k1, i2, l1, axisalignedbb, this.I); } } } @@ -822,19 +835,19 @@ public class World implements IBlockAccess { List list = this.b(entity, axisalignedbb.b(d0, d0, d0)); for (int j2 = 0; j2 < list.size(); ++j2) { - AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).d(); + AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).e_(); if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) { - this.B.add(axisalignedbb1); + this.I.add(axisalignedbb1); } axisalignedbb1 = entity.a_((Entity) list.get(j2)); if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) { - this.B.add(axisalignedbb1); + this.I.add(axisalignedbb1); } } - return this.B; + return this.I; } public int a(float f) { @@ -849,6 +862,10 @@ public class World implements IBlockAccess { f2 = 1.0F; } + f2 = 1.0F - f2; + f2 = (float) ((double) f2 * (1.0D - (double) (this.d(f) * 5.0F) / 16.0D)); + f2 = (float) ((double) f2 * (1.0D - (double) (this.c(f) * 5.0F) / 16.0D)); + f2 = 1.0F - f2; return (int) (f2 * 11.0F); } @@ -858,19 +875,14 @@ public class World implements IBlockAccess { public int e(int i, int j) { Chunk chunk = this.b(i, j); - - int k; - - for (k = 127; this.getMaterial(i, k, j).isSolid() && k > 0; --k) { - ; - } + int k = 127; i &= 15; for (j &= 15; k > 0; --k) { int l = chunk.getTypeId(i, k, j); - if (l != 0 && (Block.byId[l].material.isSolid() || Block.byId[l].material.isLiquid())) { + if (l != 0 && Block.byId[l].material.isSolid()) { return k + 1; } } @@ -896,36 +908,45 @@ public class World implements IBlockAccess { nextticklistentry.a((long) i1 + this.worldData.f()); } - if (!this.x.contains(nextticklistentry)) { - this.x.add(nextticklistentry); - this.w.add(nextticklistentry); + if (!this.z.contains(nextticklistentry)) { + this.z.add(nextticklistentry); + this.y.add(nextticklistentry); } } } } public void cleanUp() { - this.entityList.removeAll(this.v); - int i; Entity entity; + + for (i = 0; i < this.e.size(); ++i) { + entity = (Entity) this.e.get(i); + entity.p_(); + if (entity.dead) { + this.e.remove(i--); + } + } + + this.entityList.removeAll(this.x); + int j; int k; - for (i = 0; i < this.v.size(); ++i) { - entity = (Entity) this.v.get(i); + for (i = 0; i < this.x.size(); ++i) { + entity = (Entity) this.x.get(i); j = entity.chunkX; k = entity.chunkZ; - if (entity.bA && this.isChunkLoaded(j, k)) { + if (entity.bB && this.isChunkLoaded(j, k)) { this.getChunkAt(j, k).b(entity); } } - for (i = 0; i < this.v.size(); ++i) { - this.c((Entity) this.v.get(i)); + for (i = 0; i < this.x.size(); ++i) { + this.d((Entity) this.x.get(i)); } - this.v.clear(); + this.x.clear(); for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); @@ -945,19 +966,19 @@ public class World implements IBlockAccess { if (entity.dead) { j = entity.chunkX; k = entity.chunkZ; - if (entity.bA && this.isChunkLoaded(j, k)) { + if (entity.bB && this.isChunkLoaded(j, k)) { this.getChunkAt(j, k).b(entity); } this.entityList.remove(i--); - this.c(entity); + this.d(entity); } } for (i = 0; i < this.c.size(); ++i) { TileEntity tileentity = (TileEntity) this.c.get(i); - tileentity.i_(); + tileentity.g_(); } } @@ -971,29 +992,29 @@ public class World implements IBlockAccess { byte b0 = 32; if (!flag || this.a(i - b0, 0, j - b0, i + b0, 128, j + b0)) { - entity.bi = entity.locX; - entity.bj = entity.locY; - entity.bk = entity.locZ; + entity.bk = entity.locX; + entity.bl = entity.locY; + entity.bm = entity.locZ; entity.lastYaw = entity.yaw; entity.lastPitch = entity.pitch; - if (flag && entity.bA) { + if (flag && entity.bB) { if (entity.vehicle != null) { - entity.o_(); + entity.B(); } else { - entity.f_(); + entity.p_(); } } if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) { - entity.locX = entity.bi; + entity.locX = entity.bk; } if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) { - entity.locY = entity.bj; + entity.locY = entity.bl; } if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) { - entity.locZ = entity.bk; + entity.locZ = entity.bm; } if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) { @@ -1008,20 +1029,20 @@ public class World implements IBlockAccess { int l = MathHelper.floor(entity.locY / 16.0D); int i1 = MathHelper.floor(entity.locZ / 16.0D); - if (!entity.bA || entity.chunkX != k || entity.bC != l || entity.chunkZ != i1) { - if (entity.bA && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) { - this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.bC); + if (!entity.bB || entity.chunkX != k || entity.bD != l || entity.chunkZ != i1) { + if (entity.bB && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) { + this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.bD); } if (this.isChunkLoaded(k, i1)) { - entity.bA = true; + entity.bB = true; this.getChunkAt(k, i1).a(entity); } else { - entity.bA = false; + entity.bB = false; } } - if (flag && entity.bA && entity.passenger != null) { + if (flag && entity.bB && entity.passenger != null) { if (!entity.passenger.dead && entity.passenger.vehicle == entity) { this.playerJoinedWorld(entity.passenger); } else { @@ -1038,7 +1059,7 @@ public class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - if (!entity.dead && entity.aD) { + if (!entity.dead && entity.aE) { return false; } } @@ -1071,7 +1092,7 @@ public class World implements IBlockAccess { for (int i2 = i1; i2 < j1; ++i2) { Block block = Block.byId[this.getTypeId(k1, l1, i2)]; - if (block != null && block.material.isLiquid()) { + if (block != null) { return true; } } @@ -1089,6 +1110,41 @@ public class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); + if (axisalignedbb.a < 0.0D) { + --i; + } + + if (axisalignedbb.b < 0.0D) { + --k; + } + + if (axisalignedbb.c < 0.0D) { + --i1; + } + + for (int k1 = i; k1 < j; ++k1) { + for (int l1 = k; l1 < l; ++l1) { + for (int i2 = i1; i2 < j1; ++i2) { + Block block = Block.byId[this.getTypeId(k1, l1, i2)]; + + if (block != null && block.material.isLiquid()) { + return true; + } + } + } + } + + return false; + } + + public boolean d(AxisAlignedBB axisalignedbb) { + int i = MathHelper.floor(axisalignedbb.a); + int j = MathHelper.floor(axisalignedbb.d + 1.0D); + int k = MathHelper.floor(axisalignedbb.b); + int l = MathHelper.floor(axisalignedbb.e + 1.0D); + int i1 = MathHelper.floor(axisalignedbb.c); + int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); + if (this.a(i, k, i1, j, l, j1)) { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { @@ -1139,7 +1195,7 @@ public class World implements IBlockAccess { if (vec3d.c() > 0.0D) { vec3d = vec3d.b(); - double d1 = 0.0040D; + double d1 = 0.014D; entity.motX += vec3d.a * d1; entity.motY += vec3d.b * d1; @@ -1214,7 +1270,7 @@ public class World implements IBlockAccess { explosion.a = flag; explosion.a(); - explosion.b(); + explosion.a(true); return explosion; } @@ -1273,32 +1329,31 @@ public class World implements IBlockAccess { } public boolean doLighting() { - if (this.C >= 50) { + if (this.J >= 50) { return false; } else { - ++this.C; - - boolean flag; + ++this.J; try { int i = 500; - while (this.u.size() > 0) { + boolean flag; + + while (this.w.size() > 0) { --i; if (i <= 0) { flag = true; return flag; } - ((MetadataChunkBlock) this.u.remove(this.u.size() - 1)).a(this); + ((MetadataChunkBlock) this.w.remove(this.w.size() - 1)).a(this); } flag = false; + return flag; } finally { - --this.C; + --this.J; } - - return flag; } } @@ -1308,17 +1363,17 @@ public class World implements IBlockAccess { public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l, int i1, int j1, boolean flag) { if (!this.worldProvider.e || enumskyblock != EnumSkyBlock.SKY) { - ++s; - if (s == 50) { - --s; + ++u; + if (u == 50) { + --u; } else { int k1 = (l + i) / 2; int l1 = (j1 + k) / 2; if (!this.isLoaded(k1, 64, l1)) { - --s; + --u; } else if (!this.b(k1, l1).g()) { - int i2 = this.u.size(); + int i2 = this.w.size(); int j2; if (flag) { @@ -1328,23 +1383,23 @@ public class World implements IBlockAccess { } for (int k2 = 0; k2 < j2; ++k2) { - MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.u.get(this.u.size() - k2 - 1); + MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.w.get(this.w.size() - k2 - 1); if (metadatachunkblock.a == enumskyblock && metadatachunkblock.a(i, j, k, l, i1, j1)) { - --s; + --u; return; } } } - this.u.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1)); + this.w.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1)); j2 = 1000000; - if (this.u.size() > 1000000) { + if (this.w.size() > 1000000) { System.out.println("More than " + j2 + " updates, aborting lighting updates"); - this.u.clear(); + this.w.clear(); } - --s; + --u; } } } @@ -1353,8 +1408,8 @@ public class World implements IBlockAccess { public void g() { int i = this.a(1.0F); - if (i != this.e) { - this.e = i; + if (i != this.f) { + this.f = i; } } @@ -1364,6 +1419,7 @@ public class World implements IBlockAccess { } public void doTick() { + this.i(); long i; if (this.everyoneDeeplySleeping()) { @@ -1376,7 +1432,7 @@ public class World implements IBlockAccess { if (!flag) { i = this.worldData.f() + 24000L; this.worldData.a(i - i % 24000L); - this.r(); + this.s(); } } @@ -1389,26 +1445,112 @@ public class World implements IBlockAccess { this.chunkProvider.unloadChunks(); int j = this.a(1.0F); - if (j != this.e) { - this.e = j; + if (j != this.f) { + this.f = j; - for (int k = 0; k < this.n.size(); ++k) { - ((IWorldAccess) this.n.get(k)).a(); + for (int k = 0; k < this.p.size(); ++k) { + ((IWorldAccess) this.p.get(k)).a(); } } i = this.worldData.f() + 1L; - if (i % (long) this.i == 0L) { + if (i % (long) this.k == 0L) { this.save(false, (IProgressUpdate) null); } this.worldData.a(i); this.a(false); - this.i(); + this.j(); + } + + private void x() { + if (this.worldData.l()) { + this.C = 1.0F; + if (this.worldData.j()) { + this.E = 1.0F; + } + } } protected void i() { - this.F.clear(); + if (!this.worldProvider.e) { + if (this.F > 0) { + --this.F; + } + + int i = this.worldData.k(); + + if (i <= 0) { + if (this.worldData.j()) { + this.worldData.b(this.random.nextInt(12000) + 3600); + } else { + this.worldData.b(this.random.nextInt(168000) + 12000); + } + } else { + --i; + this.worldData.b(i); + if (i <= 0) { + this.worldData.a(!this.worldData.j()); + } + } + + int j = this.worldData.m(); + + if (j <= 0) { + if (this.worldData.l()) { + this.worldData.c(this.random.nextInt(12000) + 12000); + } else { + this.worldData.c(this.random.nextInt(168000) + 12000); + } + } else { + --j; + this.worldData.c(j); + if (j <= 0) { + this.worldData.b(!this.worldData.l()); + } + } + + this.B = this.C; + if (this.worldData.l()) { + this.C = (float) ((double) this.C + 0.01D); + } else { + this.C = (float) ((double) this.C - 0.01D); + } + + if (this.C < 0.0F) { + this.C = 0.0F; + } + + if (this.C > 1.0F) { + this.C = 1.0F; + } + + this.D = this.E; + if (this.worldData.j()) { + this.E = (float) ((double) this.E + 0.01D); + } else { + this.E = (float) ((double) this.E - 0.01D); + } + + if (this.E < 0.0F) { + this.E = 0.0F; + } + + if (this.E > 1.0F) { + this.E = 1.0F; + } + } + } + + private void y() { + this.worldData.c(0); + this.worldData.b(false); + this.worldData.b(0); + this.worldData.a(false); + } + + protected void j() { + this.M.clear(); int i; int j; @@ -1424,16 +1566,16 @@ public class World implements IBlockAccess { for (k = -b0; k <= b0; ++k) { for (l = -b0; l <= b0; ++l) { - this.F.add(new ChunkCoordIntPair(k + i, l + j)); + this.M.add(new ChunkCoordIntPair(k + i, l + j)); } } } - if (this.G > 0) { - --this.G; + if (this.N > 0) { + --this.N; } - Iterator iterator = this.F.iterator(); + Iterator iterator = this.M.iterator(); while (iterator.hasNext()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); @@ -1445,9 +1587,9 @@ public class World implements IBlockAccess { int k1; int l1; - if (this.G == 0) { - this.f = this.f * 3 + this.g; - k = this.f >> 2; + if (this.N == 0) { + this.g = this.g * 3 + this.h; + k = this.g >> 2; l = k & 15; j1 = k >> 8 & 15; k1 = k >> 16 & 127; @@ -1459,19 +1601,51 @@ public class World implements IBlockAccess { if (entityhuman1 != null && entityhuman1.d((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D) > 4.0D) { this.makeSound((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F); - this.G = this.random.nextInt(12000) + 6000; + this.N = this.random.nextInt(12000) + 6000; + } + } + } + + if (this.random.nextInt(100000) == 0 && this.v() && this.u()) { + this.g = this.g * 3 + this.h; + k = this.g >> 2; + l = i + (k & 15); + j1 = j + (k >> 8 & 15); + k1 = this.e(l, j1); + if (this.q(l, k1, j1)) { + this.a((Entity) (new EntityWeatherStorm(this, (double) l, (double) k1, (double) j1))); + this.F = 2; + } + } + + int i2; + + if (this.random.nextInt(16) == 0 && this.v()) { + this.g = this.g * 3 + this.h; + k = this.g >> 2; + l = k & 15; + j1 = k >> 8 & 15; + k1 = this.e(l + i, j1 + j); + if (this.getWorldChunkManager().getBiome(l + i, j1 + j).c() && k1 >= 0 && k1 < 128 && chunk.a(EnumSkyBlock.BLOCK, l, k1, j1) < 10) { + l1 = chunk.getTypeId(l, k1 - 1, j1); + i2 = chunk.getTypeId(l, k1, j1); + if (i2 == 0 && Block.SNOW.canPlace(this, l + i, k1, j1 + j) && l1 != 0 && l1 != Block.ICE.id && Block.byId[l1].material.isSolid()) { + this.setTypeId(l + i, k1, j1 + j, Block.SNOW.id); + } + + if (l1 == Block.STATIONARY_WATER.id && chunk.getData(l, k1 - 1, j1) == 0) { + this.setTypeId(l + i, k1 - 1, j1 + j, Block.ICE.id); } } } for (k = 0; k < 80; ++k) { - this.f = this.f * 3 + this.g; - l = this.f >> 2; + this.g = this.g * 3 + this.h; + l = this.g >> 2; j1 = l & 15; k1 = l >> 8 & 15; l1 = l >> 16 & 127; - int i2 = chunk.b[j1 << 11 | k1 << 7 | l1] & 255; - + i2 = chunk.b[j1 << 11 | k1 << 7 | l1] & 255; if (Block.n[i2]) { Block.byId[i2].a(this, j1 + i, l1, k1 + j, this.random); } @@ -1480,9 +1654,9 @@ public class World implements IBlockAccess { } public boolean a(boolean flag) { - int i = this.w.size(); + int i = this.y.size(); - if (i != this.x.size()) { + if (i != this.z.size()) { throw new IllegalStateException("TickNextTick list out of synch"); } else { if (i > 1000) { @@ -1490,14 +1664,14 @@ public class World implements IBlockAccess { } for (int j = 0; j < i; ++j) { - NextTickListEntry nextticklistentry = (NextTickListEntry) this.w.first(); + NextTickListEntry nextticklistentry = (NextTickListEntry) this.y.first(); if (!flag && nextticklistentry.e > this.worldData.f()) { break; } - this.w.remove(nextticklistentry); - this.x.remove(nextticklistentry); + this.y.remove(nextticklistentry); + this.z.remove(nextticklistentry); byte b0 = 8; if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) { @@ -1509,12 +1683,12 @@ public class World implements IBlockAccess { } } - return this.w.size() != 0; + return this.y.size() != 0; } } public List b(Entity entity, AxisAlignedBB axisalignedbb) { - this.H.clear(); + this.O.clear(); int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D); int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D); @@ -1523,12 +1697,12 @@ public class World implements IBlockAccess { for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.isChunkLoaded(i1, j1)) { - this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.H); + this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.O); } } } - return this.H; + return this.O; } public List a(Class oclass, AxisAlignedBB axisalignedbb) { @@ -1554,8 +1728,8 @@ public class World implements IBlockAccess { this.b(i, k).f(); } - for (int l = 0; l < this.n.size(); ++l) { - ((IWorldAccess) this.n.get(l)).a(i, j, k, tileentity); + for (int l = 0; l < this.p.size(); ++l) { + ((IWorldAccess) this.p.get(l)).a(i, j, k, tileentity); } } @@ -1588,12 +1762,12 @@ public class World implements IBlockAccess { this.entityList.add(entity); // CraftBukkit end - this.b((Entity) list.get(i)); + this.c((Entity) list.get(i)); } } public void b(List list) { - this.v.addAll(list); + this.x.addAll(list); } public boolean a(int i, int j, int k, int l, boolean flag) { @@ -1756,8 +1930,8 @@ public class World implements IBlockAccess { return abyte; } - public void j() { - this.p.b(); + public void k() { + this.r.b(); } public void setTime(long i) { @@ -1782,7 +1956,7 @@ public class World implements IBlockAccess { public void a(Entity entity, byte b0) {} - public IChunkProvider n() { + public IChunkProvider o() { return this.chunkProvider; } @@ -1794,16 +1968,16 @@ public class World implements IBlockAccess { } } - public IDataManager o() { - return this.p; + public IDataManager p() { + return this.r; } - public WorldData p() { + public WorldData q() { return this.worldData; } public void everyoneSleeping() { - this.A = !this.players.isEmpty(); + this.H = !this.players.isEmpty(); Iterator iterator = this.players.iterator(); while (iterator.hasNext()) { @@ -1811,7 +1985,7 @@ public class World implements IBlockAccess { // CraftBukkit if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) { - this.A = false; + this.H = false; break; } } @@ -1827,21 +2001,23 @@ public class World implements IBlockAccess { } // CraftBukkit end - protected void r() { - this.A = false; + protected void s() { + this.H = false; Iterator iterator = this.players.iterator(); while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); if (entityhuman.isSleeping()) { - entityhuman.a(false, false, false); + entityhuman.a(false, false, true); } } + + this.y(); } public boolean everyoneDeeplySleeping() { - if (this.A && !this.isStatic) { + if (this.H && !this.isStatic) { Iterator iterator = this.players.iterator(); // CraftBukkit start @@ -1869,4 +2045,34 @@ public class World implements IBlockAccess { return false; } } + + public float c(float f) { + return (this.D + (this.E - this.D) * f) * this.d(f); + } + + public float d(float f) { + return this.B + (this.C - this.B) * f; + } + + public boolean u() { + return (double) this.c(1.0F) > 0.9D; + } + + public boolean v() { + return (double) this.d(1.0F) > 0.2D; + } + + public boolean q(int i, int j, int k) { + if (!this.v()) { + return false; + } else if (!this.isChunkLoaded(i, j, k)) { + return false; + } else if (this.e(i, k) > j) { + return false; + } else { + BiomeBase biomebase = this.getWorldChunkManager().getBiome(i, k); + + return biomebase.c() ? false : biomebase.d(); + } + } } diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java index 233a3974..a07969db 100644 --- a/src/main/java/net/minecraft/server/WorldData.java +++ b/src/main/java/net/minecraft/server/WorldData.java @@ -15,6 +15,10 @@ public class WorldData { private int i; public String name; // CraftBukkit private->public private int k; + private boolean l; + private int m; + private boolean n; + private int o; public WorldData(NBTTagCompound nbttagcompound) { this.a = nbttagcompound.f("RandomSeed"); @@ -26,6 +30,10 @@ public class WorldData { this.g = nbttagcompound.f("SizeOnDisk"); this.name = nbttagcompound.getString("LevelName"); this.k = nbttagcompound.e("version"); + this.m = nbttagcompound.e("rainTime"); + this.l = nbttagcompound.m("raining"); + this.o = nbttagcompound.e("thunderTime"); + this.n = nbttagcompound.m("thundering"); if (nbttagcompound.hasKey("Player")) { this.h = nbttagcompound.k("Player"); this.i = this.h.e("Dimension"); @@ -49,6 +57,10 @@ public class WorldData { this.i = worlddata.i; this.name = worlddata.name; this.k = worlddata.k; + this.m = worlddata.m; + this.l = worlddata.l; + this.o = worlddata.o; + this.n = worlddata.n; } public NBTTagCompound a() { @@ -86,6 +98,10 @@ public class WorldData { nbttagcompound.a("LastPlayed", System.currentTimeMillis()); nbttagcompound.setString("LevelName", this.name); nbttagcompound.a("version", this.k); + nbttagcompound.a("rainTime", this.m); + nbttagcompound.a("raining", this.l); + nbttagcompound.a("thunderTime", this.o); + nbttagcompound.a("thundering", this.n); if (nbttagcompound1 != null) { nbttagcompound.a("Player", nbttagcompound1); } @@ -144,4 +160,36 @@ public class WorldData { public void a(int i) { this.k = i; } + + public boolean j() { + return this.n; + } + + public void a(boolean flag) { + this.n = flag; + } + + public int k() { + return this.o; + } + + public void b(int i) { + this.o = i; + } + + public boolean l() { + return this.l; + } + + public void b(boolean flag) { + this.l = flag; + } + + public int m() { + return this.m; + } + + public void c(int i) { + this.m = i; + } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 805a42ea..553108c5 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -2,7 +2,6 @@ package net.minecraft.server; import java.util.ArrayList; import java.util.List; -import java.util.Random; // CraftBukkit start import org.bukkit.BlockChangeDelegate; @@ -14,10 +13,9 @@ public class WorldServer extends World implements BlockChangeDelegate { public ChunkProviderServer chunkProviderServer; public boolean weirdIsOpCache = false; - public boolean w; + public boolean y; public final MinecraftServer server; // CraftBukkit - private -> public final - private EntityList y = new EntityList(); - public PlayerManager manager; // CraftBukkit + private EntityList A = new EntityList(); public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, long j) { super(idatamanager, s, j, WorldProvider.a(i)); @@ -29,6 +27,7 @@ public class WorldServer extends World implements BlockChangeDelegate { this.manager = new PlayerManager(minecraftserver, this); } + public PlayerManager manager; private final CraftWorld world; private final CraftServer cserver; @@ -58,7 +57,7 @@ public class WorldServer extends World implements BlockChangeDelegate { } protected IChunkProvider b() { - IChunkLoader ichunkloader = this.p.a(this.worldProvider); + IChunkLoader ichunkloader = this.r.a(this.worldProvider); this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.worldProvider.c()); return this.chunkProviderServer; @@ -90,18 +89,27 @@ public class WorldServer extends World implements BlockChangeDelegate { return i1 > this.server.spawnProtection || this.server.serverConfigurationManager.isOp(entityhuman.name); } - protected void b(Entity entity) { - super.b(entity); - this.y.a(entity.id, entity); - } - protected void c(Entity entity) { super.c(entity); - this.y.d(entity.id); + this.A.a(entity.id, entity); + } + + protected void d(Entity entity) { + super.d(entity); + this.A.d(entity.id); } public Entity getEntity(int i) { - return (Entity) this.y.a(i); + return (Entity) this.A.a(i); + } + + public boolean a(Entity entity) { + if (super.a(entity)) { + this.server.serverConfigurationManager.a(entity.locX, entity.locY, entity.locZ, 512.0D, new Packet71Weather(entity)); + return true; + } else { + return false; + } } public void a(Entity entity, byte b0) { @@ -129,6 +137,19 @@ public class WorldServer extends World implements BlockChangeDelegate { } public void saveLevel() { - this.p.e(); + this.r.e(); + } + + protected void i() { + boolean flag = this.v(); + + super.i(); + if (flag != this.v()) { + if (flag) { + this.server.serverConfigurationManager.sendAll(new Packet70Bed(2)); + } else { + this.server.serverConfigurationManager.sendAll(new Packet70Bed(1)); + } + } } } |