diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-14 13:31:10 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-14 13:31:10 +0000 |
commit | 2761b598452d992b05a384528b54298ab1166456 (patch) | |
tree | fae206cadbc7acd2607b42ac9dc3d962dcaa795a /src | |
parent | e6e50ddf9b7cb9fe4fb5e8102acf117db2db6f2a (diff) | |
download | craftbukkit-2761b598452d992b05a384528b54298ab1166456.tar craftbukkit-2761b598452d992b05a384528b54298ab1166456.tar.gz craftbukkit-2761b598452d992b05a384528b54298ab1166456.tar.lz craftbukkit-2761b598452d992b05a384528b54298ab1166456.tar.xz craftbukkit-2761b598452d992b05a384528b54298ab1166456.zip |
Update to Minecraft Server 1.2
Diffstat (limited to 'src')
54 files changed, 1197 insertions, 1042 deletions
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 54cf1fed..1e5c9c85 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -60,18 +60,18 @@ public class BlockButton extends Block { if (l == 5 && world.d(i - 1, j, k)) { i1 = 1; } - world.b(i, j, k, i1 + j1); + world.c(i, j, k, i1 + j1); } public void e(World world, int i, int j, int k) { if (world.d(i - 1, j, k)) { - world.b(i, j, k, 1); + world.c(i, j, k, 1); } else if (world.d(i + 1, j, k)) { - world.b(i, j, k, 2); + world.c(i, j, k, 2); } else if (world.d(i, j, k - 1)) { - world.b(i, j, k, 3); + world.c(i, j, k, 3); } else if (world.d(i, j, k + 1)) { - world.b(i, j, k, 4); + world.c(i, j, k, 4); } g(world, i, j, k); } @@ -95,7 +95,7 @@ public class BlockButton extends Block { } if (flag) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } } } @@ -103,7 +103,7 @@ public class BlockButton extends Block { private boolean g(World world, int i, int j, int k) { if (!a(world, i, j, k)) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); return false; } else { return true; @@ -168,22 +168,22 @@ public class BlockButton extends Block { BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, old, current); ((WorldServer) world).getServer().getPluginManager().callEvent(bre); if ((bre.getNewCurrent() > 0) == (k == 8)) { - world.b(i, j, k, i1 + j1); + world.c(i, j, k, i1 + j1); world.b(i, j, k, i, j, k); world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); - world.g(i, j, k, bh); + world.h(i, j, k, bi); if (i1 == 1) { - world.g(i - 1, j, k, bh); + world.h(i - 1, j, k, bi); } else if (i1 == 2) { - world.g(i + 1, j, k, bh); + world.h(i + 1, j, k, bi); } else if (i1 == 3) { - world.g(i, j, k - 1, bh); + world.h(i, j, k - 1, bi); } else if (i1 == 4) { - world.g(i, j, k + 1, bh); + world.h(i, j, k + 1, bi); } else { - world.g(i, j - 1, k, bh); + world.h(i, j - 1, k, bi); } - world.h(i, j, k, bh); + world.i(i, j, k, bi); } return true; } @@ -192,19 +192,19 @@ public class BlockButton extends Block { int l = world.b(i, j, k); if ((l & 8) > 0) { - world.g(i, j, k, bh); + world.h(i, j, k, bi); int i1 = l & 7; if (i1 == 1) { - world.g(i - 1, j, k, bh); + world.h(i - 1, j, k, bi); } else if (i1 == 2) { - world.g(i + 1, j, k, bh); + world.h(i + 1, j, k, bi); } else if (i1 == 3) { - world.g(i, j, k - 1, bh); + world.h(i, j, k - 1, bi); } else if (i1 == 4) { - world.g(i, j, k + 1, bh); + world.h(i, j, k + 1, bi); } else { - world.g(i, j - 1, k, bh); + world.h(i, j - 1, k, bi); } } super.b(world, i, j, k); @@ -250,20 +250,20 @@ public class BlockButton extends Block { if ((l & 8) == 0) { return; } - world.b(i, j, k, l & 7); - world.g(i, j, k, bh); + world.c(i, j, k, l & 7); + world.h(i, j, k, bi); int i1 = l & 7; if (i1 == 1) { - world.g(i - 1, j, k, bh); + world.h(i - 1, j, k, bi); } else if (i1 == 2) { - world.g(i + 1, j, k, bh); + world.h(i + 1, j, k, bi); } else if (i1 == 3) { - world.g(i, j, k - 1, bh); + world.h(i, j, k - 1, bi); } else if (i1 == 4) { - world.g(i, j, k + 1, bh); + world.h(i, j, k + 1, bi); } else { - world.g(i, j - 1, k, bh); + world.h(i, j - 1, k, bi); } world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); world.b(i, j, k, i, j, k); diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index cd158e34..820849f2 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -23,17 +23,17 @@ public class BlockCactus extends Block { if (world.e(i, j + 1, k)) { int l; - for (l = 1; world.a(i, j - l, k) == bh; l++) { + for (l = 1; world.a(i, j - l, k) == bi; l++) { ; } if (l < 3) { int i1 = world.b(i, j, k); if (i1 == 15) { - world.d(i, j + 1, k, bh); - world.b(i, j, k, 0); + world.e(i, j + 1, k, bi); + world.c(i, j, k, 0); } else { - world.b(i, j, k, i1 + 1); + world.c(i, j, k, i1 + 1); } } } @@ -47,12 +47,12 @@ public class BlockCactus extends Block { public int a(int i) { if (i == 1) { - return bg - 1; + return bh - 1; } if (i == 0) { - return bg + 1; + return bh + 1; } else { - return bg; + return bh; } } @@ -71,7 +71,7 @@ public class BlockCactus extends Block { public void b(World world, int i, int j, int k, int l) { if (!f(world, i, j, k)) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } } @@ -90,7 +90,7 @@ public class BlockCactus extends Block { } else { int l = world.a(i, j - 1, k); - return l == Block.aV.bh || l == Block.E.bh; + return l == Block.aV.bi || l == Block.E.bi; } } diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java index 9c3ad14b..33765d52 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java @@ -16,36 +16,36 @@ public class BlockChest extends BlockContainer { protected BlockChest(int i) { super(i, Material.c); a = new Random(); - bg = 26; + bh = 26; } public int a(int i) { if (i == 1) { - return bg - 1; + return bh - 1; } if (i == 0) { - return bg - 1; + return bh - 1; } if (i == 3) { - return bg + 1; + return bh + 1; } else { - return bg; + return bh; } } public boolean a(World world, int i, int j, int k) { int l = 0; - if (world.a(i - 1, j, k) == bh) { + if (world.a(i - 1, j, k) == bi) { l++; } - if (world.a(i + 1, j, k) == bh) { + if (world.a(i + 1, j, k) == bi) { l++; } - if (world.a(i, j, k - 1) == bh) { + if (world.a(i, j, k - 1) == bi) { l++; } - if (world.a(i, j, k + 1) == bh) { + if (world.a(i, j, k + 1) == bi) { l++; } if (l > 1) { @@ -64,26 +64,26 @@ public class BlockChest extends BlockContainer { } private boolean g(World world, int i, int j, int k) { - if (world.a(i, j, k) != bh) { + if (world.a(i, j, k) != bi) { return false; } - if (world.a(i - 1, j, k) == bh) { + if (world.a(i - 1, j, k) == bi) { return true; } - if (world.a(i + 1, j, k) == bh) { + if (world.a(i + 1, j, k) == bi) { return true; } - if (world.a(i, j, k - 1) == bh) { + if (world.a(i, j, k - 1) == bi) { return true; } - return world.a(i, j, k + 1) == bh; + return world.a(i, j, k + 1) == bi; } public void b(World world, int i, int j, int k) { - TileEntityChest tileentitychest = (TileEntityChest) world.l(i, j, k); + TileEntityChest tileentitychest = (TileEntityChest) world.m(i, j, k); label0: - for (int l = 0; l < ((IInventory) (tileentitychest)).a(); l++) { + for (int l = 0; l < ((IInventory) (tileentitychest)).h_(); l++) { ItemStack itemstack = ((IInventory) (tileentitychest)).a(l); if (itemstack == null) { @@ -103,7 +103,7 @@ public class BlockChest extends BlockContainer { i1 = itemstack.a; } itemstack.a -= i1; - EntityItem entityitem = new EntityItem(world, (float) i + f, (float) j + f1, (float) k + f2, new ItemStack(itemstack.c, i1, itemstack.d)); + EntityItem entityitem = new EntityItem(world, (float) i + f, (float) j + f1, (float) k + f2, new ItemStack(itemstack.c, i1, itemstack.h())); float f3 = 0.05F; entityitem.s = (float) a.nextGaussian() * f3; @@ -117,34 +117,34 @@ public class BlockChest extends BlockContainer { } public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { - Object obj = (((TileEntityChest) world.l(i, j, k))); + Object obj = (((TileEntityChest) world.m(i, j, k))); if (world.d(i, j + 1, k)) { return true; } - if (world.a(i - 1, j, k) == bh && world.d(i - 1, j + 1, k)) { + if (world.a(i - 1, j, k) == bi && world.d(i - 1, j + 1, k)) { return true; } - if (world.a(i + 1, j, k) == bh && world.d(i + 1, j + 1, k)) { + if (world.a(i + 1, j, k) == bi && world.d(i + 1, j + 1, k)) { return true; } - if (world.a(i, j, k - 1) == bh && world.d(i, j + 1, k - 1)) { + if (world.a(i, j, k - 1) == bi && world.d(i, j + 1, k - 1)) { return true; } - if (world.a(i, j, k + 1) == bh && world.d(i, j + 1, k + 1)) { + if (world.a(i, j, k + 1) == bi && world.d(i, j + 1, k + 1)) { return true; } - if (world.a(i - 1, j, k) == bh) { - obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.l(i - 1, j, k))), ((IInventory) (obj))))); + if (world.a(i - 1, j, k) == bi) { + obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.m(i - 1, j, k))), ((IInventory) (obj))))); } - if (world.a(i + 1, j, k) == bh) { - obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.l(i + 1, j, k)))))); + if (world.a(i + 1, j, k) == bi) { + obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.m(i + 1, j, k)))))); } - if (world.a(i, j, k - 1) == bh) { - obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.l(i, j, k - 1))), ((IInventory) (obj))))); + if (world.a(i, j, k - 1) == bi) { + obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.m(i, j, k - 1))), ((IInventory) (obj))))); } - if (world.a(i, j, k + 1) == bh) { - obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.l(i, j, k + 1)))))); + if (world.a(i, j, k + 1) == bi) { + obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.m(i, j, k + 1)))))); } if (world.z) { return true; diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index f06c9f69..d7f46c81 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -13,9 +13,9 @@ public class BlockDoor extends Block { protected BlockDoor(int i, Material material) { super(i, material); - bg = 97; + bh = 97; if (material == Material.e) { - bg++; + bh++; } float f = 0.5F; float f1 = 1.0F; @@ -33,10 +33,10 @@ public class BlockDoor extends Block { } public void a(IBlockAccess iblockaccess, int i, int j, int k) { - b(d(iblockaccess.b(i, j, k))); + c(d(iblockaccess.b(i, j, k))); } - public void b(int i) { + public void c(int i) { float f = 0.1875F; a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); @@ -59,13 +59,13 @@ public class BlockDoor extends Block { } public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { - if (bs == Material.e) { + if (bt == Material.e) { return true; } int l = world.b(i, j, k); if ((l & 8) != 0) { - if (world.a(i, j - 1, k) == bh) { + if (world.a(i, j - 1, k) == bi) { a(world, i, j - 1, k, entityplayer); } return true; @@ -87,10 +87,10 @@ public class BlockDoor extends Block { } // CraftBukkit end - if (world.a(i, j + 1, k) == bh) { - world.b(i, j + 1, k, (l ^ 4) + 8); + if (world.a(i, j + 1, k) == bi) { + world.c(i, j + 1, k, (l ^ 4) + 8); } - world.b(i, j, k, l ^ 4); + world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); @@ -104,7 +104,7 @@ public class BlockDoor extends Block { int l = world.b(i, j, k); if ((l & 8) != 0) { - if (world.a(i, j - 1, k) == bh) { + if (world.a(i, j - 1, k) == bi) { a(world, i, j - 1, k, flag); } return; @@ -114,10 +114,10 @@ public class BlockDoor extends Block { if (flag1 == flag) { return; } - if (world.a(i, j + 1, k) == bh) { - world.b(i, j + 1, k, (l ^ 4) + 8); + if (world.a(i, j + 1, k) == bi) { + world.c(i, j + 1, k, (l ^ 4) + 8); } - world.b(i, j, k, l ^ 4); + world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); @@ -130,8 +130,8 @@ public class BlockDoor extends Block { int i1 = world.b(i, j, k); if ((i1 & 8) != 0) { - if (world.a(i, j - 1, k) != bh) { - world.d(i, j, k, 0); + if (world.a(i, j - 1, k) != bi) { + world.e(i, j, k, 0); } if (l > 0 && Block.m[l].c()) { b(world, i, j - 1, k, l); @@ -139,21 +139,21 @@ public class BlockDoor extends Block { } else { boolean flag = false; - if (world.a(i, j + 1, k) != bh) { - world.d(i, j, k, 0); + if (world.a(i, j + 1, k) != bi) { + world.e(i, j, k, 0); flag = true; } if (!world.d(i, j - 1, k)) { - world.d(i, j, k, 0); + world.e(i, j, k, 0); flag = true; - if (world.a(i, j + 1, k) == bh) { - world.d(i, j + 1, k, 0); + if (world.a(i, j + 1, k) == bi) { + world.e(i, j + 1, k, 0); } } if (flag) { a_(world, i, j, k, i1); } else if (l > 0 && Block.m[l].c()) { - boolean flag1 = world.o(i, j, k) || world.o(i, j + 1, k); + boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k); a(world, i, j, k, flag1); } @@ -164,10 +164,10 @@ public class BlockDoor extends Block { if ((i & 8) != 0) { return 0; } - if (bs == Material.e) { - return Item.az.aW; + if (bt == Material.e) { + return Item.az.ba; } else { - return Item.at.aW; + return Item.at.ba; } } diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index a0871334..6aece4c3 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -15,12 +15,12 @@ public class BlockFire extends Block { super(i, j, Material.l); a = new int[256]; b = new int[256]; - a(Block.x.bh, 5, 20); - a(Block.J.bh, 5, 5); - a(Block.K.bh, 30, 60); - a(Block.an.bh, 30, 20); - a(Block.am.bh, 15, 100); - a(Block.ab.bh, 30, 60); + a(Block.x.bi, 5, 20); + a(Block.J.bi, 5, 5); + a(Block.K.bi, 30, 60); + a(Block.an.bi, 30, 20); + a(Block.am.bi, 15, 100); + a(Block.ab.bi, 30, 60); a(true); } @@ -45,27 +45,25 @@ public class BlockFire extends Block { return 10; } - @Override public void a(World world, int i, int j, int k, Random random) { - boolean flag = world.a(i, j - 1, k) == Block.bb.bh; - int ll = world.b(i, j, k); + boolean flag = world.a(i, j - 1, k) == Block.bb.bi; + int l = world.b(i, j, k); - if (ll < 15) { - world.b(i, j, k, ll + 1); - world.h(i, j, k, bh); + if (l < 15) { + world.c(i, j, k, l + 1); + world.i(i, j, k, bi); } if (!flag && !g(world, i, j, k)) { - if (!world.d(i, j - 1, k) || ll > 3) { - world.d(i, j, k, 0); + if (!world.d(i, j - 1, k) || l > 3) { + world.e(i, j, k, 0); } return; } - // CraftBukkit: Cast to fix compile errors. - if ((i == 0) && (!b((IBlockAccess)world, i, j - 1, k)) && ll == 15 && (random.nextInt(4) == 0)) { - world.d(i, j, k, 0); + if (!flag && !b(((IBlockAccess) (world)), i, j - 1, k) && l == 15 && random.nextInt(4) == 0) { + world.e(i, j, k, 0); return; } - if (ll % 2 == 0 && ll > 2) { + if (l % 2 == 0 && l > 2) { a(world, i + 1, j, k, 300, random); a(world, i - 1, j, k, 300, random); a(world, i, j - 1, k, 250, random); @@ -95,7 +93,7 @@ public class BlockFire extends Block { return; } if (i2 > 0 && random.nextInt(l1) <= i2) { - world.d(i1, k1, j1, bh); + world.e(i1, k1, j1, bi); } } } @@ -107,7 +105,7 @@ public class BlockFire extends Block { int i1 = b[world.a(i, j, k)]; if (random.nextInt(l) < i1) { - boolean flag = world.a(i, j, k) == Block.am.bh ? true : false; + boolean flag = world.a(i, j, k) == Block.am.bi; if (random.nextInt(2) == 0) { // CraftBukkit: Call to stop very slow spread of fire. @@ -119,9 +117,9 @@ public class BlockFire extends Block { if (event.isCancelled()) { return; } - world.d(i, j, k, bh); + world.e(i, j, k, bi); } else { - world.d(i, j, k, 0); + world.e(i, j, k, 0); } if (flag) { Block.am.a(world, i, j, k, 0); @@ -130,23 +128,22 @@ public class BlockFire extends Block { } private boolean g(World world, int i, int j, int k) { - // CraftBukkit: Cast to correct compile errors 6 times. - if (b((IBlockAccess)world, i + 1, j, k)) { + if (b(((IBlockAccess) (world)), i + 1, j, k)) { return true; } - if (b((IBlockAccess)world, i - 1, j, k)) { + if (b(((IBlockAccess) (world)), i - 1, j, k)) { return true; } - if (b((IBlockAccess)world, i, j - 1, k)) { + if (b(((IBlockAccess) (world)), i, j - 1, k)) { return true; } - if (b((IBlockAccess)world, i, j + 1, k)) { + if (b(((IBlockAccess) (world)), i, j + 1, k)) { return true; } - if (b((IBlockAccess)world, i, j, k - 1)) { + if (b(((IBlockAccess) (world)), i, j, k - 1)) { return true; } - return b((IBlockAccess)world, i, j, k + 1); + return b(((IBlockAccess) (world)), i, j, k + 1); } private int h(World world, int i, int j, int k) { @@ -189,7 +186,7 @@ public class BlockFire extends Block { public void b(World world, int i, int j, int k, int l) { if (!world.d(i, j - 1, k) && !g(world, i, j, k)) { - world.d(i, j, k, 0); + world.e(i, j, k, 0); return; } else { return; @@ -197,16 +194,15 @@ public class BlockFire extends Block { } public void e(World world, int i, int j, int k) { - if (world.a(i, j - 1, k) == Block.ap.bh && Block.be.a_(world, i, j, k)) { + if (world.a(i, j - 1, k) == Block.ap.bi && Block.be.b_(world, i, j, k)) { return; } if (!world.d(i, j - 1, k) && !g(world, i, j, k)) { - world.d(i, j, k, 0); + world.e(i, j, k, 0); return; } else { - world.h(i, j, k, bh); + world.i(i, j, k, bi); return; } } -} - +}
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 58a7a417..c4fbfcf5 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -25,7 +25,7 @@ public class BlockFlowing extends BlockFluids { private void i(World world, int i1, int j1, int k1) { int l1 = world.b(i1, j1, k1); - world.a(i1, j1, k1, bh + 1, l1); + world.a(i1, j1, k1, bi + 1, l1); world.b(i1, j1, k1, i1, j1, k1); world.g(i1, j1, k1); } @@ -34,7 +34,7 @@ public class BlockFlowing extends BlockFluids { int l1 = g(world, i1, j1, k1); byte byte0 = 1; - if (bs == Material.g && !world.q.d) { + if (bt == Material.g && !world.q.d) { byte0 = 2; } boolean flag = true; @@ -61,25 +61,25 @@ public class BlockFlowing extends BlockFluids { j2 = l2 + 8; } } - if (a >= 2 && bs == Material.f) { + if (a >= 2 && bt == Material.f) { if (world.d(i1, j1 - 1, k1)) { j2 = 0; - } else if (world.c(i1, j1 - 1, k1) == bs && world.b(i1, j1, k1) == 0) { + } else if (world.c(i1, j1 - 1, k1) == bt && world.b(i1, j1, k1) == 0) { j2 = 0; } } - if (bs == Material.g && l1 < 8 && j2 < 8 && j2 > l1 && random.nextInt(4) != 0) { + if (bt == Material.g && l1 < 8 && j2 < 8 && j2 > l1 && random.nextInt(4) != 0) { j2 = l1; flag = false; } if (j2 != l1) { l1 = j2; if (l1 < 0) { - world.d(i1, j1, k1, 0); + world.e(i1, j1, k1, 0); } else { - world.b(i1, j1, k1, l1); - world.h(i1, j1, k1, bh); - world.g(i1, j1, k1, bh); + world.c(i1, j1, k1, l1); + world.i(i1, j1, k1, bi); + world.h(i1, j1, k1, bi); } } else if (flag) { i(world, i1, j1, k1); @@ -97,9 +97,9 @@ public class BlockFlowing extends BlockFluids { if (!blockFlow.isCancelled()) { if (l1 >= 8) { - world.b(i1, j1 - 1, k1, bh, l1); + world.b(i1, j1 - 1, k1, bi, l1); } else { - world.b(i1, j1 - 1, k1, bh, l1 + 8); + world.b(i1, j1 - 1, k1, bi, l1 + 8); } } // CraftBukkit end @@ -135,17 +135,17 @@ public class BlockFlowing extends BlockFluids { int i2 = world.a(i1, j1, k1); if (i2 > 0) { - if (bs == Material.g) { + if (bt == Material.g) { h(world, i1, j1, k1); } else { Block.m[i2].a_(world, i1, j1, k1, world.b(i1, j1, k1)); } } - world.b(i1, j1, k1, bh, l1); + world.b(i1, j1, k1, bi, l1); } } - private int a(World world, int i1, int j1, int k1, int l1, int i2) { + private int b(World world, int i1, int j1, int k1, int l1, int i2) { int j2 = 1000; for (int k2 = 0; k2 < 4; k2++) { @@ -168,7 +168,7 @@ public class BlockFlowing extends BlockFluids { if (k2 == 3) { j3++; } - if (k(world, l2, i3, j3) || world.c(l2, i3, j3) == bs && world.b(l2, i3, j3) == 0) { + if (k(world, l2, i3, j3) || world.c(l2, i3, j3) == bt && world.b(l2, i3, j3) == 0) { continue; } if (!k(world, l2, i3 - 1, j3)) { @@ -177,7 +177,7 @@ public class BlockFlowing extends BlockFluids { if (l1 >= 4) { continue; } - int k3 = a(world, l2, i3, j3, l1 + 1, k2); + int k3 = b(world, l2, i3, j3, l1 + 1, k2); if (k3 < j2) { j2 = k3; @@ -206,13 +206,13 @@ public class BlockFlowing extends BlockFluids { if (l1 == 3) { j3++; } - if (k(world, j2, i3, j3) || world.c(j2, i3, j3) == bs && world.b(j2, i3, j3) == 0) { + if (k(world, j2, i3, j3) || world.c(j2, i3, j3) == bt && world.b(j2, i3, j3) == 0) { continue; } if (!k(world, j2, i3 - 1, j3)) { c[l1] = 0; } else { - c[l1] = a(world, j2, i3, j3, 1, l1); + c[l1] = b(world, j2, i3, j3, 1, l1); } } @@ -234,13 +234,13 @@ public class BlockFlowing extends BlockFluids { private boolean k(World world, int i1, int j1, int k1) { int l1 = world.a(i1, j1, k1); - if (l1 == Block.aE.bh || l1 == Block.aL.bh || l1 == Block.aD.bh || l1 == Block.aF.bh || l1 == Block.aX.bh) { + if (l1 == Block.aE.bi || l1 == Block.aL.bi || l1 == Block.aD.bi || l1 == Block.aF.bi || l1 == Block.aX.bi) { return true; } if (l1 == 0) { return false; } - Material material = Block.m[l1].bs; + Material material = Block.m[l1].bt; return material.a(); } @@ -263,7 +263,7 @@ public class BlockFlowing extends BlockFluids { private boolean l(World world, int i1, int j1, int k1) { Material material = world.c(i1, j1, k1); - if (material == bs) { + if (material == bt) { return false; } if (material == Material.g) { @@ -275,8 +275,8 @@ public class BlockFlowing extends BlockFluids { public void e(World world, int i1, int j1, int k1) { super.e(world, i1, j1, k1); - if (world.a(i1, j1, k1) == bh) { - world.h(i1, j1, k1, bh); + if (world.a(i1, j1, k1) == bi) { + world.i(i1, j1, k1, bi); } } } diff --git a/src/main/java/net/minecraft/server/BlockFurnace.java b/src/main/java/net/minecraft/server/BlockFurnace.java index 77c7e0dc..4435bdb3 100644 --- a/src/main/java/net/minecraft/server/BlockFurnace.java +++ b/src/main/java/net/minecraft/server/BlockFurnace.java @@ -16,11 +16,11 @@ public class BlockFurnace extends BlockContainer { protected BlockFurnace(int i, boolean flag) { super(i, Material.d); a = flag; - bg = 45; + bh = 45; } public int a(int i, Random random) { - return Block.aB.bh; + return Block.aB.bi; } public void e(World world, int i, int j, int k) { @@ -47,20 +47,20 @@ public class BlockFurnace extends BlockContainer { if (Block.o[k1] && !Block.o[j1]) { byte0 = 4; } - world.b(i, j, k, ((int) (byte0))); + world.c(i, j, k, ((int) (byte0))); } public int a(int i) { if (i == 1) { - return Block.t.bh; + return bh + 17; } if (i == 0) { - return Block.t.bh; + return bh + 17; } if (i == 3) { - return bg - 1; + return bh - 1; } else { - return bg; + return bh; } } @@ -78,7 +78,7 @@ public class BlockFurnace extends BlockContainer { if (bie.isCancelled()) return true; // CraftBukkit end - TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.l(i, j, k); + TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.m(i, j, k); entityplayer.a(tileentityfurnace); return true; @@ -87,14 +87,14 @@ public class BlockFurnace extends BlockContainer { public static void a(boolean flag, World world, int i, int j, int k) { int l = world.b(i, j, k); - TileEntity tileentity = world.l(i, j, k); + TileEntity tileentity = world.m(i, j, k); if (flag) { - world.d(i, j, k, Block.aC.bh); + world.e(i, j, k, Block.aC.bi); } else { - world.d(i, j, k, Block.aB.bh); + world.e(i, j, k, Block.aB.bi); } - world.b(i, j, k, l); + world.c(i, j, k, l); world.a(i, j, k, tileentity); } @@ -106,16 +106,16 @@ public class BlockFurnace extends BlockContainer { int l = MathHelper.b((double) ((entityliving.v * 4F) / 360F) + 0.5D) & 3; if (l == 0) { - world.b(i, j, k, 2); + world.c(i, j, k, 2); } if (l == 1) { - world.b(i, j, k, 5); + world.c(i, j, k, 5); } if (l == 2) { - world.b(i, j, k, 3); + world.c(i, j, k, 3); } if (l == 3) { - world.b(i, j, k, 4); + world.c(i, j, k, 4); } } } diff --git a/src/main/java/net/minecraft/server/BlockJukeBox.java b/src/main/java/net/minecraft/server/BlockJukeBox.java index eafdcc55..91c37d61 100644 --- a/src/main/java/net/minecraft/server/BlockJukeBox.java +++ b/src/main/java/net/minecraft/server/BlockJukeBox.java @@ -14,7 +14,7 @@ public class BlockJukeBox extends Block { } public int a(int i) { - return bg + (i != 1 ? 0 : 1); + return bh + (i != 1 ? 0 : 1); } public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { @@ -40,13 +40,13 @@ public class BlockJukeBox extends Block { public void f(World world, int i, int j, int k, int l) { world.a(((String) (null)), i, j, k); - world.b(i, j, k, 0); - int i1 = (Item.aU.aW + l) - 1; + world.c(i, j, k, 0); + int i1 = (Item.aY.ba + l) - 1; float f1 = 0.7F; double d = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D; double d1 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.20000000000000001D + 0.59999999999999998D; double d2 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D; - EntityItem entityitem = new EntityItem(world, (double) i + d, (double) j + d1, (double) k + d2, new ItemStack(i1)); + EntityItem entityitem = new EntityItem(world, (double) i + d, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0)); entityitem.c = 10; world.a(((Entity) (entityitem))); diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index efbf2a10..1bf3eb1b 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -30,8 +30,10 @@ public class BlockLeaves extends BlockLeavesBase { for (int l1 = -l; l1 <= l; l1++) { int i2 = world.a(i + j1, j + k1, k + l1); - if (i2 == Block.K.bh) { - world.c(i + j1, j + k1, k + l1, 7); + if (i2 == Block.K.bi) { + int j2 = world.b(i + j1, j + k1, k + l1); + + world.d(i + j1, j + k1, k + l1, j2 | 4); } } } @@ -43,69 +45,71 @@ public class BlockLeaves extends BlockLeavesBase { if (world.z) { return; } - if (world.b(i, j, k) == 7) { + int l = world.b(i, j, k); + + if ((l & 4) != 0) { byte byte0 = 4; - int l = byte0 + 1; + int i1 = byte0 + 1; byte byte1 = 32; - int i1 = byte1 * byte1; - int j1 = byte1 / 2; + int j1 = byte1 * byte1; + int k1 = byte1 / 2; if (b == null) { b = new int[byte1 * byte1 * byte1]; } - if (world.a(i - l, j - l, k - l, i + l, j + l, k + l)) { - for (int k1 = -byte0; k1 <= byte0; k1++) { - for (int j2 = -byte0; j2 <= byte0; j2++) { - for (int l2 = -byte0; l2 <= byte0; l2++) { - int j3 = world.a(i + k1, j + j2, k + l2); - - if (j3 == Block.J.bh) { - b[(k1 + j1) * i1 + (j2 + j1) * byte1 + (l2 + j1)] = 0; + if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) { + for (int l1 = -byte0; l1 <= byte0; l1++) { + for (int k2 = -byte0; k2 <= byte0; k2++) { + for (int i3 = -byte0; i3 <= byte0; i3++) { + int k3 = world.a(i + l1, j + k2, k + i3); + + if (k3 == Block.J.bi) { + b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = 0; continue; } - if (j3 == Block.K.bh) { - b[(k1 + j1) * i1 + (j2 + j1) * byte1 + (l2 + j1)] = -2; + if (k3 == Block.K.bi) { + b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -2; } else { - b[(k1 + j1) * i1 + (j2 + j1) * byte1 + (l2 + j1)] = -1; + b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -1; } } } } - for (int l1 = 1; l1 <= 4; l1++) { - for (int k2 = -byte0; k2 <= byte0; k2++) { - for (int i3 = -byte0; i3 <= byte0; i3++) { - for (int k3 = -byte0; k3 <= byte0; k3++) { - if (b[(k2 + j1) * i1 + (i3 + j1) * byte1 + (k3 + j1)] != l1 - 1) { + for (int i2 = 1; i2 <= 4; i2++) { + for (int l2 = -byte0; l2 <= byte0; l2++) { + for (int j3 = -byte0; j3 <= byte0; j3++) { + for (int l3 = -byte0; l3 <= byte0; l3++) { + if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] != i2 - 1) { continue; } - if (b[((k2 + j1) - 1) * i1 + (i3 + j1) * byte1 + (k3 + j1)] == -2) { - b[((k2 + j1) - 1) * i1 + (i3 + j1) * byte1 + (k3 + j1)] = l1; + if (b[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { + b[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } - if (b[(k2 + j1 + 1) * i1 + (i3 + j1) * byte1 + (k3 + j1)] == -2) { - b[(k2 + j1 + 1) * i1 + (i3 + j1) * byte1 + (k3 + j1)] = l1; + if (b[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { + b[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } - if (b[(k2 + j1) * i1 + ((i3 + j1) - 1) * byte1 + (k3 + j1)] == -2) { - b[(k2 + j1) * i1 + ((i3 + j1) - 1) * byte1 + (k3 + j1)] = l1; + if (b[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] == -2) { + b[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] = i2; } - if (b[(k2 + j1) * i1 + (i3 + j1 + 1) * byte1 + (k3 + j1)] == -2) { - b[(k2 + j1) * i1 + (i3 + j1 + 1) * byte1 + (k3 + j1)] = l1; + if (b[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] == -2) { + b[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] = i2; } - if (b[(k2 + j1) * i1 + (i3 + j1) * byte1 + ((k3 + j1) - 1)] == -2) { - b[(k2 + j1) * i1 + (i3 + j1) * byte1 + ((k3 + j1) - 1)] = l1; + if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] == -2) { + b[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] = i2; } - if (b[(k2 + j1) * i1 + (i3 + j1) * byte1 + (k3 + j1 + 1)] == -2) { - b[(k2 + j1) * i1 + (i3 + j1) * byte1 + (k3 + j1 + 1)] = l1; + if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] == -2) { + b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] = i2; } } } } } } - int i2 = b[j1 * i1 + j1 * byte1 + j1]; + int j2 = b[k1 * j1 + k1 * byte1 + k1]; - if (i2 >= 0) { - world.b(i, j, k, 0); + if (j2 >= 0) { + world.c(i, j, k, l & -5); } else { g(world, i, j, k); } @@ -123,7 +127,7 @@ public class BlockLeaves extends BlockLeavesBase { // CraftBukkit end a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } public int a(Random random) { @@ -131,7 +135,7 @@ public class BlockLeaves extends BlockLeavesBase { } public int a(int i, Random random) { - return Block.y.bh; + return Block.y.bi; } public boolean a() { diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java index d8f264c2..30ee8f5d 100644 --- a/src/main/java/net/minecraft/server/BlockLever.java +++ b/src/main/java/net/minecraft/server/BlockLever.java @@ -59,20 +59,20 @@ public class BlockLever extends Block { if (l == 5 && world.d(i - 1, j, k)) { i1 = 1; } - world.b(i, j, k, i1 + j1); + world.c(i, j, k, i1 + j1); } public void e(World world, int i, int j, int k) { if (world.d(i - 1, j, k)) { - world.b(i, j, k, 1); + world.c(i, j, k, 1); } else if (world.d(i + 1, j, k)) { - world.b(i, j, k, 2); + world.c(i, j, k, 2); } else if (world.d(i, j, k - 1)) { - world.b(i, j, k, 3); + world.c(i, j, k, 3); } else if (world.d(i, j, k + 1)) { - world.b(i, j, k, 4); + world.c(i, j, k, 4); } else if (world.d(i, j - 1, k)) { - world.b(i, j, k, 5 + world.l.nextInt(2)); + world.c(i, j, k, 5 + world.l.nextInt(2)); } g(world, i, j, k); } @@ -99,7 +99,7 @@ public class BlockLever extends Block { } if (flag) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } } } @@ -107,7 +107,7 @@ public class BlockLever extends Block { private boolean g(World world, int i, int j, int k) { if (!a(world, i, j, k)) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); return false; } else { return true; @@ -161,26 +161,28 @@ public class BlockLever extends Block { int i1 = l & 7; int j1 = 8 - (l & 8); - //Allow the lever to change the current + // Craftbukkit start int old = (j1 != 8) ? 1 : 0; int current = (j1 == 8) ? 1 : 0; BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, old, current); ((WorldServer) world).getServer().getPluginManager().callEvent(bre); + // Craftbukkit end + if ((bre.getNewCurrent() > 0) == (k == 8)) { - world.b(i, j, k, i1 + j1); + world.c(i, j, k, i1 + j1); world.b(i, j, k, i, j, k); world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 <= 0 ? 0.5F : 0.6F); - world.g(i, j, k, bh); + world.h(i, j, k, bi); if (i1 == 1) { - world.g(i - 1, j, k, bh); + world.h(i - 1, j, k, bi); } else if (i1 == 2) { - world.g(i + 1, j, k, bh); + world.h(i + 1, j, k, bi); } else if (i1 == 3) { - world.g(i, j, k - 1, bh); + world.h(i, j, k - 1, bi); } else if (i1 == 4) { - world.g(i, j, k + 1, bh); + world.h(i, j, k + 1, bi); } else { - world.g(i, j - 1, k, bh); + world.h(i, j - 1, k, bi); } } return true; @@ -190,19 +192,19 @@ public class BlockLever extends Block { int l = world.b(i, j, k); if ((l & 8) > 0) { - world.g(i, j, k, bh); + world.h(i, j, k, bi); int i1 = l & 7; if (i1 == 1) { - world.g(i - 1, j, k, bh); + world.h(i - 1, j, k, bi); } else if (i1 == 2) { - world.g(i + 1, j, k, bh); + world.h(i + 1, j, k, bi); } else if (i1 == 3) { - world.g(i, j, k - 1, bh); + world.h(i, j, k - 1, bi); } else if (i1 == 4) { - world.g(i, j, k + 1, bh); + world.h(i, j, k + 1, bi); } else { - world.g(i, j - 1, k, bh); + world.h(i, j - 1, k, bi); } } super.b(world, i, j, k); diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index 3e228536..05d24587 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -41,8 +41,7 @@ public class BlockPressurePlate extends Block { return world.d(i, j - 1, k); } - public void e(World world, int i, int j, int k) { - } + public void e(World world, int i, int j, int k) {} public void b(World world, int i, int j, int k, int l) { boolean flag = false; @@ -52,7 +51,7 @@ public class BlockPressurePlate extends Block { } if (flag) { a_(world, i, j, k, world.b(i, j, k)); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } } @@ -118,26 +117,30 @@ public class BlockPressurePlate extends Block { if (list.size() > 0) { flag1 = true; } + + // Craftbukkit start CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, flag ? 15 : 0, flag1 ? 15 : 0); ((WorldServer) world).getServer().getPluginManager().callEvent(bre); flag1 = bre.getNewCurrent() > 0; + // Craftbukkit end + if (flag1 && !flag) { - world.b(i, j, k, 1); - world.g(i, j, k, bh); - world.g(i, j - 1, k, bh); + world.c(i, j, k, 1); + world.h(i, j, k, bi); + world.h(i, j - 1, k, bi); world.b(i, j, k, i, j, k); world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); } if (!flag1 && flag) { - world.b(i, j, k, 0); - world.g(i, j, k, bh); - world.g(i, j - 1, k, bh); + world.c(i, j, k, 0); + world.h(i, j, k, bi); + world.h(i, j - 1, k, bi); world.b(i, j, k, i, j, k); world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); } if (flag1) { - world.h(i, j, k, bh); + world.i(i, j, k, bi); } } @@ -145,8 +148,8 @@ public class BlockPressurePlate extends Block { int l = world.b(i, j, k); if (l > 0) { - world.g(i, j, k, bh); - world.g(i, j - 1, k, bh); + world.h(i, j, k, bi); + world.h(i, j - 1, k, bi); } super.b(world, i, j, k); } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java index 366e2876..f25dde74 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -43,23 +43,23 @@ public class BlockRedstoneTorch extends BlockTorch { super.e(world, i, j, k); } if (a) { - world.g(i, j - 1, k, bh); - world.g(i, j + 1, k, bh); - world.g(i - 1, j, k, bh); - world.g(i + 1, j, k, bh); - world.g(i, j, k - 1, bh); - world.g(i, j, k + 1, bh); + world.h(i, j - 1, k, bi); + world.h(i, j + 1, k, bi); + world.h(i - 1, j, k, bi); + world.h(i + 1, j, k, bi); + world.h(i, j, k - 1, bi); + world.h(i, j, k + 1, bi); } } public void b(World world, int i, int j, int k) { if (a) { - world.g(i, j - 1, k, bh); - world.g(i, j + 1, k, bh); - world.g(i - 1, j, k, bh); - world.g(i + 1, j, k, bh); - world.g(i, j, k - 1, bh); - world.g(i, j, k + 1, bh); + world.h(i, j - 1, k, bi); + world.h(i, j + 1, k, bi); + world.h(i - 1, j, k, bi); + world.h(i + 1, j, k, bi); + world.h(i, j, k - 1, bi); + world.h(i, j, k + 1, bi); } } @@ -87,19 +87,19 @@ public class BlockRedstoneTorch extends BlockTorch { private boolean g(World world, int i, int j, int k) { int l = world.b(i, j, k); - if (l == 5 && world.j(i, j - 1, k, 0)) { + if (l == 5 && world.k(i, j - 1, k, 0)) { return true; } - if (l == 3 && world.j(i, j, k - 1, 2)) { + if (l == 3 && world.k(i, j, k - 1, 2)) { return true; } - if (l == 4 && world.j(i, j, k + 1, 3)) { + if (l == 4 && world.k(i, j, k + 1, 3)) { return true; } - if (l == 1 && world.j(i - 1, j, k, 4)) { + if (l == 1 && world.k(i - 1, j, k, 4)) { return true; } - return l == 2 && world.j(i + 1, j, k, 5); + return l == 2 && world.k(i + 1, j, k, 5); } public void a(World world, int i, int j, int k, Random random) { @@ -108,17 +108,19 @@ public class BlockRedstoneTorch extends BlockTorch { for (; b.size() > 0 && world.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L; b.remove(0)) { ; } - //Added by craftbukkit + + // Craftbukkit start CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, flag ? 15 : 0, flag ? 0 : 15); ((WorldServer) world).getServer().getPluginManager().callEvent(bre); if ((bre.getNewCurrent() != 0) == flag) { return; } + // Craftbukkit end + if (a) { if (flag) { - world.b(i, j, k, Block.aP.bh, world.b(i, j, k)); - + world.b(i, j, k, Block.aP.bi, world.b(i, j, k)); if (a(world, i, j, k, true)) { world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F); for (int l = 0; l < 5; l++) { @@ -130,16 +132,14 @@ public class BlockRedstoneTorch extends BlockTorch { } } } - } else if (!flag - && !a(world, i, j, k, - false)) { - world.b(i, j, k, Block.aQ.bh, world.b(i, j, k)); + } else if (!flag && !a(world, i, j, k, false)) { + world.b(i, j, k, Block.aQ.bi, world.b(i, j, k)); } } public void b(World world, int i, int j, int k, int l) { super.b(world, i, j, k, l); - world.h(i, j, k, bh); + world.i(i, j, k, bi); } public boolean d(World world, int i, int j, int k, int l) { @@ -151,7 +151,7 @@ public class BlockRedstoneTorch extends BlockTorch { } public int a(int i, Random random) { - return Block.aQ.bh; + return Block.aQ.bi; } public boolean c() { diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java index 3548570d..ffdd6954 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -1,6 +1,10 @@ package net.minecraft.server; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import java.util.Random; +import java.util.Set; import org.bukkit.BlockFace; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.event.block.BlockRedstoneEvent; @@ -9,10 +13,12 @@ import org.bukkit.plugin.PluginLoader; public class BlockRedstoneWire extends Block { private boolean a; + private Set b; public BlockRedstoneWire(int i, int j) { super(i, j, Material.n); a = true; + b = ((Set) (new HashSet())); a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); } @@ -29,115 +35,142 @@ public class BlockRedstoneWire extends Block { } private void g(World world, int i, int j, int k) { - int l = world.b(i, j, k); - int i1 = 0; + a(world, i, j, k, i, j, k); + ArrayList arraylist = new ArrayList(((java.util.Collection) (b))); + + b.clear(); + for (int l = 0; l < ((List) (arraylist)).size(); l++) { + ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(l); + + world.h(chunkposition.a, chunkposition.b, chunkposition.c, bi); + } + } + + private void a(World world, int i, int j, int k, int l, int i1, int j1) { + int k1 = world.b(i, j, k); + int l1 = 0; a = false; - boolean flag = world.o(i, j, k); + boolean flag = world.p(i, j, k); a = true; if (flag) { - i1 = 15; + l1 = 15; } else { - for (int j1 = 0; j1 < 4; j1++) { - int l1 = i; - int j2 = k; + for (int i2 = 0; i2 < 4; i2++) { + int k2 = i; + int i3 = k; - if (j1 == 0) { - l1--; + if (i2 == 0) { + k2--; + } + if (i2 == 1) { + k2++; } - if (j1 == 1) { - l1++; + if (i2 == 2) { + i3--; } - if (j1 == 2) { - j2--; + if (i2 == 3) { + i3++; } - if (j1 == 3) { - j2++; + if (k2 != l || j != i1 || i3 != j1) { + l1 = f(world, k2, j, i3, l1); } - i1 = f(world, l1, j, j2, i1); - if (world.d(l1, j, j2) && !world.d(i, j + 1, k)) { - i1 = f(world, l1, j + 1, j2, i1); + if (world.d(k2, j, i3) && !world.d(i, j + 1, k)) { + if (k2 != l || j + 1 != i1 || i3 != j1) { + l1 = f(world, k2, j + 1, i3, l1); + } continue; } - if (!world.d(l1, j, j2)) { - i1 = f(world, l1, j - 1, j2, i1); + if (!world.d(k2, j, i3) && (k2 != l || j - 1 != i1 || i3 != j1)) { + l1 = f(world, k2, j - 1, i3, l1); } } - if (i1 > 0) { - i1--; + if (l1 > 0) { + l1--; } else { - i1 = 0; + l1 = 0; } } - //Allow redstone wire current changes - if (l != i1) { + + // Craftbukkit start + if (k1 != l1) { CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); - BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, l, i1); + BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.Self, k1, l1); ((WorldServer) world).getServer().getPluginManager().callEvent(bre); - i1 = bre.getNewCurrent(); + l1 = bre.getNewCurrent(); } - if (l != i1) { - world.b(i, j, k, i1); + // Craftbukkit end + + if (k1 != l1) { + world.i = true; + world.c(i, j, k, l1); world.b(i, j, k, i, j, k); - if (i1 > 0) { - i1--; - } - for (int k1 = 0; k1 < 4; k1++) { - int i2 = i; - int k2 = k; - int l2 = j - 1; + world.i = false; + for (int j2 = 0; j2 < 4; j2++) { + int l2 = i; + int j3 = k; + int k3 = j - 1; - if (k1 == 0) { - i2--; + if (j2 == 0) { + l2--; } - if (k1 == 1) { - i2++; + if (j2 == 1) { + l2++; } - if (k1 == 2) { - k2--; + if (j2 == 2) { + j3--; } - if (k1 == 3) { - k2++; + if (j2 == 3) { + j3++; } - if (world.d(i2, j, k2)) { - l2 += 2; + if (world.d(l2, j, j3)) { + k3 += 2; } - int i3 = f(world, i2, j, k2, -1); + int l3 = 0; - if (i3 >= 0 && i3 != i1) { - g(world, i2, j, k2); + l3 = f(world, l2, j, j3, -1); + l1 = world.b(i, j, k); + if (l1 > 0) { + l1--; + } + if (l3 >= 0 && l3 != l1) { + a(world, l2, j, j3, i, j, k); + } + l3 = f(world, l2, k3, j3, -1); + l1 = world.b(i, j, k); + if (l1 > 0) { + l1--; } - i3 = f(world, i2, l2, k2, -1); - if (i3 >= 0 && i3 != i1) { - g(world, i2, l2, k2); + if (l3 >= 0 && l3 != l1) { + a(world, l2, k3, j3, i, j, k); } } - if (l == 0 || i1 == 0) { - world.g(i, j, k, bh); - world.g(i - 1, j, k, bh); - world.g(i + 1, j, k, bh); - world.g(i, j, k - 1, bh); - world.g(i, j, k + 1, bh); - world.g(i, j - 1, k, bh); - world.g(i, j + 1, k, bh); + if (k1 == 0 || l1 == 0) { + b.add(((new ChunkPosition(i, j, k)))); + b.add(((new ChunkPosition(i - 1, j, k)))); + b.add(((new ChunkPosition(i + 1, j, k)))); + b.add(((new ChunkPosition(i, j - 1, k)))); + b.add(((new ChunkPosition(i, j + 1, k)))); + b.add(((new ChunkPosition(i, j, k - 1)))); + b.add(((new ChunkPosition(i, j, k + 1)))); } } } private void h(World world, int i, int j, int k) { - if (world.a(i, j, k) != bh) { + if (world.a(i, j, k) != bi) { return; } else { - world.g(i, j, k, bh); - world.g(i - 1, j, k, bh); - world.g(i + 1, j, k, bh); - world.g(i, j, k - 1, bh); - world.g(i, j, k + 1, bh); - world.g(i, j - 1, k, bh); - world.g(i, j + 1, k, bh); + world.h(i, j, k, bi); + world.h(i - 1, j, k, bi); + world.h(i + 1, j, k, bi); + world.h(i, j, k - 1, bi); + world.h(i, j, k + 1, bi); + world.h(i, j - 1, k, bi); + world.h(i, j + 1, k, bi); return; } } @@ -148,8 +181,8 @@ public class BlockRedstoneWire extends Block { return; } g(world, i, j, k); - world.g(i, j + 1, k, bh); - world.g(i, j - 1, k, bh); + world.h(i, j + 1, k, bi); + world.h(i, j - 1, k, bi); h(world, i - 1, j, k); h(world, i + 1, j, k); h(world, i, j, k - 1); @@ -181,8 +214,8 @@ public class BlockRedstoneWire extends Block { if (world.z) { return; } - world.g(i, j + 1, k, bh); - world.g(i, j - 1, k, bh); + world.h(i, j + 1, k, bi); + world.h(i, j - 1, k, bi); g(world, i, j, k); h(world, i - 1, j, k); h(world, i + 1, j, k); @@ -211,7 +244,7 @@ public class BlockRedstoneWire extends Block { } private int f(World world, int i, int j, int k, int l) { - if (world.a(i, j, k) != bh) { + if (world.a(i, j, k) != bi) { return l; } int i1 = world.b(i, j, k); @@ -232,7 +265,7 @@ public class BlockRedstoneWire extends Block { if (!flag) { a_(world, i, j, k, i1); - world.d(i, j, k, 0); + world.e(i, j, k, 0); } else { g(world, i, j, k); } @@ -240,7 +273,7 @@ public class BlockRedstoneWire extends Block { } public int a(int i, Random random) { - return Item.aA.aW; + return Item.aA.ba; } public boolean d(World world, int i, int j, int k, int l) { @@ -302,7 +335,7 @@ public class BlockRedstoneWire extends Block { public static boolean b(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.a(i, j, k); - if (l == Block.av.bh) { + if (l == Block.av.bi) { return true; } if (l == 0) { diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java index 452449aa..1a0d81a7 100644 --- a/src/main/java/net/minecraft/server/BlockStationary.java +++ b/src/main/java/net/minecraft/server/BlockStationary.java @@ -17,7 +17,7 @@ public class BlockStationary extends BlockFluids { public void b(World world, int k, int l, int i1, int j1) { super.b(world, k, l, i1, j1); - if (world.a(k, l, i1) == bh) { + if (world.a(k, l, i1) == bi) { i(world, k, l, i1); } } @@ -26,41 +26,42 @@ public class BlockStationary extends BlockFluids { int j1 = world.b(k, l, i1); world.i = true; - world.a(k, l, i1, bh - 1, j1); + world.a(k, l, i1, bi - 1, j1); world.b(k, l, i1, k, l, i1); - world.h(k, l, i1, bh - 1); + world.h(k, l, i1, bi - 1); world.i = false; } - @Override public void a(World world, int k, int l, int i1, Random random) { - if (bs == Material.g) { + if (bt == Material.g) { int j1 = random.nextInt(3); - // CraftBukkit: prevent lava putting something on fire. + + // Craftbukkit start: prevent lava putting something on fire. CraftServer server = ((WorldServer)world).getServer(); CraftWorld cworld = ((WorldServer)world).getWorld(); org.bukkit.Block bblock = (cworld.getBlockAt(k, l, i1)); BlockIgniteEvent event = new BlockIgniteEvent((org.bukkit.Block) bblock, BlockIgniteEvent.IgniteCause.LAVA, null); server.getPluginManager().callEvent(event); if (event.isCancelled()) { - ; - } else { - for (int k1 = 0; k1 < j1; k1++) { - k += random.nextInt(3) - 1; - l++; - i1 += random.nextInt(3) - 1; - int l1 = world.a(k, l, i1); + return; + } + // Craftbukkit end - if (l1 == 0) { - if (j(world, k - 1, l, i1) || j(world, k + 1, l, i1) || j(world, k, l, i1 - 1) || j(world, k, l, i1 + 1) || j(world, k, l - 1, i1) || j(world, k, l + 1, i1)) { - world.d(k, l, i1, Block.ar.bh); - return; - } - continue; - } - if (Block.m[l1].bs.c()) { + for (int k1 = 0; k1 < j1; k1++) { + k += random.nextInt(3) - 1; + l++; + i1 += random.nextInt(3) - 1; + int l1 = world.a(k, l, i1); + + if (l1 == 0) { + if (j(world, k - 1, l, i1) || j(world, k + 1, l, i1) || j(world, k, l, i1 - 1) || j(world, k, l, i1 + 1) || j(world, k, l - 1, i1) || j(world, k, l + 1, i1)) { + world.e(k, l, i1, Block.ar.bi); return; } + continue; + } + if (Block.m[l1].bt.c()) { + return; } } } diff --git a/src/main/java/net/minecraft/server/BlockWorkbench.java b/src/main/java/net/minecraft/server/BlockWorkbench.java index 4ef0e564..9a23565d 100644 --- a/src/main/java/net/minecraft/server/BlockWorkbench.java +++ b/src/main/java/net/minecraft/server/BlockWorkbench.java @@ -11,20 +11,20 @@ public class BlockWorkbench extends Block { protected BlockWorkbench(int i) { super(i, Material.c); - bg = 59; + bh = 59; } public int a(int i) { if (i == 1) { - return bg - 16; + return bh - 16; } if (i == 0) { return Block.x.a(0); } if (i == 2 || i == 4) { - return bg + 1; + return bh + 1; } else { - return bg; + return bh; } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 917d116b..60516dac 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -25,9 +25,7 @@ public class ChunkProviderServer implements IChunkProvider { a = ((Set) (new HashSet())); e = ((Map) (new HashMap())); f = ((List) (new ArrayList())); - b = new Chunk(((World) (worldserver)), new byte[32768], 0, 0); - b.q = true; - b.p = true; + b = ((Chunk) (new EmptyChunk(((World) (worldserver)), new byte[32768], 0, 0))); g = worldserver; d = ichunkloader; c = ichunkprovider; @@ -66,8 +64,8 @@ public class ChunkProviderServer implements IChunkProvider { } e.put(((chunkcoordinates)), ((chunk))); f.add(((chunk))); - chunk.c(); if (chunk != null) { + chunk.c(); chunk.d(); } @@ -124,7 +122,7 @@ public class ChunkProviderServer implements IChunkProvider { Chunk chunk = d.a(((World) (g)), i, j); if (chunk != null) { - chunk.s = g.e; + chunk.r = g.e; } return chunk; } catch (Exception exception) { @@ -149,7 +147,7 @@ public class ChunkProviderServer implements IChunkProvider { return; } try { - chunk.s = g.e; + chunk.r = g.e; d.a(((World) (g)), chunk); } catch (Throwable ioexception) { // CraftBukkit -- downcast to work ioexception.printStackTrace(); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 991fe363..1ee40687 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -67,12 +67,13 @@ public abstract class Entity { public int ad; private boolean c; protected boolean ae; + protected DataWatcher af; private double d; private double e; - public boolean af; - public int ag; + public boolean ag; public int ah; public int ai; + public int aj; public Entity(World world) { g = a++; @@ -106,9 +107,18 @@ public abstract class Entity { ad = 300; c = true; ae = false; - af = false; + af = new DataWatcher(); + ag = false; l = world; a(0.0D, 0.0D, 0.0D); + af.a(0, ((Byte.valueOf((byte) 0)))); + a(); + } + + protected abstract void a(); + + public DataWatcher p() { + return af; } public boolean equals(Object obj) { @@ -123,7 +133,7 @@ public abstract class Entity { return g; } - public void l() { + public void q() { G = true; } @@ -148,10 +158,10 @@ public abstract class Entity { } public void b_() { - m(); + r(); } - public void m() { + public void r() { if (k != null && k.G) { k = null; } @@ -162,7 +172,7 @@ public abstract class Entity { o = r; y = w; x = v; - if (r()) { + if (v()) { if (!ab && !c) { float f1 = MathHelper.a(s * s * 0.20000000298023224D + t * t + u * u * 0.20000000298023224D) * 0.2F; @@ -207,24 +217,28 @@ public abstract class Entity { Z--; } } - if (t()) { - n(); + if (x()) { + s(); } if (q < -64D) { - o(); + t(); + } + if (!l.z) { + a(0, Z > 0); + a(2, k != null); } c = false; } - protected void n() { + protected void s() { if (!ae) { a(((Entity) (null)), 4); Z = 600; } } - protected void o() { - l(); + protected void t() { + q(); } public boolean b(double d1, double d2, double d3) { @@ -251,7 +265,7 @@ public abstract class Entity { double d7 = d2; double d8 = d3; AxisAlignedBB axisalignedbb = z.b(); - boolean flag = A && p(); + boolean flag = A && J(); if (flag) { double d9 = 0.050000000000000003D; @@ -383,12 +397,12 @@ public abstract class Entity { if (L > (float) b && i3 > 0) { b++; - StepSound stepsound = Block.m[i3].bq; + StepSound stepsound = Block.m[i3].br; - if (l.a(k3, i4 + 1, l1) == Block.aS.bh) { - stepsound = Block.aS.bq; + if (l.a(k3, i4 + 1, l1) == Block.aS.bi) { + stepsound = Block.aS.br; l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b()); - } else if (!Block.m[i3].bs.d()) { + } else if (!Block.m[i3].bt.d()) { l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b()); } Block.m[i3].b(l, k3, i4, l1, this); @@ -401,20 +415,21 @@ public abstract class Entity { int k4 = MathHelper.b(z.e); int l4 = MathHelper.b(z.f); - for (int i5 = l3; i5 <= j3; i5++) { - for (int j5 = j4; j5 <= k4; j5++) { - for (int k5 = i2; k5 <= l4; k5++) { - int l5 = l.a(i5, j5, k5); + if (l.a(l3, j4, i2, j3, k4, l4)) { + for (int i5 = l3; i5 <= j3; i5++) { + for (int j5 = j4; j5 <= k4; j5++) { + for (int k5 = i2; k5 <= l4; k5++) { + int l5 = l.a(i5, j5, k5); - if (l5 > 0) { - Block.m[l5].a(l, i5, j5, k5, this); + if (l5 > 0) { + Block.m[l5].a(l, i5, j5, k5, this); + } } } } } - R *= 0.4F; - boolean flag2 = r(); + boolean flag2 = v(); if (l.c(z)) { b(1); @@ -444,11 +459,7 @@ public abstract class Entity { } } - public boolean p() { - return false; - } - - public AxisAlignedBB q() { + public AxisAlignedBB u() { return null; } @@ -477,19 +488,19 @@ public abstract class Entity { protected void a(float f1) {} - public boolean r() { + public boolean v() { return l.a(z.b(0.0D, -0.40000000596046448D, 0.0D), Material.f, this); } public boolean a(Material material) { - double d1 = q + (double) s(); + double d1 = q + (double) w(); int i1 = MathHelper.b(p); int j1 = MathHelper.d(MathHelper.b(d1)); int k1 = MathHelper.b(r); int l1 = l.a(i1, j1, k1); - if (l1 != 0 && Block.m[l1].bs == material) { - float f1 = BlockFluids.b(l.b(i1, j1, k1)) - 0.1111111F; + if (l1 != 0 && Block.m[l1].bt == material) { + float f1 = BlockFluids.c(l.b(i1, j1, k1)) - 0.1111111F; float f2 = (float) (j1 + 1) - f1; return d1 < (double) f2; @@ -498,12 +509,12 @@ public abstract class Entity { } } - public float s() { + public float w() { return 0.0F; } - public boolean t() { - return l.a(z.b(0.0D, -0.40000000596046448D, 0.0D), Material.g); + public boolean x() { + return l.a(z.b(-0.10000000149011612D, -0.40000000596046448D, -0.10000000149011612D), Material.g); } public void a(float f1, float f2, float f3) { @@ -531,7 +542,11 @@ public abstract class Entity { int j1 = MathHelper.b((q - (double) H) + d1); int k1 = MathHelper.b(r); - return l.k(i1, j1, k1); + if (l.a(MathHelper.b(z.a), MathHelper.b(z.b), MathHelper.b(z.c), MathHelper.b(z.d), MathHelper.b(z.e), MathHelper.b(z.f))) { + return l.l(i1, j1, k1); + } else { + return 0.0F; + } } public void b(double d1, double d2, double d3, float f1, float f2) { @@ -554,9 +569,9 @@ public abstract class Entity { } public void c(double d1, double d2, double d3, float f1, float f2) { - m = p = d1; - n = q = d2 + (double) H; - o = r = d3; + O = m = p = d1; + P = n = q = d2 + (double) H; + Q = o = r = d3; v = f1; w = f2; a(p, q, r); @@ -630,12 +645,12 @@ public abstract class Entity { u += d3; } - protected void u() { + protected void y() { E = true; } public boolean a(Entity entity, int i1) { - u(); + y(); return false; } @@ -643,14 +658,14 @@ public abstract class Entity { return false; } - public boolean v() { + public boolean z() { return false; } public void b(Entity entity, int i1) {} public boolean c(NBTTagCompound nbttagcompound) { - String s1 = w(); + String s1 = A(); if (G || s1 == null) { return false; @@ -700,7 +715,7 @@ public abstract class Entity { b(nbttagcompound); } - protected final String w() { + protected final String A() { return EntityList.b(this); } @@ -736,25 +751,29 @@ public abstract class Entity { return nbttaglist; } - public EntityItem b(int i1, int j1) { + public EntityItem a(int i1, int j1) { return a(i1, j1, 0.0F); } public EntityItem a(int i1, int j1, float f1) { - EntityItem entityitem = new EntityItem(l, p, q + (double) f1, r, new ItemStack(i1, j1)); + return a(new ItemStack(i1, j1, 0), f1); + } + + public EntityItem a(ItemStack itemstack, float f1) { + EntityItem entityitem = new EntityItem(l, p, q + (double) f1, r, itemstack); entityitem.c = 10; l.a(((Entity) (entityitem))); return entityitem; } - public boolean x() { + public boolean B() { return !G; } - public boolean y() { + public boolean C() { int i1 = MathHelper.b(p); - int j1 = MathHelper.b(q + (double) s()); + int j1 = MathHelper.b(q + (double) w()); int k1 = MathHelper.b(r); return l.d(i1, j1, k1); @@ -768,7 +787,7 @@ public abstract class Entity { return null; } - public void z() { + public void D() { if (k.G) { k = null; return; @@ -777,7 +796,7 @@ public abstract class Entity { t = 0.0D; u = 0.0D; b_(); - k.A(); + k.E(); e += k.v - k.x; d += k.w - k.y; for (; e >= 180D; e -= 360D) { @@ -814,15 +833,15 @@ public abstract class Entity { w += ((float) (d2)); } - public void A() { - j.a(p, q + j() + j.B(), r); + public void E() { + j.a(p, q + k() + j.F(), r); } - public double B() { + public double F() { return (double) H; } - public double j() { + public double k() { return (double) J * 0.75D; } @@ -863,13 +882,35 @@ public abstract class Entity { entity.j = this; } - public Vec3D C() { + public Vec3D G() { return null; } - public void D() {} + public void H() {} - public int[] E() { + public ItemStack[] I() { return null; } + + public boolean J() { + return c(1); + } + + public void b(boolean flag) { + a(1, flag); + } + + protected boolean c(int i1) { + return (af.a(0) & 1 << i1) != 0; + } + + protected void a(int i1, boolean flag) { + byte byte0 = af.a(0); + + if (flag) { + af.b(0, ((Byte.valueOf((byte) (byte0 | 1 << i1))))); + } else { + af.b(0, ((Byte.valueOf((byte) (byte0 & ~(1 << i1)))))); + } + } } diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 0e59d97e..d6262b58 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -25,9 +25,9 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit private int d; private double e; private double f; - private double aj; private double ak; private double al; + private double am; // CraftBukkit start private CraftBoat boat; @@ -50,15 +50,17 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit handleCreation(world); // CraftBukkit } + protected void a() {} + public AxisAlignedBB d(Entity entity) { return entity.z; } - public AxisAlignedBB q() { + public AxisAlignedBB u() { return z; } - public boolean v() { + public boolean z() { return true; } @@ -84,7 +86,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit } // CraftBukkit end - public double j() { + public double l() { return (double) J * 0.0D - 0.30000001192092896D; } @@ -104,17 +106,17 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit c = -c; b = 10; a += i * 10; - u(); + y(); if (a > 40) { - for (int k = 0; k < 3; k++) { - a(Block.x.bh, 1, 0.0F); + for (int j = 0; j < 3; j++) { + a(Block.x.bi, 1, 0.0F); } for (int l = 0; l < 2; l++) { - a(Item.B.aW, 1, 0.0F); + a(Item.B.ba, 1, 0.0F); } - l(); + q(); } return true; } @@ -145,9 +147,9 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit int i = 5; double d1 = 0.0D; - for (int k = 0; k < i; k++) { - double d2 = (z.b + ((z.e - z.b) * (double) (k + 0)) / (double) i) - 0.125D; - double d3 = (z.b + ((z.e - z.b) * (double) (k + 1)) / (double) i) - 0.125D; + for (int j = 0; j < i; j++) { + double d2 = (z.b + ((z.e - z.b) * (double) (j + 0)) / (double) i) - 0.125D; + double d3 = (z.b + ((z.e - z.b) * (double) (j + 1)) / (double) i) - 0.125D; AxisAlignedBB axisalignedbb = AxisAlignedBB.b(z.a, d2, z.c, z.d, d3, z.f); if (this.l.b(axisalignedbb, Material.f)) { @@ -159,17 +161,17 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit if (d > 0) { double d4 = p + (e - p) / (double) d; double d7 = q + (f - q) / (double) d; - double d10 = r + (aj - r) / (double) d; + double d10 = r + (ak - r) / (double) d; double d13; - for (d13 = ak - (double) v; d13 < -180D; d13 += 360D) { + for (d13 = al - (double) v; d13 < -180D; d13 += 360D) { ; } for (; d13 >= 180D; d13 -= 360D) { ; } v += ((float) (d13 / (double) d)); - w += ((float) ((al - (double) w) / (double) d)); + w += ((float) ((am - (double) w) / (double) d)); d--; a(d4, d7, d10); b(v, w); @@ -193,9 +195,9 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit double d6 = d1 * 2D - 1.0D; t += 0.039999999105930328D * d6; - if (j != null) { - s += j.s * 0.20000000000000001D; - u += j.u * 0.20000000000000001D; + if (this.j != null) { + s += this.j.s * 0.20000000000000001D; + u += this.j.u * 0.20000000000000001D; } double d9 = 0.40000000000000002D; @@ -239,17 +241,16 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit this.l.a("splash", d21, q - 0.125D, d23, s, t, u); } } - } if (B && d12 > 0.14999999999999999D) { if (!this.l.z) { - l(); + q(); for (int i1 = 0; i1 < 3; i1++) { - a(Block.x.bh, 1, 0.0F); + a(Block.x.bi, 1, 0.0F); } for (int j1 = 0; j1 < 2; j1++) { - a(Item.B.aW, 1, 0.0F); + a(Item.B.ba, 1, 0.0F); } } } else { @@ -299,24 +300,24 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit for (int k1 = 0; k1 < list.size(); k1++) { Entity entity = (Entity) list.get(k1); - if (entity != j && entity.v() && (entity instanceof EntityBoat)) { + if (entity != this.j && entity.z() && (entity instanceof EntityBoat)) { entity.c(((Entity) (this))); } } } - if (j != null && j.G) { - j = null; + if (this.j != null && this.j.G) { + this.j = null; } } - public void A() { + public void E() { if (j == null) { return; } else { double d1 = Math.cos(((double) v * 3.1415926535897931D) / 180D) * 0.40000000000000002D; double d2 = Math.sin(((double) v * 3.1415926535897931D) / 180D) * 0.40000000000000002D; - j.a(p + d1, q + j() + j.B(), r + d2); + j.a(p + d1, q + l() + j.F(), r + d2); return; } } diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 7723190b..9aa4f326 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -16,9 +16,9 @@ public class EntityEgg extends Entity { private int e; private boolean f; public int a; - private EntityLiving aj; - private int ak; + private EntityLiving ak; private int al; + private int am; public EntityEgg(World world) { super(world); @@ -28,10 +28,12 @@ public class EntityEgg extends Entity { e = 0; f = false; a = 0; - al = 0; + am = 0; a(0.25F, 0.25F); } + protected void a() {} + public EntityEgg(World world, EntityLiving entityliving) { super(world); b = -1; @@ -40,10 +42,10 @@ public class EntityEgg extends Entity { e = 0; f = false; a = 0; - al = 0; - aj = entityliving; + am = 0; + ak = entityliving; a(0.25F, 0.25F); - c(entityliving.p, entityliving.q + (double) entityliving.s(), entityliving.r, entityliving.v, entityliving.w); + c(entityliving.p, entityliving.q + (double) entityliving.w(), entityliving.r, entityliving.v, entityliving.w); p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F; q -= 0.10000000149011612D; r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F; @@ -57,8 +59,22 @@ public class EntityEgg extends Entity { a(s, t, u, 1.5F, 1.0F); } - public void a(double d1, double d2, double d3, float f1, - float f2) { + public EntityEgg(World world, double d1, double d2, double d3) { + super(world); + b = -1; + c = -1; + d = -1; + e = 0; + f = false; + a = 0; + am = 0; + al = 0; + a(0.25F, 0.25F); + a(d1, d2, d3); + H = 0.0F; + } + + public void a(double d1, double d2, double d3, float f1, float f2) { float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3); d1 /= f3; @@ -77,7 +93,7 @@ public class EntityEgg extends Entity { x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D); y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D); - ak = 0; + al = 0; } public void b_() { @@ -96,17 +112,17 @@ public class EntityEgg extends Entity { s *= W.nextFloat() * 0.2F; t *= W.nextFloat() * 0.2F; u *= W.nextFloat() * 0.2F; - ak = 0; al = 0; + am = 0; } else { - ak++; - if (ak == 1200) { - l(); + al++; + if (al == 1200) { + q(); } return; } } else { - al++; + am++; } Vec3D vec3d = Vec3D.b(p, q, r); Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u); @@ -119,13 +135,13 @@ public class EntityEgg extends Entity { } if (!this.l.z) { Entity entity = null; - List list = this.l.b(this, z.a(s, t, u).b(1.0D, 1.0D, 1.0D)); + List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D)); double d1 = 0.0D; for (int l = 0; l < list.size(); l++) { Entity entity1 = (Entity) list.get(l); - if (!entity1.c_() || entity1 == aj && al < 5) { + if (!entity1.c_() || entity1 == ak && am < 5) { continue; } float f4 = 0.3F; @@ -149,7 +165,7 @@ public class EntityEgg extends Entity { } if (movingobjectposition != null) { if (movingobjectposition.g != null) { - if (!movingobjectposition.g.a(aj, 0)) { + if (!movingobjectposition.g.a(((Entity) (ak)), 0)) { ; } } @@ -162,9 +178,9 @@ public class EntityEgg extends Entity { } MobType type = MobType.CHICKEN; - if (aj instanceof EntityPlayerMP) { + if (ak instanceof EntityPlayerMP) { CraftServer server = ((WorldServer) l).getServer(); - CraftPlayer player = new CraftPlayer(server, (EntityPlayerMP) aj); + CraftPlayer player = new CraftPlayer(server, (EntityPlayerMP) ak); PlayerEggThrowEvent event = new PlayerEggThrowEvent(Type.PLAYER_EGG_THROW, player, hatching, numHatching, type); server.getPluginManager().callEvent(event); hatching = event.isHatching(); @@ -220,7 +236,7 @@ public class EntityEgg extends Entity { this.l.a("snowballpoof", p, q, r, 0.0D, 0.0D, 0.0D); } - l(); + q(); } p += s; q += t; @@ -245,7 +261,7 @@ public class EntityEgg extends Entity { float f2 = 0.99F; float f5 = 0.03F; - if (r()) { + if (v()) { for (int i1 = 0; i1 < 4; i1++) { float f3 = 0.25F; @@ -271,19 +287,19 @@ public class EntityEgg extends Entity { } public void b(NBTTagCompound nbttagcompound) { - b = nbttagcompound.c("xTile"); - c = nbttagcompound.c("yTile"); - d = nbttagcompound.c("zTile"); + b = ((int) (nbttagcompound.c("xTile"))); + c = ((int) (nbttagcompound.c("yTile"))); + d = ((int) (nbttagcompound.c("zTile"))); e = nbttagcompound.b("inTile") & 0xff; a = nbttagcompound.b("shake") & 0xff; f = nbttagcompound.b("inGround") == 1; } public void b(EntityPlayer entityplayer) { - if (f && aj == entityplayer && a <= 0 && entityplayer.an.a(new ItemStack(Item.j.aW, 1))) { - l.a(this, "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F); - entityplayer.c(this, 1); - l(); + if (f && ak == entityplayer && a <= 0 && entityplayer.an.a(new ItemStack(Item.j, 1))) { + l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityplayer.c(((Entity) (this)), 1); + q(); } } } diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index d61296f7..60bfa25c 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -16,16 +16,16 @@ import org.bukkit.event.vehicle.*; public class EntityMinecart extends Entity implements IInventory, CraftMappable { // CraftBukkit - private ItemStack ak[]; + private ItemStack al[]; public int a; public int b; public int c; - private boolean al; + private boolean am; public int d; public int e; public double f; - public double aj; - private static final int am[][][] = { + public double ak; + private static final int an[][][] = { { { 0, 0, -1 @@ -88,12 +88,12 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } } }; - private int an; - private double ao; + private int ao; private double ap; private double aq; private double ar; private double as; + private double at; // CraftBukkit start private CraftMinecart minecart; @@ -111,17 +111,17 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } public ItemStack[] getContents() { - return this.ak; + return this.al; } // CraftBukkit end public EntityMinecart(World world) { super(world); - ak = new ItemStack[36]; + al = new ItemStack[36]; a = 0; b = 0; c = 1; - al = false; + am = false; i = true; a(0.98F, 0.7F); H = J / 2.0F; @@ -130,15 +130,17 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable handleCreation(world); // CraftBukkit } + protected void a() {} + public AxisAlignedBB d(Entity entity) { return entity.z; } - public AxisAlignedBB q() { + public AxisAlignedBB u() { return null; } - public boolean v() { + public boolean z() { return true; } @@ -165,7 +167,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } // CraftBukkit end - public double j() { + public double l() { return (double) J * 0.0D - 0.30000001192092896D; } @@ -185,16 +187,16 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } c = -c; b = 10; - u(); + y(); a += i * 10; if (a > 40) { - a(Item.ax.aW, 1, 0.0F); + a(Item.ax.ba, 1, 0.0F); if (d == 1) { - a(Block.au.bh, 1, 0.0F); + a(Block.au.bi, 1, 0.0F); } else if (d == 2) { - a(Block.aB.bh, 1, 0.0F); + a(Block.aB.bi, 1, 0.0F); } - l(); + q(); } return true; } @@ -203,9 +205,9 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable return !G; } - public void l() { + public void q() { label0: - for (int i = 0; i < a(); i++) { + for (int i = 0; i < h_(); i++) { ItemStack itemstack = a(i); if (itemstack == null) { @@ -219,13 +221,13 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable if (itemstack.a <= 0) { continue label0; } - int k = W.nextInt(21) + 10; + int j = W.nextInt(21) + 10; - if (k > itemstack.a) { - k = itemstack.a; + if (j > itemstack.a) { + j = itemstack.a; } - itemstack.a -= k; - EntityItem entityitem = new EntityItem(l, p + (double) f1, q + (double) f2, r + (double) f3, new ItemStack(itemstack.c, k, itemstack.d)); + itemstack.a -= j; + EntityItem entityitem = new EntityItem(l, p + (double) f1, q + (double) f2, r + (double) f3, new ItemStack(itemstack.c, j, itemstack.h())); float f4 = 0.05F; entityitem.s = (float) W.nextGaussian() * f4; @@ -235,7 +237,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } while (true); } - super.l(); + super.q(); } public void b_() { @@ -252,22 +254,22 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable if (a > 0) { a--; } - if (l.z && an > 0) { - if (an > 0) { - double d1 = p + (ao - p) / (double) an; - double d2 = q + (ap - q) / (double) an; - double d3 = r + (aq - r) / (double) an; + if (this.l.z && ao > 0) { + if (ao > 0) { + double d1 = p + (ap - p) / (double) ao; + double d2 = q + (aq - q) / (double) ao; + double d3 = r + (ar - r) / (double) ao; double d4; - for (d4 = ar - (double) v; d4 < -180D; d4 += 360D) { + for (d4 = as - (double) v; d4 < -180D; d4 += 360D) { ; } for (; d4 >= 180D; d4 -= 360D) { ; } - v += ((float) (d4 / (double) an)); - w += ((float) ((as - (double) w) / (double) an)); - an--; + v += ((float) (d4 / (double) ao)); + w += ((float) ((at - (double) w) / (double) ao)); + ao--; a(d1, d2, d3); b(v, w); } else { @@ -281,37 +283,37 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable o = r; t -= 0.039999999105930328D; int i = MathHelper.b(p); - int k = MathHelper.b(q); - int i1 = MathHelper.b(r); + int j = MathHelper.b(q); + int l = MathHelper.b(r); - if (l.a(i, k - 1, i1) == Block.aG.bh) { - k--; + if (this.l.a(i, j - 1, l) == Block.aG.bi) { + j--; } double d6 = 0.40000000000000002D; boolean flag = false; double d5 = 0.0078125D; - if (l.a(i, k, i1) == Block.aG.bh) { + if (this.l.a(i, j, l) == Block.aG.bi) { Vec3D vec3d = g(p, q, r); - int j1 = l.b(i, k, i1); + int i1 = this.l.b(i, j, l); - q = k; - if (j1 >= 2 && j1 <= 5) { - q = k + 1; + q = j; + if (i1 >= 2 && i1 <= 5) { + q = j + 1; } - if (j1 == 2) { + if (i1 == 2) { s -= d5; } - if (j1 == 3) { + if (i1 == 3) { s += d5; } - if (j1 == 4) { + if (i1 == 4) { u += d5; } - if (j1 == 5) { + if (i1 == 5) { u -= d5; } - int ai[][] = am[j1]; + int ai[][] = an[i1]; double d7 = ai[1][0] - ai[0][0]; double d8 = ai[1][2] - ai[0][2]; double d9 = Math.sqrt(d7 * d7 + d8 * d8); @@ -327,17 +329,17 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable u = (d11 * d8) / d9; double d14 = 0.0D; double d15 = (double) i + 0.5D + (double) ai[0][0] * 0.5D; - double d16 = (double) i1 + 0.5D + (double) ai[0][2] * 0.5D; + double d16 = (double) l + 0.5D + (double) ai[0][2] * 0.5D; double d17 = (double) i + 0.5D + (double) ai[1][0] * 0.5D; - double d18 = (double) i1 + 0.5D + (double) ai[1][2] * 0.5D; + double d18 = (double) l + 0.5D + (double) ai[1][2] * 0.5D; d7 = d17 - d15; d8 = d18 - d16; if (d7 == 0.0D) { p = (double) i + 0.5D; - d14 = r - (double) i1; + d14 = r - (double) l; } else if (d8 == 0.0D) { - r = (double) i1 + 0.5D; + r = (double) l + 0.5D; d14 = p - (double) i; } else { double d19 = p - d15; @@ -352,7 +354,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable double d20 = s; double d22 = u; - if (j != null) { + if (this.j != null) { d20 *= 0.75D; d22 *= 0.75D; } @@ -369,31 +371,30 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable d22 = d6; } c(d20, 0.0D, d22); - if (ai[0][1] != 0 && MathHelper.b(p) - i == ai[0][0] && MathHelper.b(r) - i1 == ai[0][2]) { + if (ai[0][1] != 0 && MathHelper.b(p) - i == ai[0][0] && MathHelper.b(r) - l == ai[0][2]) { a(p, q + (double) ai[0][1], r); - } else if (ai[1][1] != 0 && MathHelper.b(p) - i == ai[1][0] && MathHelper.b(r) - i1 == ai[1][2]) { + } else if (ai[1][1] != 0 && MathHelper.b(p) - i == ai[1][0] && MathHelper.b(r) - l == ai[1][2]) { a(p, q + (double) ai[1][1], r); } - // CraftBukkit - if (j != null || !slowWhenEmpty) { + if (this.j != null || !slowWhenEmpty) { // CraftBukkit s *= 0.99699997901916504D; t *= 0.0D; u *= 0.99699997901916504D; } else { if (d == 2) { - double d24 = MathHelper.a(f * f + aj * aj); + double d24 = MathHelper.a(f * f + ak * ak); if (d24 > 0.01D) { flag = true; f /= d24; - aj /= d24; + ak /= d24; double d25 = 0.040000000000000001D; s *= 0.80000001192092896D; t *= 0.0D; u *= 0.80000001192092896D; s += f * d25; - u += aj * d25; + u += ak * d25; } else { s *= 0.89999997615814209D; t *= 0.0D; @@ -416,27 +417,27 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } a(p, vec3d1.b, r); } - int k1 = MathHelper.b(p); - int l1 = MathHelper.b(r); + int j1 = MathHelper.b(p); + int k1 = MathHelper.b(r); - if (k1 != i || l1 != i1) { + if (j1 != i || k1 != l) { double d13 = Math.sqrt(s * s + u * u); - s = d13 * (double) (k1 - i); - u = d13 * (double) (l1 - i1); + s = d13 * (double) (j1 - i); + u = d13 * (double) (k1 - l); } if (d == 2) { - double d27 = MathHelper.a(f * f + aj * aj); + double d27 = MathHelper.a(f * f + ak * ak); if (d27 > 0.01D && s * s + u * u > 0.001D) { f /= d27; - aj /= d27; - if (f * s + aj * u < 0.0D) { + ak /= d27; + if (f * s + ak * u < 0.0D) { f = 0.0D; - aj = 0.0D; + ak = 0.0D; } else { f = s; - aj = u; + ak = u; } } } @@ -475,7 +476,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable if (d28 * d28 + d29 * d29 > 0.001D) { v = (float) ((Math.atan2(d29, d28) * 180D) / 3.1415926535897931D); - if (al) { + if (am) { v += 180F; } } @@ -489,76 +490,76 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } if (d30 < -170D || d30 >= 170D) { v += 180F; - al = !al; + am = !am; } b(v, w); // CraftBukkit start - CraftServer server = ((WorldServer)l).getServer(); + CraftServer server = ((WorldServer)this.l).getServer(); VehicleMoveEvent event = new VehicleMoveEvent( Type.VEHICLE_MOVE, minecart, - new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), - new Location(((WorldServer)l).getWorld(), p, q, r, v, w) + new Location(((WorldServer)this.l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), + new Location(((WorldServer)this.l).getWorld(), p, q, r, v, w) ); server.getPluginManager().callEvent(event); // CraftBukkit end - List list = l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + List list = this.l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { - for (int i2 = 0; i2 < list.size(); i2++) { - Entity entity = (Entity) list.get(i2); + for (int l1 = 0; l1 < list.size(); l1++) { + Entity entity = (Entity) list.get(l1); - if (entity != j && entity.v() && (entity instanceof EntityMinecart)) { + if (entity != this.j && entity.z() && (entity instanceof EntityMinecart)) { entity.c(((Entity) (this))); } } } - if (j != null && j.G) { - j = null; + if (this.j != null && this.j.G) { + this.j = null; } if (flag && W.nextInt(4) == 0) { e--; if (e < 0) { - f = aj = 0.0D; + f = ak = 0.0D; } - l.a("largesmoke", p, q + 0.80000000000000004D, r, 0.0D, 0.0D, 0.0D); + this.l.a("largesmoke", p, q + 0.80000000000000004D, r, 0.0D, 0.0D, 0.0D); } } public Vec3D g(double d1, double d2, double d3) { int i = MathHelper.b(d1); - int k = MathHelper.b(d2); - int i1 = MathHelper.b(d3); + int j = MathHelper.b(d2); + int l = MathHelper.b(d3); - if (l.a(i, k - 1, i1) == Block.aG.bh) { - k--; + if (this.l.a(i, j - 1, l) == Block.aG.bi) { + j--; } - if (l.a(i, k, i1) == Block.aG.bh) { - int j1 = l.b(i, k, i1); + if (this.l.a(i, j, l) == Block.aG.bi) { + int i1 = this.l.b(i, j, l); - d2 = k; - if (j1 >= 2 && j1 <= 5) { - d2 = k + 1; + d2 = j; + if (i1 >= 2 && i1 <= 5) { + d2 = j + 1; } - int ai[][] = am[j1]; + int ai[][] = an[i1]; double d4 = 0.0D; double d5 = (double) i + 0.5D + (double) ai[0][0] * 0.5D; - double d6 = (double) k + 0.5D + (double) ai[0][1] * 0.5D; - double d7 = (double) i1 + 0.5D + (double) ai[0][2] * 0.5D; + double d6 = (double) j + 0.5D + (double) ai[0][1] * 0.5D; + double d7 = (double) l + 0.5D + (double) ai[0][2] * 0.5D; double d8 = (double) i + 0.5D + (double) ai[1][0] * 0.5D; - double d9 = (double) k + 0.5D + (double) ai[1][1] * 0.5D; - double d10 = (double) i1 + 0.5D + (double) ai[1][2] * 0.5D; + double d9 = (double) j + 0.5D + (double) ai[1][1] * 0.5D; + double d10 = (double) l + 0.5D + (double) ai[1][2] * 0.5D; double d11 = d8 - d5; double d12 = (d9 - d6) * 2D; double d13 = d10 - d7; if (d11 == 0.0D) { d1 = (double) i + 0.5D; - d4 = d3 - (double) i1; + d4 = d3 - (double) l; } else if (d13 == 0.0D) { - d3 = (double) i1 + 0.5D; + d3 = (double) l + 0.5D; d4 = d1 - (double) i; } else { double d14 = d1 - d5; @@ -586,17 +587,17 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable nbttagcompound.a("Type", d); if (d == 2) { nbttagcompound.a("PushX", f); - nbttagcompound.a("PushZ", aj); + nbttagcompound.a("PushZ", ak); nbttagcompound.a("Fuel", (short) e); } else if (d == 1) { NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < ak.length; i++) { - if (ak[i] != null) { + for (int i = 0; i < al.length; i++) { + if (al[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.a("Slot", (byte) i); - ak[i].a(nbttagcompound1); + al[i].a(nbttagcompound1); nbttaglist.a(((NBTBase) (nbttagcompound1))); } } @@ -609,18 +610,18 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable d = nbttagcompound.d("Type"); if (d == 2) { f = nbttagcompound.g("PushX"); - aj = nbttagcompound.g("PushZ"); + ak = nbttagcompound.g("PushZ"); e = ((int) (nbttagcompound.c("Fuel"))); } else if (d == 1) { NBTTagList nbttaglist = nbttagcompound.k("Items"); - ak = new ItemStack[a()]; + al = new ItemStack[h_()]; for (int i = 0; i < nbttaglist.b(); i++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int k = nbttagcompound1.b("Slot") & 0xff; + int j = nbttagcompound1.b("Slot") & 0xff; - if (k >= 0 && k < ak.length) { - ak[k] = new ItemStack(nbttagcompound1); + if (j >= 0 && j < al.length) { + al[j] = new ItemStack(nbttagcompound1); } } } @@ -710,26 +711,26 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } } - public int a() { + public int h_() { return 27; } public ItemStack a(int i) { - return ak[i]; + return al[i]; } - public ItemStack a(int i, int k) { - if (ak[i] != null) { - if (ak[i].a <= k) { - ItemStack itemstack = ak[i]; + public ItemStack b(int i, int j) { + if (al[i] != null) { + if (al[i].a <= j) { + ItemStack itemstack = al[i]; - ak[i] = null; + al[i] = null; return itemstack; } - ItemStack itemstack1 = ak[i].a(k); + ItemStack itemstack1 = al[i].a(j); - if (ak[i].a == 0) { - ak[i] = null; + if (al[i].a == 0) { + al[i] = null; } return itemstack1; } else { @@ -738,7 +739,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } public void a(int i, ItemStack itemstack) { - ak[i] = itemstack; + al[i] = itemstack; if (itemstack != null && itemstack.a > c()) { itemstack.a = c(); } @@ -779,14 +780,14 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable } else if (d == 2) { ItemStack itemstack = entityplayer.an.e(); - if (itemstack != null && itemstack.c == Item.k.aW) { + if (itemstack != null && itemstack.c == Item.k.ba) { if (--itemstack.a == 0) { entityplayer.an.a(entityplayer.an.c, ((ItemStack) (null))); } e += 1200; } f = p - entityplayer.p; - aj = r - entityplayer.r; + ak = r - entityplayer.r; } return true; } diff --git a/src/main/java/net/minecraft/server/EntityPlayerMP.java b/src/main/java/net/minecraft/server/EntityPlayerMP.java index 1e1f0b55..e6f34c2e 100644 --- a/src/main/java/net/minecraft/server/EntityPlayerMP.java +++ b/src/main/java/net/minecraft/server/EntityPlayerMP.java @@ -10,78 +10,67 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { public double d; public double e; public List f; - public Set aj; - public double ak; - public boolean al; + public Set ak; + public double al; + private int bD; private int bE; - private int bF; - private int bG[] = { - -1, -1, -1, -1, -1 + private ItemStack bF[] = { + null, null, null, null, null }; - private int bH; + private int bG; public boolean am; - public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s1, ItemInWorldManager iteminworldmanager) { + public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { super(world); f = ((List) (new LinkedList())); - aj = ((Set) (new HashSet())); - al = false; - bE = 0xfa0a1f01; - bF = 60; - bH = 0; + ak = ((Set) (new HashSet())); + bD = 0xfa0a1f01; + bE = 60; + bG = 0; int i = world.m; int j = world.o; - int l = world.n; + int k = world.n; if (!world.q.e) { i += W.nextInt(20) - 10; - l = world.e(i, j); + k = world.e(i, j); j += W.nextInt(20) - 10; } - c((double) i + 0.5D, l, (double) j + 0.5D, 0.0F, 0.0F); + c((double) i + 0.5D, k, (double) j + 0.5D, 0.0F, 0.0F); b = minecraftserver; S = 0.0F; iteminworldmanager.a = ((EntityPlayer) (this)); - aw = s1; + aw = s; c = iteminworldmanager; H = 0.0F; } - public void k() { + public void l() { ap.a(((ICrafting) (this))); } - public int[] E() { - return bG; + public ItemStack[] I() { + return bF; } public void b_() { - bF--; + bE--; ap.a(); for (int i = 0; i < 5; i++) { - int j = a(i); + ItemStack itemstack = a(i); - if (j != bG[i]) { - b.k.a(((Entity) (this)), ((Packet) (new Packet5PlayerInventory(g, i, j)))); - bG[i] = j; + if (itemstack != bF[i]) { + b.k.a(((Entity) (this)), ((Packet) (new Packet5PlayerInventory(g, i, itemstack)))); + bF[i] = itemstack; } } - } - public int a(int i) { + public ItemStack a(int i) { if (i == 0) { - return c(an.e()); - } else { - return c(an.b[i - 1]); - } - } - - private int c(ItemStack itemstack) { - if (itemstack == null) { - return -1; + return an.e(); } else { - return itemstack.c; + return an.b[i - 1]; } } @@ -90,7 +79,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { } public boolean a(Entity entity, int i) { - if (bF > 0) { + if (bE > 0) { return false; } if (!b.n) { @@ -108,11 +97,11 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { return super.a(entity, i); } - public void c(int i) { - super.c(i); + public void d(int i) { + super.d(i); } - public void F() { + public void n() { super.b_(); ChunkCoordIntPair chunkcoordintpair = null; double d1 = 0.0D; @@ -146,15 +135,15 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { } } } - if (ba != bE) { - a.b(((Packet) (new Packet8(ba)))); - bE = ba; + if (aZ != bD) { + a.b(((Packet) (new Packet8(aZ)))); + bD = aZ; } } private void a(TileEntity tileentity) { if (tileentity != null) { - Packet packet = tileentity.f(); + Packet packet = tileentity.g(); if (packet != null) { a.b(packet); @@ -162,10 +151,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { } } - public void G() { + public void o() { s = t = u = 0.0D; - bB = false; - super.G(); + bA = false; + super.o(); } public void c(Entity entity, int i) { @@ -181,7 +170,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { ap.a(); } - public void H() { + public void K() { if (!au) { av = -1; au = true; @@ -189,7 +178,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { } } - public float s() { + public float w() { return 1.62F; } @@ -214,35 +203,39 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { super.a(d1, flag); } - public boolean p() { - return al; + private void U() { + bG = bG % 100 + 1; } - private void R() { - bH = bH % 100 + 1; - } - - public void a(int i, int j, int l) { - R(); - a.b(((Packet) (new Packet100(bH, 1, "Crafting", 9)))); - ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, this.l, i, j, l))); - ap.f = bH; + public void a(int i, int j, int k) { + U(); + a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9)))); + ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k))); + ap.f = bG; ap.a(((ICrafting) (this))); } public void a(IInventory iinventory) { - R(); - a.b(((Packet) (new Packet100(bH, 0, iinventory.b(), iinventory.a())))); + U(); + a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_())))); ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory))); - ap.f = bH; + ap.f = bG; ap.a(((ICrafting) (this))); } public void a(TileEntityFurnace tileentityfurnace) { - R(); - a.b(((Packet) (new Packet100(bH, 2, tileentityfurnace.b(), tileentityfurnace.a())))); + U(); + a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_())))); ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace))); - ap.f = bH; + ap.f = bG; + ap.a(((ICrafting) (this))); + } + + public void a(TileEntityDispenser tileentitydispenser) { + U(); + a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_())))); + ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser))); + ap.f = bG; ap.a(((ICrafting) (this))); } @@ -269,12 +262,12 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { public void a(ItemStack itemstack) {} - public void I() { + public void L() { a.b(((Packet) (new Packet101(ap.f)))); - K(); + N(); } - public void J() { + public void M() { if (am) { return; } else { @@ -283,8 +276,8 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { } } - public void K() { + public void N() { ap.a(((EntityPlayer) (this))); ap = ao; } -} +}
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index f7a23b5c..dc207a0a 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -15,26 +15,26 @@ public class EntitySkeleton extends EntityMobs { public EntitySkeleton(World world) { super(world); - aQ = "/mob/skeleton.png"; + aP = "/mob/skeleton.png"; } - protected String d() { + protected String e() { return "mob.skeleton"; } - protected String e() { + protected String f() { return "mob.skeletonhurt"; } - protected String f() { + protected String g() { return "mob.skeletonhurt"; } - public void G() { + public void o() { if (l.b()) { float f1 = b(1.0F); - if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { + if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); @@ -45,28 +45,28 @@ public class EntitySkeleton extends EntityMobs { // CraftBukkit end } } - super.G(); + super.o(); } protected void a(Entity entity, float f1) { if (f1 < 10F) { - double d1 = entity.p - p; - double d2 = entity.r - r; + double d = entity.p - p; + double d1 = entity.r - r; - if (bg == 0) { + if (bf == 0) { EntityArrow entityarrow = new EntityArrow(l, ((EntityLiving) (this))); entityarrow.q += 1.3999999761581421D; - double d3 = entity.q - 0.20000000298023224D - entityarrow.q; - float f2 = MathHelper.a(d1 * d1 + d2 * d2) * 0.2F; + double d2 = entity.q - 0.20000000298023224D - entityarrow.q; + float f2 = MathHelper.a(d * d + d1 * d1) * 0.2F; l.a(((Entity) (this)), "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F)); l.a(((Entity) (entityarrow))); - entityarrow.a(d1, d3 + (double) f2, d2, 0.6F, 12F); - bg = 30; + entityarrow.a(d, d2 + (double) f2, d1, 0.6F, 12F); + bf = 30; } - v = (float) ((Math.atan2(d2, d1) * 180D) / 3.1415927410125732D) - 90F; - ak = true; + v = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; + e = true; } } @@ -78,8 +78,21 @@ public class EntitySkeleton extends EntityMobs { super.b(nbttagcompound); } - protected int g() { - return Item.j.aW; + protected int h() { + return Item.j.ba; + } + + protected void g_() { + int i = W.nextInt(3); + + for (int j = 0; j < i; j++) { + a(Item.j.ba, 1); + } + + i = W.nextInt(3); + for (int k = 0; k < i; k++) { + a(Item.aV.ba, 1); + } } static { diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 8185ba64..77192b05 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -13,16 +13,16 @@ public class EntityZombie extends EntityMobs { public EntityZombie(World world) { super(world); - aQ = "/mob/zombie.png"; - bD = 0.5F; - f = 5; + aP = "/mob/zombie.png"; + bC = 0.5F; + c = 5; } - public void G() { + public void o() { if (l.b()) { float f1 = b(1.0F); - if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { + if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); @@ -33,22 +33,22 @@ public class EntityZombie extends EntityMobs { // CraftBukkit end } } - super.G(); + super.o(); } - protected String d() { + protected String e() { return "mob.zombie"; } - protected String e() { + protected String f() { return "mob.zombiehurt"; } - protected String f() { + protected String g() { return "mob.zombiedeath"; } - protected int g() { - return Item.J.aW; + protected int h() { + return Item.J.ba; } } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 3f04438f..3bf4358c 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -83,7 +83,6 @@ public class Explosion { } while (true); } } - } f *= 2.0F; @@ -166,7 +165,7 @@ public class Explosion { int j5 = i.a(i2, k4 - 1, l4); if (i5 == 0 && Block.o[j5] && h.nextInt(3) == 0) { - i.d(i2, k4, l4, Block.ar.bh); + i.e(i2, k4, l4, Block.ar.bi); } } } @@ -208,8 +207,8 @@ public class Explosion { if (j1 > 0) { Block.m[j1].a(i, k, l, i1, i.b(k, l, i1), 0.3F); - i.d(k, l, i1, 0); - Block.m[j1].c(i, k, l, i1); + i.e(k, l, i1, 0); + Block.m[j1].a_(i, k, l, i1); } } diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java index 56507b3c..f5e830ef 100644 --- a/src/main/java/net/minecraft/server/IInventory.java +++ b/src/main/java/net/minecraft/server/IInventory.java @@ -2,11 +2,11 @@ package net.minecraft.server; public interface IInventory {
- public abstract int a();
+ public abstract int h_();
public abstract ItemStack a(int i);
- public abstract ItemStack a(int i, int j);
+ public abstract ItemStack b(int i, int j);
public abstract void a(int i, ItemStack itemstack);
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java index 4652cc1a..208c1a4c 100644 --- a/src/main/java/net/minecraft/server/InventoryCraftResult.java +++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java @@ -14,7 +14,7 @@ public class InventoryCraftResult implements IInventory { a = new ItemStack[1];
}
- public int a() {
+ public int h_() {
return 1;
}
@@ -26,7 +26,7 @@ public class InventoryCraftResult implements IInventory { return "Result";
}
- public ItemStack a(int i, int j) {
+ public ItemStack b(int i, int j) {
if (a[i] != null) {
ItemStack itemstack = a[i];
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java index cf1fd2de..aa49ed42 100644 --- a/src/main/java/net/minecraft/server/InventoryCrafting.java +++ b/src/main/java/net/minecraft/server/InventoryCrafting.java @@ -13,24 +13,40 @@ public class InventoryCrafting implements IInventory { // CraftBukkit end
public InventoryCrafting(CraftingInventoryCB craftinginventorycb, int i, int j) {
- b = i * j;
- a = new ItemStack[b];
+ int k = i * j;
+
+ a = new ItemStack[k];
c = craftinginventorycb;
+ b = i;
}
- public int a() {
- return b;
+ public int h_() {
+ return a.length;
}
public ItemStack a(int i) {
- return a[i];
+ if (i >= h_()) {
+ return null;
+ } else {
+ return a[i];
+ }
+ }
+
+ public ItemStack a(int i, int j) {
+ if (i < 0 || i >= b) {
+ return null;
+ } else {
+ int k = i + j * b;
+
+ return a(k);
+ }
}
public String b() {
return "Crafting";
}
- public ItemStack a(int i, int j) {
+ public ItemStack b(int i, int j) {
if (a[i] != null) {
if (a[i].a <= j) {
ItemStack itemstack = a[i];
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java index ff6aaab9..a766cb4f 100644 --- a/src/main/java/net/minecraft/server/InventoryLargeChest.java +++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java @@ -8,7 +8,7 @@ public class InventoryLargeChest implements IInventory { // CraftBukkit start
public ItemStack[] getContents() {
- ItemStack[] result = new ItemStack[a()];
+ ItemStack[] result = new ItemStack[h_()];
for (int i = 0; i < result.length; i++) {
result[i] = a(i);
}
@@ -22,8 +22,8 @@ public class InventoryLargeChest implements IInventory { c = iinventory1;
}
- public int a() {
- return b.a() + c.a();
+ public int h_() {
+ return b.h_() + c.h_();
}
public String b() {
@@ -31,24 +31,24 @@ public class InventoryLargeChest implements IInventory { }
public ItemStack a(int i) {
- if (i >= b.a()) {
- return c.a(i - b.a());
+ if (i >= b.h_()) {
+ return c.a(i - b.h_());
} else {
return b.a(i);
}
}
- public ItemStack a(int i, int j) {
- if (i >= b.a()) {
- return c.a(i - b.a(), j);
+ public ItemStack b(int i, int j) {
+ if (i >= b.h_()) {
+ return c.b(i - b.h_(), j);
} else {
- return b.a(i, j);
+ return b.b(i, j);
}
}
public void a(int i, ItemStack itemstack) {
- if (i >= b.a()) {
- c.a(i - b.a(), itemstack);
+ if (i >= b.h_()) {
+ c.a(i - b.h_(), itemstack);
} else {
b.a(i, itemstack);
}
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index e4c796a5..531ba841 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -41,10 +41,10 @@ public class InventoryPlayer implements IInventory { return -1;
}
- private int e(int k) {
- for (int l = 0; l < a.length; l++) {
- if (a[l] != null && a[l].c == k && a[l].a < a[l].b() && a[l].a < c()) {
- return l;
+ private int c(ItemStack itemstack) {
+ for (int k = 0; k < a.length; k++) {
+ if (a[k] != null && a[k].c == itemstack.c && a[k].c() && a[k].a < a[k].b() && a[k].a < c() && (!a[k].e() || a[k].h() == itemstack.h())) {
+ return k;
}
}
@@ -61,8 +61,10 @@ public class InventoryPlayer implements IInventory { return -1;
}
- private int b(int k, int l) {
- int i1 = e(k);
+ private int d(ItemStack itemstack) {
+ int k = itemstack.c;
+ int l = itemstack.a;
+ int i1 = c(itemstack);
if (i1 < 0) {
i1 = j();
@@ -71,7 +73,7 @@ public class InventoryPlayer implements IInventory { return l;
}
if (a[i1] == null) {
- a[i1] = new ItemStack(k, 0);
+ a[i1] = new ItemStack(k, 0, itemstack.h());
}
int j1 = l;
@@ -97,7 +99,6 @@ public class InventoryPlayer implements IInventory { a[k].b--;
}
}
-
}
public boolean b(int k) {
@@ -113,8 +114,8 @@ public class InventoryPlayer implements IInventory { }
public boolean a(ItemStack itemstack) {
- if (itemstack.d == 0) {
- itemstack.a = b(itemstack.c, itemstack.a);
+ if (!itemstack.f()) {
+ itemstack.a = d(itemstack);
if (itemstack.a == 0) {
return true;
}
@@ -130,7 +131,7 @@ public class InventoryPlayer implements IInventory { }
}
- public ItemStack a(int k, int l) {
+ public ItemStack b(int k, int l) {
ItemStack aitemstack[] = a;
if (k >= a.length) {
@@ -218,7 +219,7 @@ public class InventoryPlayer implements IInventory { }
}
- public int a() {
+ public int h_() {
return a.length + 4;
}
@@ -251,7 +252,7 @@ public class InventoryPlayer implements IInventory { }
public boolean b(Block block) {
- if (block.bs != Material.d && block.bs != Material.e && block.bs != Material.t && block.bs != Material.s) {
+ if (block.bt != Material.d && block.bt != Material.e && block.bt != Material.t && block.bt != Material.s) {
return true;
}
ItemStack itemstack = a(c);
@@ -270,13 +271,13 @@ public class InventoryPlayer implements IInventory { for (int j1 = 0; j1 < b.length; j1++) {
if (b[j1] != null && (b[j1].a() instanceof ItemArmor)) {
- int k1 = b[j1].c();
- int l1 = b[j1].d;
+ int k1 = b[j1].i();
+ int l1 = b[j1].g();
int i2 = k1 - l1;
l += i2;
i1 += k1;
- int j2 = ((ItemArmor) b[j1].a()).bc;
+ int j2 = ((ItemArmor) b[j1].a()).bh;
k += j2;
}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index e37d9ac3..269ba319 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -16,7 +16,7 @@ public class ItemBlock extends Item { public ItemBlock(int i) { super(i); a = i + 256; - a(Block.m[i + 256].a(2)); + b(Block.m[i + 256].a(2)); } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { @@ -31,7 +31,7 @@ public class ItemBlock extends Item { BlockFace faceClicked = CraftBlock.notchToBlockFace(l); // CraftBukkit end - if (world.a(i, j, k) == Block.aS.bh) { + if (world.a(i, j, k) == Block.aS.bi) { l = 0; } else { if (l == 0) { @@ -62,7 +62,7 @@ public class ItemBlock extends Item { Block block = Block.m[a]; // This executes the placement of the block - if (world.d(i, j, k, a)) { + if (world.e(i, j, k, a)) { CraftBlock placedBlock = (CraftBlock) blockClicked.getFace(faceClicked) ; CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); @@ -91,11 +91,11 @@ public class ItemBlock extends Item { world.c(i, j, k, oldData); } else { world.g(i, j, k); - world.g(i, j, k, this.a); + world.h(i, j, k, this.a); Block.m[a].c(world, i, j, k, l); Block.m[a].a(world, i, j, k, ((EntityLiving) (entityplayer))); - world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.bq.c(), (block.bq.a() + 1.0F) / 2.0F, block.bq.b() * 0.8F); + world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.br.c(), (block.br.a() + 1.0F) / 2.0F, block.br.b() * 0.8F); itemstack.a--; } } diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java index 659b4e1b..a7e1abf7 100644 --- a/src/main/java/net/minecraft/server/ItemBoat.java +++ b/src/main/java/net/minecraft/server/ItemBoat.java @@ -12,7 +12,7 @@ public class ItemBoat extends Item { public ItemBoat(int i) { super(i); - aX = 1; + bb = 1; } public ItemStack a(ItemStack itemstack, World world, EntityPlayer entityplayer) { @@ -37,7 +37,7 @@ public class ItemBoat extends Item { if (movingobjectposition == null) { return itemstack; } - if (movingobjectposition.a == 0) { + if (movingobjectposition.a == EnumMovingObjectType.a) { int i = movingobjectposition.b; int j = movingobjectposition.c; int k = movingobjectposition.d; diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java index d9478fa6..8944b8e6 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -18,8 +18,8 @@ public class ItemBucket extends Item { public ItemBucket(int i, int j) { super(i); - aX = 1; - aY = 64; + bb = 1; + bc = 64; a = j; } @@ -45,7 +45,7 @@ public class ItemBucket extends Item { if (movingobjectposition == null) { return itemstack; } - if (movingobjectposition.a == 0) { + if (movingobjectposition.a == EnumMovingObjectType.a) { int i = movingobjectposition.b; int j = movingobjectposition.c; int k = movingobjectposition.d; @@ -72,7 +72,7 @@ public class ItemBucket extends Item { return itemstack; } // CraftBukkit end - world.d(i, j, k, 0); + world.e(i, j, k, 0); return new ItemStack(Item.av); } if (world.c(i, j, k) == Material.g && world.b(i, j, k) == 0) { @@ -84,7 +84,7 @@ public class ItemBucket extends Item { return itemstack; } // CraftBukkit end - world.d(i, j, k, 0); + world.e(i, j, k, 0); return new ItemStack(Item.aw); } } else { @@ -110,7 +110,7 @@ public class ItemBucket extends Item { i++; } if (world.e(i, j, k) || !world.c(i, j, k).a()) { - if (world.q.d && a == Block.A.bh) { + if (world.q.d && a == Block.A.bi) { world.a(d + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F); for (int l = 0; l < 8; l++) { world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java index 00920b00..637e99c6 100644 --- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java +++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java @@ -15,8 +15,8 @@ public class ItemFlintAndSteel extends Item { public ItemFlintAndSteel(int i) { super(i); - aX = 1; - aY = 64; + bb = 1; + bc = 64; } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { @@ -63,7 +63,7 @@ public class ItemFlintAndSteel extends Item { // CraftBukkit end world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F); - world.d(i, j, k, Block.ar.bh); + world.e(i, j, k, Block.ar.bi); } itemstack.b(1); return true; diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java index d0fc4292..f9562139 100644 --- a/src/main/java/net/minecraft/server/ItemHoe.java +++ b/src/main/java/net/minecraft/server/ItemHoe.java @@ -12,17 +12,17 @@ import org.bukkit.event.player.PlayerItemEvent; public class ItemHoe extends Item { - public ItemHoe(int i, int j) { + public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) { super(i); - aX = 1; - aY = 32 << j; + bb = 1; + bc = enumtoolmaterial.a(); } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { int i1 = world.a(i, j, k); Material material = world.c(i, j + 1, k); - if (!material.a() && i1 == Block.u.bh || i1 == Block.v.bh) { + if (!material.a() && i1 == Block.u.bi || i1 == Block.v.bi) { // CraftBukkit start - Hoes CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); @@ -36,13 +36,13 @@ public class ItemHoe extends Item { Block block = Block.aA; - world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.bq.c(), (block.bq.a() + 1.0F) / 2.0F, block.bq.b() * 0.8F); + world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.br.c(), (block.br.a() + 1.0F) / 2.0F, block.br.b() * 0.8F); if (world.z) { return true; } - world.d(i, j, k, block.bh); + world.e(i, j, k, block.bi); itemstack.b(1); - if (world.l.nextInt(8) == 0 && i1 == Block.u.bh) { + if (world.l.nextInt(8) == 0 && i1 == Block.u.bi) { int j1 = 1; for (int k1 = 0; k1 < j1; k1++) { diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 83b755b7..701c6c27 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -70,7 +70,7 @@ public class ItemInWorldManager { public boolean b(int j, int k, int l) { Block block = Block.m[b.a(j, k, l)]; int i1 = b.b(j, k, l); - boolean flag = b.d(j, k, l, 0); + boolean flag = b.e(j, k, l, 0); if (block != null && flag) { block.a(b, j, k, l, i1); @@ -82,13 +82,13 @@ public class ItemInWorldManager { int i1 = b.a(j, k, l); int j1 = b.b(j, k, l); boolean flag = b(j, k, l); - ItemStack itemstack = a.M(); + ItemStack itemstack = a.P(); if (itemstack != null) { itemstack.a(i1, j, k, l); if (itemstack.a == 0) { itemstack.a(a); - a.N(); + a.Q(); } } if (flag && a.b(Block.m[i1])) { diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java index c8c0012b..23b592f2 100644 --- a/src/main/java/net/minecraft/server/ItemMinecart.java +++ b/src/main/java/net/minecraft/server/ItemMinecart.java @@ -14,14 +14,14 @@ public class ItemMinecart extends Item { public ItemMinecart(int i, int j) { super(i); - aX = 1; + bb = 1; a = j; } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { int i1 = world.a(i, j, k); - if (i1 == Block.aG.bh) { + if (i1 == Block.aG.bi) { // CraftBukkit start - Minecarts CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java index da2e2b28..ee942843 100644 --- a/src/main/java/net/minecraft/server/ItemRedstone.java +++ b/src/main/java/net/minecraft/server/ItemRedstone.java @@ -51,7 +51,7 @@ public class ItemRedstone extends Item { // CraftBukkit end itemstack.a--; - world.d(i, j, k, Block.av.bh); + world.e(i, j, k, Block.av.bi); } return true; } diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java index 31633441..ae33789d 100644 --- a/src/main/java/net/minecraft/server/ItemSeeds.java +++ b/src/main/java/net/minecraft/server/ItemSeeds.java @@ -23,7 +23,7 @@ public class ItemSeeds extends Item { } int i1 = world.a(i, j, k); - if (i1 == Block.aA.bh) { + if (i1 == Block.aA.bi && world.e(i, j + 1, k)) { // CraftBukkit start - Seeds CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); @@ -37,7 +37,7 @@ public class ItemSeeds extends Item { } // CraftBukkit end - world.d(i, j + 1, k, a); + world.e(i, j + 1, k, a); itemstack.a--; return true; } else { diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java index 1fabaa9f..da0e62d5 100644 --- a/src/main/java/net/minecraft/server/ItemSign.java +++ b/src/main/java/net/minecraft/server/ItemSign.java @@ -12,8 +12,8 @@ public class ItemSign extends Item { public ItemSign(int i) { super(i); - aY = 64; - aX = 1; + bc = 64; + bb = 1; } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { @@ -58,12 +58,12 @@ public class ItemSign extends Item { // CraftBukkit end if (l == 1) { - world.b(i, j, k, Block.aD.bh, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf); + world.b(i, j, k, Block.aD.bi, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf); } else { - world.b(i, j, k, Block.aI.bh, l); + world.b(i, j, k, Block.aI.bi, l); } itemstack.a--; - TileEntitySign tileentitysign = (TileEntitySign) world.l(i, j, k); + TileEntitySign tileentitysign = (TileEntitySign) world.m(i, j, k); if (tileentitysign != null) { entityplayer.a(tileentitysign); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java new file mode 100644 index 00000000..5d30421c --- /dev/null +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +1,184 @@ +package net.minecraft.server; + +public final class ItemStack { + + public int a; + public int b; + public int c; + public int d; // Craftbukkit - make public + + public ItemStack(Block block) { + this(block, 1); + } + + public ItemStack(Block block, int k) { + this(block.bi, k, 0); + } + + public ItemStack(Block block, int k, int l) { + this(block.bi, k, l); + } + + public ItemStack(Item item) { + this(item.ba, 1, 0); + } + + public ItemStack(Item item, int k) { + this(item.ba, k, 0); + } + + public ItemStack(Item item, int k, int l) { + this(item.ba, k, l); + } + + public ItemStack(int k, int l, int i1) { + a = 0; + c = k; + a = l; + d = i1; + } + + public ItemStack(NBTTagCompound nbttagcompound) { + a = 0; + b(nbttagcompound); + } + + public ItemStack a(int k) { + a -= k; + return new ItemStack(c, k, d); + } + + public Item a() { + return Item.c[c]; + } + + public boolean a(EntityPlayer entityplayer, World world, int k, int l, int i1, int j1) { + return a().a(this, entityplayer, world, k, l, i1, j1); + } + + public float a(Block block) { + return a().a(this, block); + } + + public ItemStack a(World world, EntityPlayer entityplayer) { + return a().a(this, world, entityplayer); + } + + public NBTTagCompound a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("id", (short) c); + nbttagcompound.a("Count", (byte) a); + nbttagcompound.a("Damage", (short) d); + return nbttagcompound; + } + + public void b(NBTTagCompound nbttagcompound) { + c = ((int) (nbttagcompound.c("id"))); + a = ((int) (nbttagcompound.b("Count"))); + d = ((int) (nbttagcompound.c("Damage"))); + } + + public int b() { + return a().b(); + } + + public boolean c() { + return b() > 1 && (!d() || !f()); + } + + public boolean d() { + return Item.c[c].d() > 0; + } + + public boolean e() { + return Item.c[c].c(); + } + + public boolean f() { + return d() && d > 0; + } + + public int g() { + return d; + } + + public int h() { + return d; + } + + public int i() { + return Item.c[c].d(); + } + + public void b(int k) { + if (!d()) { + return; + } + d += k; + if (d > i()) { + a--; + if (a < 0) { + a = 0; + } + d = 0; + } + } + + public void a(EntityLiving entityliving) { + Item.c[c].a(this, entityliving); + } + + public void a(int k, int l, int i1, int j1) { + Item.c[c].a(this, k, l, i1, j1); + } + + public int a(Entity entity) { + return Item.c[c].a(entity); + } + + public boolean b(Block block) { + return Item.c[c].a(block); + } + + public void a(EntityPlayer entityplayer) {} + + public void b(EntityLiving entityliving) { + Item.c[c].b(this, entityliving); + } + + public ItemStack j() { + return new ItemStack(c, a, d); + } + + public static boolean a(ItemStack itemstack, ItemStack itemstack1) { + if (itemstack == null && itemstack1 == null) { + return true; + } + if (itemstack == null || itemstack1 == null) { + return false; + } else { + return itemstack.c(itemstack1); + } + } + + private boolean c(ItemStack itemstack) { + if (a != itemstack.a) { + return false; + } + if (c != itemstack.c) { + return false; + } + return d == itemstack.d; + } + + public boolean a(ItemStack itemstack) { + return c == itemstack.c && d == itemstack.d; + } + + public static ItemStack b(ItemStack itemstack) { + return itemstack != null ? itemstack.j() : null; + } + + public String toString() { + return (new StringBuilder()).append(a).append("x").append(Item.c[c].a()).append("@").append(d).toString(); + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 1cd9bfdc..fafcc071 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -61,7 +61,7 @@ public class MinecraftServer implements ICommandListener, Runnable { ((Thread) (threadcommandreader)).setDaemon(true); ((Thread) (threadcommandreader)).start(); ConsoleLogManager.a(); - a.info("Starting minecraft server version Beta 1.1_02"); + a.info("Starting minecraft server version Beta 1.2"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { a.warning("**** NOT ENOUGH RAM!"); a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); @@ -111,16 +111,29 @@ public class MinecraftServer implements ICommandListener, Runnable { e = new WorldServer(this, new File("."), s, d.a("hellworld", false) ? -1 : 0); e.a(((IWorldAccess) (new WorldManager(this)))); e.k = d.a("spawn-monsters", true) ? 1 : 0; + e.a(d.a("spawn-monsters", true), m); f.a(e); - byte byte0 = 10; + char c1 = '\304'; + long l1 = System.currentTimeMillis(); - for (int i1 = -byte0; i1 <= byte0; i1++) { - a("Preparing spawn area", ((i1 + byte0) * 100) / (byte0 + byte0 + 1)); - for (int j1 = -byte0; j1 <= byte0; j1++) { - if (!o) { - return; + for (int i1 = -c1; i1 <= c1 && o; i1 += 16) { + for (int j1 = -c1; j1 <= c1 && o; j1 += 16) { + long l2 = System.currentTimeMillis(); + + if (l2 < l1) { + l1 = l2; + } + if (l2 > l1 + 1000L) { + int k1 = (c1 * 2 + 1) * (c1 * 2 + 1); + int i2 = (i1 + c1) * (c1 * 2 + 1) + (j1 + 1); + + a("Preparing spawn area", (i2 * 100) / k1); + l1 = l2; + } + e.A.d(e.m + i1 >> 4, e.o + j1 >> 4); + while (e.d() && o) { + ; } - e.A.d((e.m >> 4) + i1, (e.o >> 4) + j1); } } @@ -207,9 +220,12 @@ public class MinecraftServer implements ICommandListener, Runnable { } } } finally { - g(); - g = true; - System.exit(0); + try { + g(); + g = true; + } finally { + System.exit(0); + } } } @@ -405,7 +421,7 @@ public class MinecraftServer implements ICommandListener, Runnable { if (k1 > 64) { k1 = 64; } - entityplayermp4.b(new ItemStack(j1, k1)); + entityplayermp4.b(new ItemStack(j1, k1, 0)); } else { icommandlistener.b((new StringBuilder()).append("There's no item with id ").append(j1).toString()); } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 62970f2e..a769a4c0 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -106,7 +106,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { float f1 = e.v; float f2 = e.w; - e.k.A(); + e.k.E(); double d3 = e.p; double d5 = e.q; double d7 = e.r; @@ -122,7 +122,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { d10 = packet10flying.c; } e.A = packet10flying.g; - e.F(); + e.n(); e.c(d9, 0.0D, d10); e.b(d3, d5, d7, f1, f2); e.s = d9; @@ -131,7 +131,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { d.e.b(e.k, true); } if (e.k != null) { - e.k.A(); + e.k.E(); } d.f.b(e); g = e.p; @@ -164,13 +164,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener { a("Illegal stance"); a.warning((new StringBuilder()).append(e.aw).append(" had an illegal stance: ").append(d11).toString()); } - e.ak = packet10flying.d; + e.al = packet10flying.d; } if (packet10flying.i) { f3 = packet10flying.e; f4 = packet10flying.f; } - e.F(); + e.n(); e.R = 0.0F; e.b(g, h, i, f3, f4); double d12 = d4 - e.p; @@ -242,7 +242,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet14BlockDig packet14blockdig) { if (packet14blockdig.e == 4) { - e.L(); + e.O(); return; } boolean flag = d.e.B = d.f.g(e.aw); @@ -269,7 +269,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } double d5 = e.q; - e.q = e.ak; + e.q = e.al; e.q = d5; } int k1 = packet14blockdig.d; @@ -407,10 +407,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit We still call this event even in spawn protection. // Don't call this event if using Buckets / signs switch (craftItem.getType()) { - case Sign: - case Bucket: - case WaterBucket: - case LavaBucket: + case SIGN: + case BUCKET: + case WATER_BUCKET: + case LAVA_BUCKET: break; default: server.getPluginManager().callEvent(pie); @@ -470,7 +470,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { e.an.a[e.an.c] = null; } e.am = true; - e.an.a[e.an.c] = ItemStack.a(e.an.a[e.an.c]); + e.an.a[e.an.c] = ItemStack.b(e.an.a[e.an.c]); Slot slot = e.ap.a(((IInventory) (e.an)), e.an.c); e.ap.a(); @@ -578,11 +578,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet18ArmAnimation packet18armanimation) { if (packet18armanimation.b == 1) { - e.H(); - } else if (packet18armanimation.b == 104) { - e.al = true; - } else if (packet18armanimation.b == 105) { - e.al = false; + e.K(); + } + } + + public void a(Packet19 packet19) { + System.out.println((new StringBuilder()).append("handlePlayerCommand ").append(packet19.a).append(" ").append(packet19.b).toString()); + if (packet19.b == 1) { + e.b(true); + } else if (packet19.b == 2) { + e.b(false); } } @@ -615,7 +620,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet9 packet9) { - if (e.ba > 0) { + if (e.aZ > 0) { return; } else { e = d.f.d(e); @@ -625,7 +630,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet101 packet101) { - e.K(); + e.N(); } public void a(Packet102 packet102) { @@ -636,7 +641,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { e.a.b(((Packet) (new Packet106(packet102.a, packet102.d, true)))); e.am = true; e.ap.a(); - e.J(); + e.M(); e.am = false; } else { k.put(((Integer.valueOf(e.ap.f))), ((Short.valueOf(packet102.d)))); @@ -663,7 +668,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet130 packet130) { if (d.e.f(packet130.a, packet130.b, packet130.c)) { - TileEntity tileentity = d.e.l(packet130.a, packet130.b, packet130.c); + TileEntity tileentity = d.e.m(packet130.a, packet130.b, packet130.c); for (int l = 0; l < 4; l++) { boolean flag = true; @@ -676,7 +681,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener { flag = false; } } - } if (!flag) { packet130.d[l] = "!?"; diff --git a/src/main/java/net/minecraft/server/NetworkAcceptThread.java b/src/main/java/net/minecraft/server/NetworkAcceptThread.java deleted file mode 100644 index 05108d6b..00000000 --- a/src/main/java/net/minecraft/server/NetworkAcceptThread.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.minecraft.server; - -import java.io.IOException; -import java.net.InetAddress; -import java.util.HashMap; - -class NetworkAcceptThread extends Thread { - - final MinecraftServer a; /* synthetic field */ - - final NetworkListenThread b; /* synthetic field */ - - - NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) { - b = networklistenthread; - a = minecraftserver; - // super(s); - } - - @Override - public void run() { - HashMap<InetAddress, Long> clients = new HashMap<InetAddress, Long>(); - do { - if (!b.b) { - break; - } - try { - java.net.Socket socket = NetworkListenThread.a(b).accept(); - if (socket != null) { - InetAddress addr = socket.getInetAddress(); - if (clients.containsKey(addr)) { - if (System.currentTimeMillis() - clients.get(addr) < 5000) { - clients.put(addr, System.currentTimeMillis()); - socket.close(); - continue; - } - } - clients.put(addr, System.currentTimeMillis()); - NetLoginHandler netloginhandler = new NetLoginHandler(a, socket, (new StringBuilder()).append("Connection #").append(NetworkListenThread.b(b)).toString()); - NetworkListenThread.a(b, netloginhandler); - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); - } - } while (true); - } -} diff --git a/src/main/java/net/minecraft/server/NetworkListenThread.java b/src/main/java/net/minecraft/server/NetworkListenThread.java deleted file mode 100644 index 2a5e0b26..00000000 --- a/src/main/java/net/minecraft/server/NetworkListenThread.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.minecraft.server; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class NetworkListenThread { - - public static Logger a = Logger.getLogger("Minecraft"); - private ServerSocket d; - private Thread e; - public volatile boolean b; - private int f; - private ArrayList g; - private ArrayList h; - public MinecraftServer c; - - public NetworkListenThread(MinecraftServer minecraftserver, InetAddress inetaddress, int i) { - b = false; - f = 0; - g = new ArrayList(); - h = new ArrayList(); - c = minecraftserver; - try { - d = new ServerSocket(i, 20, inetaddress); - } catch (IOException ioexception) { - } - d.setPerformancePreferences(0, 2, 1); - b = true; - e = new NetworkAcceptThread(this, "Listen thread", minecraftserver); - e.start(); - } - - public void a(NetServerHandler netserverhandler) { - h.add(netserverhandler); - } - - private void a(NetLoginHandler netloginhandler) { - if (netloginhandler == null) { - throw new IllegalArgumentException("Got null pendingconnection!"); - } else { - g.add(netloginhandler); - return; - } - } - - public void a() { - for (int i = 0; i < g.size(); i++) { - NetLoginHandler netloginhandler = (NetLoginHandler) g.get(i); - try { - netloginhandler.a(); - } catch (Exception exception) { - netloginhandler.a("Internal server error"); - a.log(Level.WARNING, (new StringBuilder()).append("Failed to handle packet: ").append(exception).toString(), exception); - } - if (netloginhandler.c) { - g.remove(i--); - } - } - - for (int j = 0; j < h.size(); j++) { - NetServerHandler netserverhandler = (NetServerHandler) h.get(j); - - try { - netserverhandler.a(); - } catch (Exception exception1) { - a.log(Level.WARNING, (new StringBuilder()).append("Failed to handle packet: ").append(exception1).toString(), exception1); - netserverhandler.a("Internal server error"); - } - if (netserverhandler.c) { - h.remove(j--); - } - } - - } - - static ServerSocket a(NetworkListenThread networklistenthread) { - return networklistenthread.d; - } - - static int b(NetworkListenThread networklistenthread) { - return networklistenthread.f++; - } - - static void a(NetworkListenThread networklistenthread, NetLoginHandler netloginhandler) { - networklistenthread.a(netloginhandler); - } -} diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 141286be..36b1260e 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -148,7 +148,7 @@ public class ServerConfigurationManager { d.a(entityplayermp1); c.e.a(((Entity) (entityplayermp1))); b.add(((entityplayermp1))); - entityplayermp1.k(); + entityplayermp1.l(); return entityplayermp1; } diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java index c966c17b..6827e9fd 100644 --- a/src/main/java/net/minecraft/server/Slot.java +++ b/src/main/java/net/minecraft/server/Slot.java @@ -41,7 +41,7 @@ public class Slot { }
public ItemStack a(int i) {
- return b.a(a, i);
+ return b.b(a, i);
}
public boolean a(IInventory iinventory, int i) {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index a1285c1a..6e057db9 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -14,7 +14,7 @@ public class TileEntityChest extends TileEntity implements IInventory { e = new ItemStack[36];
}
- public int a() {
+ public int h_() {
return 27;
}
@@ -22,7 +22,7 @@ public class TileEntityChest extends TileEntity implements IInventory { return e[i];
}
- public ItemStack a(int i, int j) {
+ public ItemStack b(int i, int j) {
if (e[i] != null) {
if (e[i].a <= j) {
ItemStack itemstack = e[i];
@@ -59,7 +59,7 @@ public class TileEntityChest extends TileEntity implements IInventory { super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Items");
- e = new ItemStack[a()];
+ e = new ItemStack[h_()];
for (int i = 0; i < nbttaglist.b(); i++) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.b("Slot") & 0xff;
@@ -92,7 +92,7 @@ public class TileEntityChest extends TileEntity implements IInventory { }
public boolean a_(EntityPlayer entityplayer) {
- if (a.l(b, c, d) != this) {
+ if (a.m(b, c, d) != this) {
return false;
}
return entityplayer.d((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D) <= 64D;
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 164a03da..e7122765 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -20,7 +20,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { g = 0;
}
- public int a() {
+ public int h_() {
return h.length;
}
@@ -28,7 +28,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { return h[j];
}
- public ItemStack a(int j, int k) {
+ public ItemStack b(int j, int k) {
if (h[j] != null) {
if (h[j].a <= k) {
ItemStack itemstack = h[j];
@@ -62,7 +62,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Items");
- h = new ItemStack[a()];
+ h = new ItemStack[h_()];
for (int j = 0; j < nbttaglist.b(); j++) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(j);
byte byte0 = nbttagcompound1.b("Slot");
@@ -100,11 +100,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory { return 64;
}
- public boolean g() {
+ public boolean e() {
return e > 0;
}
- public void e() {
+ public void f() {
boolean flag = e > 0;
boolean flag1 = false;
@@ -124,7 +124,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { }
}
}
- if (g() && i()) {
+ if (e() && i()) {
g++;
if (g == 200) {
g = 0;
@@ -148,32 +148,32 @@ public class TileEntityFurnace extends TileEntity implements IInventory { if (h[0] == null) {
return false;
}
- int j = b(h[0].a().aW);
+ ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba);
- if (j < 0) {
+ if (itemstack == null) {
return false;
}
if (h[2] == null) {
return true;
}
- if (h[2].c != j) {
+ if (!h[2].a(itemstack)) {
return false;
}
if (h[2].a < c() && h[2].a < h[2].b()) {
return true;
}
- return h[2].a < Item.c[j].b();
+ return h[2].a < itemstack.b();
}
public void h() {
if (!i()) {
return;
}
- int j = b(h[0].a().aW);
+ ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba);
if (h[2] == null) {
- h[2] = new ItemStack(j, 1);
- } else if (h[2].c == j) {
+ h[2] = itemstack.j();
+ } else if (h[2].c == itemstack.c) {
h[2].a++;
}
h[0].a--;
@@ -182,57 +182,28 @@ public class TileEntityFurnace extends TileEntity implements IInventory { }
}
- private int b(int j) {
- if (j == Block.H.bh) {
- return Item.m.aW;
- }
- if (j == Block.G.bh) {
- return Item.n.aW;
- }
- if (j == Block.aw.bh) {
- return Item.l.aW;
- }
- if (j == Block.E.bh) {
- return Block.M.bh;
- }
- if (j == Item.ao.aW) {
- return Item.ap.aW;
- }
- if (j == Item.aS.aW) {
- return Item.aT.aW;
- }
- if (j == Block.w.bh) {
- return Block.t.bh;
- }
- if (j == Item.aG.aW) {
- return Item.aF.aW;
- } else {
- return -1;
- }
- }
-
private int a(ItemStack itemstack) {
if (itemstack == null) {
return 0;
}
- int j = itemstack.a().aW;
+ int j = itemstack.a().ba;
- if (j < 256 && Block.m[j].bs == Material.c) {
+ if (j < 256 && Block.m[j].bt == Material.c) {
return 300;
}
- if (j == Item.B.aW) {
+ if (j == Item.B.ba) {
return 100;
}
- if (j == Item.k.aW) {
+ if (j == Item.k.ba) {
return 1600;
}
- return j != Item.aw.aW ? 0 : 20000;
+ return j != Item.aw.ba ? 0 : 20000;
}
public boolean a_(EntityPlayer entityplayer) {
- if (a.l(b, c, d) != this) {
+ if (a.m(b, c, d) != this) {
return false;
}
return entityplayer.d((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D) <= 64D;
}
-}
+}
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index f0eb3c13..baff7218 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -34,8 +34,8 @@ public class WorldServer extends World { } public void a(Entity entity, boolean flag) { - if (!D.m && (entity instanceof EntityAnimals)) { - entity.l(); + if (!D.m && ((entity instanceof EntityAnimals) || (entity instanceof EntityWaterMob))) { + entity.q(); } if (entity.j == null || !(entity.j instanceof EntityPlayer)) { super.a(entity, flag); @@ -107,15 +107,15 @@ public class WorldServer extends World { private final CraftServer server; @Override - public boolean c(int i1, int j1, int k1, int l1) { - boolean result = super.c(i1, j1, k1, l1); + public boolean d(int i1, int j1, int k1, int l1) { + boolean result = super.d(i1, j1, k1, l1); if ((result) && (world != null)) world.updateBlock(i1, j1, k1); return result; } @Override - public boolean a(int i1, int j1, int k1, int l1) { - boolean result = super.a(i1, j1, k1, l1); + public boolean b(int i1, int j1, int k1, int l1) { + boolean result = super.b(i1, j1, k1, l1); if ((result) && (world != null)) world.updateBlock(i1, j1, k1); return result; } @@ -138,17 +138,17 @@ public class WorldServer extends World { // XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! // XXX: done because it calls private k() @Override - public void g(int i1, int j1, int k1, int l1) { - k(i1 - 1, j1, k1, l1); - k(i1 + 1, j1, k1, l1); - k(i1, j1 - 1, k1, l1); - k(i1, j1 + 1, k1, l1); - k(i1, j1, k1 - 1, l1); - k(i1, j1, k1 + 1, l1); + public void h(int i1, int j1, int k1, int l1) { + l(i1 - 1, j1, k1, l1); + l(i1 + 1, j1, k1, l1); + l(i1, j1 - 1, k1, l1); + l(i1, j1 + 1, k1, l1); + l(i1, j1, k1 - 1, l1); + l(i1, j1, k1 + 1, l1); } // XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! - private void k(int i1, int j1, int k1, int l1) { + private void l(int i1, int j1, int k1, int l1) { if (i || z) { return; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/CraftBlock.java index 64b13a4f..18ea916a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftBlock.java @@ -24,7 +24,7 @@ public class CraftBlock implements Block { this.z = z; this.type = type; this.data = data; - this.light = (byte)world.getHandle().i(x, y, z); + this.light = (byte)world.getHandle().j(x, y, z); this.chunk = (CraftChunk)world.getChunkAt(x << 4, z << 4); } @@ -121,7 +121,7 @@ public class CraftBlock implements Block { */ public boolean setTypeID(final int type) { this.type = type; - return world.getHandle().d(x, y, z, type); + return world.getHandle().e(x, y, z, type); } /** @@ -259,9 +259,9 @@ public class CraftBlock implements Block { Material material = getType(); switch (material) { - case Sign: - case SignPost: - case WallSign: + case SIGN: + case SIGN_POST: + case WALL_SIGN: return new CraftSign(this); default: return new CraftBlockState(this); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/CraftInventory.java index b79413d6..b0461d80 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftInventory.java @@ -19,7 +19,7 @@ public class CraftInventory implements org.bukkit.Inventory { }
public int getSize() {
- return getInventory().a();
+ return getInventory().h_();
}
public String getName() {
@@ -42,7 +42,7 @@ public class CraftInventory implements org.bukkit.Inventory { }
public void setItem(int index, ItemStack item) {
- getInventory().a( index, new net.minecraft.server.ItemStack( item.getTypeID(), item.getAmount()));
+ getInventory().a( index, new net.minecraft.server.ItemStack( item.getTypeID(), item.getAmount(), 0));
}
public boolean contains(int materialId) {
@@ -121,7 +121,7 @@ public class CraftInventory implements org.bukkit.Inventory { }
public int firstEmpty() {
- return first(Material.Air);
+ return first(Material.AIR);
}
public int firstPartial(int materialId) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/CraftItemStack.java index 710bad4f..495d46bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftItemStack.java @@ -36,7 +36,7 @@ public class CraftItemStack extends ItemStack { item = null; } else { if (item == null) { - item = new net.minecraft.server.ItemStack(type); + item = new net.minecraft.server.ItemStack(type, 1, 0); super.setAmount(1); } else { item.c = type; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 66f28647..993ab7a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -213,7 +213,7 @@ public class CraftWorld implements World { } public TileEntity getTileEntityAt(final int x, final int y, final int z) { - return world.l(x, y, z); + return world.m(x, y, z); } public String getName() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index f2a0c275..d9ba4deb 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -110,7 +110,7 @@ public class CraftBlockState implements BlockState { */ public void setTypeID(final int type) { this.type = type; - world.getHandle().d(x, y, z, type); + world.getHandle().e(x, y, z, type); } /** |