From 87c36febeb1801bc89ec040dd24db1ebac75ee36 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Thu, 31 Mar 2011 21:40:00 +0100 Subject: Updated to Minecraft version 1.4 --- .../java/net/minecraft/server/BlockBloodStone.java | 5 +- .../java/net/minecraft/server/BlockButton.java | 4 +- .../java/net/minecraft/server/BlockCactus.java | 2 +- src/main/java/net/minecraft/server/BlockDoor.java | 2 +- src/main/java/net/minecraft/server/BlockFire.java | 14 +- .../java/net/minecraft/server/BlockFlowing.java | 18 +- .../java/net/minecraft/server/BlockLeaves.java | 2 +- src/main/java/net/minecraft/server/BlockLever.java | 4 +- .../net/minecraft/server/BlockPressurePlate.java | 2 +- .../java/net/minecraft/server/BlockPumpkin.java | 5 +- .../net/minecraft/server/BlockRedstoneTorch.java | 4 +- .../net/minecraft/server/BlockRedstoneWire.java | 17 +- src/main/java/net/minecraft/server/BlockSign.java | 13 +- src/main/java/net/minecraft/server/Chunk.java | 34 ++- .../net/minecraft/server/ChunkProviderServer.java | 40 +-- .../minecraft/server/ConsoleCommandHandler.java | 4 +- .../net/minecraft/server/ConsoleLogManager.java | 12 +- src/main/java/net/minecraft/server/Entity.java | 114 ++++---- .../java/net/minecraft/server/EntityArrow.java | 14 +- src/main/java/net/minecraft/server/EntityBoat.java | 24 +- src/main/java/net/minecraft/server/EntityCow.java | 2 +- .../java/net/minecraft/server/EntityCreature.java | 43 ++- .../java/net/minecraft/server/EntityCreeper.java | 8 +- src/main/java/net/minecraft/server/EntityEgg.java | 14 +- .../java/net/minecraft/server/EntityFireball.java | 12 +- src/main/java/net/minecraft/server/EntityFish.java | 17 +- .../java/net/minecraft/server/EntityHuman.java | 303 ++++++++++++++++----- src/main/java/net/minecraft/server/EntityItem.java | 17 +- .../java/net/minecraft/server/EntityLiving.java | 138 ++++++---- .../java/net/minecraft/server/EntityMinecart.java | 31 ++- .../java/net/minecraft/server/EntityMonster.java | 12 +- .../java/net/minecraft/server/EntityPigZombie.java | 14 +- .../java/net/minecraft/server/EntityPlayer.java | 61 +++-- .../java/net/minecraft/server/EntitySkeleton.java | 8 +- .../java/net/minecraft/server/EntitySnowball.java | 14 +- .../java/net/minecraft/server/EntitySpider.java | 14 +- .../java/net/minecraft/server/EntityTNTPrimed.java | 11 +- .../java/net/minecraft/server/EntityTracker.java | 7 + .../net/minecraft/server/EntityTrackerEntry.java | 6 +- .../java/net/minecraft/server/EntityZombie.java | 6 +- src/main/java/net/minecraft/server/IInventory.java | 6 +- .../net/minecraft/server/InventoryCraftResult.java | 6 +- .../net/minecraft/server/InventoryCrafting.java | 8 +- .../net/minecraft/server/InventoryLargeChest.java | 24 +- .../java/net/minecraft/server/InventoryPlayer.java | 56 ++-- src/main/java/net/minecraft/server/ItemBlock.java | 2 +- src/main/java/net/minecraft/server/ItemBucket.java | 1 - src/main/java/net/minecraft/server/ItemDoor.java | 1 - .../net/minecraft/server/ItemFlintAndSteel.java | 6 +- src/main/java/net/minecraft/server/ItemHoe.java | 4 +- .../net/minecraft/server/ItemInWorldManager.java | 55 ++-- src/main/java/net/minecraft/server/ItemSign.java | 1 - src/main/java/net/minecraft/server/ItemStack.java | 34 ++- .../java/net/minecraft/server/MinecraftServer.java | 63 +++-- .../java/net/minecraft/server/NetLoginHandler.java | 12 +- .../net/minecraft/server/NetServerHandler.java | 75 ++--- .../java/net/minecraft/server/NetworkManager.java | 6 + src/main/java/net/minecraft/server/Packet.java | 4 +- .../java/net/minecraft/server/PlayerInstance.java | 4 +- .../server/ServerConfigurationManager.java | 23 +- src/main/java/net/minecraft/server/Slot.java | 24 +- .../net/minecraft/server/ThreadCommandReader.java | 2 +- .../net/minecraft/server/ThreadLoginVerifier.java | 37 --- .../java/net/minecraft/server/TileEntityChest.java | 16 +- .../net/minecraft/server/TileEntityDispenser.java | 16 +- .../net/minecraft/server/TileEntityFurnace.java | 22 +- .../net/minecraft/server/TileEntityMobSpawner.java | 2 +- .../java/net/minecraft/server/TileEntitySign.java | 40 --- src/main/java/net/minecraft/server/World.java | 114 ++++---- .../java/net/minecraft/server/WorldServer.java | 8 +- 70 files changed, 985 insertions(+), 759 deletions(-) delete mode 100644 src/main/java/net/minecraft/server/ThreadLoginVerifier.java delete mode 100644 src/main/java/net/minecraft/server/TileEntitySign.java (limited to 'src/main/java/net/minecraft/server') diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java index 08aa0d62..9b2c0baf 100644 --- a/src/main/java/net/minecraft/server/BlockBloodStone.java +++ b/src/main/java/net/minecraft/server/BlockBloodStone.java @@ -1,8 +1,10 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.block.BlockRedstoneEvent; +// CraftBukkit end public class BlockBloodStone extends Block { @@ -17,8 +19,9 @@ public class BlockBloodStone extends Block { CraftServer server = ((WorldServer) world).getServer(); org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k); int power = block.getBlockPower(); + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); - server.getPluginManager().callEvent(eventRedstone); + server.getPluginManager().callEvent(eventRedstone); } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 1d09e635..9ed938e9 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -78,7 +78,7 @@ public class BlockButton extends Block { } if (flag) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } @@ -86,7 +86,7 @@ public class BlockButton extends Block { private boolean h(World world, int i, int j, int k) { if (!this.a(world, i, j, k)) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); return false; } else { diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index ffa42f97..90aab767 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -57,7 +57,7 @@ public class BlockCactus extends Block { public void a(World world, int i, int j, int k, int l) { if (!this.f(world, i, j, k)) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index 198e070a..fea50660 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -169,7 +169,7 @@ public class BlockDoor extends Block { if (flag) { if (!world.isStatic) { - this.b_(world, i, j, k, i1); + this.a_(world, i, j, k, i1); } } else if (l > 0 && Block.byId[l].c()) { boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k); diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index 55af20f0..b3cfc9e8 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -166,13 +166,13 @@ public class BlockFire extends Block { if (!world.isEmpty(i, j, k)) { return 0; } else { - int l = this.g(world, i + 1, j, k, b0); + int l = this.f(world, i + 1, j, k, b0); - l = this.g(world, i - 1, j, k, l); - l = this.g(world, i, j - 1, k, l); - l = this.g(world, i, j + 1, k, l); - l = this.g(world, i, j, k - 1, l); - l = this.g(world, i, j, k + 1, l); + l = this.f(world, i - 1, j, k, l); + l = this.f(world, i, j - 1, k, l); + l = this.f(world, i, j + 1, k, l); + l = this.f(world, i, j, k - 1, l); + l = this.f(world, i, j, k + 1, l); return l; } } @@ -185,7 +185,7 @@ public class BlockFire extends Block { return this.a[iblockaccess.getTypeId(i, j, k)] > 0; } - public int g(World world, int i, int j, int k, int l) { + public int f(World world, int i, int j, int k, int l) { int i1 = this.a[world.getTypeId(i, j, k)]; return i1 > l ? i1 : l; diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 873eece8..c7d78b9b 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -2,11 +2,13 @@ package net.minecraft.server; import java.util.Random; +// CraftBukkit Start import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.event.block.BlockFromToEvent; +// CraftBukkit end public class BlockFlowing extends BlockFluids { @@ -47,11 +49,11 @@ public class BlockFlowing extends BlockFluids { byte b1 = -100; this.a = 0; - int j1 = this.f(world, i - 1, j, k, b1); + int j1 = this.e(world, i - 1, j, k, b1); - j1 = this.f(world, i + 1, j, k, j1); - j1 = this.f(world, i, j, k - 1, j1); - j1 = this.f(world, i, j, k + 1, j1); + j1 = this.e(world, i + 1, j, k, j1); + j1 = this.e(world, i, j, k - 1, j1); + j1 = this.e(world, i, j, k + 1, j1); i1 = j1 + b0; if (i1 >= 8 || j1 < 0) { i1 = -1; @@ -135,7 +137,7 @@ public class BlockFlowing extends BlockFluids { } if (!event.isCancelled()) { - this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1); + this.f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1); } } index++; @@ -144,7 +146,7 @@ public class BlockFlowing extends BlockFluids { } } - private void g(World world, int i, int j, int k, int l) { + private void f(World world, int i, int j, int k, int l) { if (this.l(world, i, j, k)) { int i1 = world.getTypeId(i, j, k); @@ -152,7 +154,7 @@ public class BlockFlowing extends BlockFluids { if (this.material == Material.LAVA) { this.h(world, i, j, k); } else { - Block.byId[i1].b_(world, i, j, k, world.getData(i, j, k)); + Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k)); } } @@ -268,7 +270,7 @@ public class BlockFlowing extends BlockFluids { } } - protected int f(World world, int i, int j, int k, int l) { + protected int e(World world, int i, int j, int k, int l) { int i1 = this.g(world, i, j, k); if (i1 < 0) { diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index f7a1c7c1..bd1a330d 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -132,7 +132,7 @@ public class BlockLeaves extends BlockLeavesBase { if (event.isCancelled()) return; // CraftBukkit end - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java index f722cc61..71b8def7 100644 --- a/src/main/java/net/minecraft/server/BlockLever.java +++ b/src/main/java/net/minecraft/server/BlockLever.java @@ -79,7 +79,7 @@ public class BlockLever extends Block { } if (flag) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } @@ -87,7 +87,7 @@ public class BlockLever extends Block { private boolean g(World world, int i, int j, int k) { if (!this.a(world, i, j, k)) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); return false; } else { diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index d6abf5cf..b5ce1bc6 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block { } if (flag) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java index 94f00cc7..0de996b4 100644 --- a/src/main/java/net/minecraft/server/BlockPumpkin.java +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -1,8 +1,10 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.block.BlockRedstoneEvent; +// CraftBukkit end public class BlockPumpkin extends Block { @@ -58,8 +60,9 @@ public class BlockPumpkin extends Block { CraftServer server = ((WorldServer) world).getServer(); org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k); int power = block.getBlockPower(); + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); - server.getPluginManager().callEvent(eventRedstone); + server.getPluginManager().callEvent(eventRedstone); } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java index 85f4b259..35b45841 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -21,7 +21,7 @@ public class BlockRedstoneTorch extends BlockTorch { private boolean a(World world, int i, int j, int k, boolean flag) { if (flag) { - b.add(new RedstoneUpdateInfo(i, j, k, world.k())); + b.add(new RedstoneUpdateInfo(i, j, k, world.l())); } int l = 0; @@ -95,7 +95,7 @@ public class BlockRedstoneTorch extends BlockTorch { public void a(World world, int i, int j, int k, Random random) { boolean flag = this.g(world, i, j, k); - while (b.size() > 0 && world.k() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) { + while (b.size() > 0 && world.l() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) { b.remove(0); } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java index 7caebbc3..254399fa 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -84,15 +84,15 @@ public class BlockRedstoneWire extends Block { } if (j2 != l || j != i1 || k2 != j1) { - l1 = this.g(world, j2, j, k2, l1); + l1 = this.f(world, j2, j, k2, l1); } if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) { if (j2 != l || j + 1 != i1 || k2 != j1) { - l1 = this.g(world, j2, j + 1, k2, l1); + l1 = this.f(world, j2, j + 1, k2, l1); } } else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) { - l1 = this.g(world, j2, j - 1, k2, l1); + l1 = this.f(world, j2, j - 1, k2, l1); } } @@ -144,7 +144,7 @@ public class BlockRedstoneWire extends Block { } boolean flag1 = false; - int i3 = this.g(world, j2, j, k2, -1); + int i3 = this.f(world, j2, j, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { @@ -155,7 +155,7 @@ public class BlockRedstoneWire extends Block { this.a(world, j2, j, k2, i, j, k); } - i3 = this.g(world, j2, l2, k2, -1); + i3 = this.f(world, j2, l2, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { --l1; @@ -262,7 +262,8 @@ public class BlockRedstoneWire extends Block { } } - public int g(World world, int i, int j, int k, int l) { // Craftbukkit made public + // Craftbukkit private-> public + public int f(World world, int i, int j, int k, int l) { if (world.getTypeId(i, j, k) != this.id) { return l; } else { @@ -278,9 +279,9 @@ public class BlockRedstoneWire extends Block { boolean flag = this.a(world, i, j, k); if (!flag) { - this.b_(world, i, j, k, i1); + this.a_(world, i, j, k, i1); world.e(i, j, k, 0); - } else + } else // Craftbukkit if ((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l || Block.DIODE_ON.id == l) { this.g(world, i, j, k); diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java index eab330de..f185c62a 100644 --- a/src/main/java/net/minecraft/server/BlockSign.java +++ b/src/main/java/net/minecraft/server/BlockSign.java @@ -1,10 +1,13 @@ package net.minecraft.server; import java.util.Random; + +// CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.block.Block; import org.bukkit.event.block.BlockRedstoneEvent; +// CraftBukkit end public class BlockSign extends BlockContainer { @@ -99,21 +102,21 @@ public class BlockSign extends BlockContainer { } if (flag) { - this.b_(world, i, j, k, world.getData(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } super.a(world, i, j, k, l); - - // Craftbukkit start + + // CraftBukkit start if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) { CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftServer server = ((WorldServer) world).getServer(); Block block = craftWorld.getBlockAt(i, j, k); int power = block.getBlockPower(); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); - server.getPluginManager().callEvent(eventRedstone); + server.getPluginManager().callEvent(eventRedstone); } - // Craftbukkit end + // CraftBukkit end } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index 95e5fdcd..8b44d873 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -2,12 +2,12 @@ package net.minecraft.server; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; // CraftBukkit start +import java.util.Iterator; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftWorld; // CraftBukkit end @@ -90,7 +90,7 @@ public class Chunk { int i1; - for (i1 = j << 11 | k << 7; l > 0 && Block.q[this.b[i1 + l - 1]] == 0; --l) { + for (i1 = j << 11 | k << 7; l > 0 && Block.q[this.b[i1 + l - 1] & 255] == 0; --l) { ; } @@ -104,7 +104,7 @@ public class Chunk { int k1 = 127; do { - j1 -= Block.q[this.b[i1 + k1]]; + j1 -= Block.q[this.b[i1 + k1] & 255]; if (j1 > 0) { this.f.a(j, k1, k, j1); } @@ -159,7 +159,7 @@ public class Chunk { i1 = j; } - for (int j1 = i << 11 | k << 7; i1 > 0 && Block.q[this.b[j1 + i1 - 1]] == 0; --i1) { + for (int j1 = i << 11 | k << 7; i1 > 0 && Block.q[this.b[j1 + i1 - 1] & 255] == 0; --i1) { ; } @@ -231,7 +231,7 @@ public class Chunk { } public int a(int i, int j, int k) { - return this.b[i << 11 | k << 7 | j]; + return this.b[i << 11 | k << 7 | j] & 255; } public boolean a(int i, int j, int k, int l, int i1) { @@ -245,14 +245,14 @@ public class Chunk { int l1 = this.j * 16 + i; int i2 = this.k * 16 + k; - this.b[i << 11 | k << 7 | j] = b0; + this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255); if (k1 != 0 && !this.d.isStatic) { Block.byId[k1].b(this.d, l1, j, i2); } this.e.a(i, j, k, i1); if (!this.d.m.e) { - if (Block.q[b0] != 0) { + if (Block.q[b0 & 255] != 0) { if (j >= j1) { this.g(i, j + 1, k); } @@ -286,13 +286,13 @@ public class Chunk { int k1 = this.j * 16 + i; int l1 = this.k * 16 + k; - this.b[i << 11 | k << 7 | j] = b0; + this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255); if (j1 != 0) { Block.byId[j1].b(this.d, k1, j, l1); } this.e.a(i, j, k, 0); - if (Block.q[b0] != 0) { + if (Block.q[b0 & 255] != 0) { if (j >= i1) { this.g(i, j + 1, k); } @@ -555,10 +555,10 @@ public class Chunk { return false; } else { if (flag) { - if (this.q && this.d.k() != this.r) { + if (this.q && this.d.l() != this.r) { return true; } - } else if (this.q && this.d.k() >= this.r + 600L) { + } else if (this.q && this.d.l() >= this.r + 600L) { return true; } @@ -612,10 +612,20 @@ public class Chunk { } public Random a(long i) { - return new Random(this.d.j() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i); + return new Random(this.d.k() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i); } public boolean g() { return false; } + + public void h() { + for (int i = 0; i < this.b.length; ++i) { + byte b0 = this.b[i]; + + if (b0 != 0 && Block.byId[b0 & 255] == null) { + this.b[i] = 0; + } + } + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index e21c4a69..1f7282f0 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -19,13 +19,16 @@ import org.bukkit.event.world.ChunkUnloadEvent; // CraftBukkit end public class ChunkProviderServer implements IChunkProvider { - public LongHashset a = new LongHashset(); // CraftBukkit - public Chunk b; // CraftBukkit - public IChunkProvider c; // CraftBukkit + + // CraftBukkit start + public LongHashset a = new LongHashset(); + public Chunk b; + public IChunkProvider c; private IChunkLoader d; - public LongHashtable e = new LongHashtable(); // CraftBukkit - public List f = new ArrayList(); // CraftBukkit - public WorldServer g; // CraftBukkit + public LongHashtable e = new LongHashtable(); + public List f = new ArrayList(); + public WorldServer g; + // CraftBukkit end public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { this.b = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0); @@ -38,8 +41,8 @@ public class ChunkProviderServer implements IChunkProvider { return this.e.containsKey(i, j); // CraftBukkit } - public void c(int i, int j) { - ChunkCoordinates chunkcoordinates = this.g.l(); + public void d(int i, int j) { + ChunkCoordinates chunkcoordinates = this.g.m(); int k = i * 16 + 8 - chunkcoordinates.a; int l = j * 16 + 8 - chunkcoordinates.c; short short1 = 128; @@ -49,7 +52,7 @@ public class ChunkProviderServer implements IChunkProvider { } } - public Chunk d(int i, int j) { + public Chunk c(int i, int j) { // CraftBukkit start this.a.remove(i, j); Chunk chunk = (Chunk) this.e.get(i, j); @@ -105,9 +108,10 @@ public class ChunkProviderServer implements IChunkProvider { } public Chunk b(int i, int j) { - Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit + // CraftBukkit start + Chunk chunk = (Chunk) this.e.get(i, j); - chunk = chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk; + chunk = chunk == null ? (this.g.r ? this.c(i, j) : this.b) : chunk; if (chunk == this.b) return chunk; if (i != chunk.j || j != chunk.k) { MinecraftServer.a.info("Chunk (" + chunk.j + ", " + chunk.k +") stored at (" + i + ", " + j + ")"); @@ -117,9 +121,11 @@ public class ChunkProviderServer implements IChunkProvider { x.printStackTrace(); } return chunk; + // CraftBukkit end } - public Chunk e(int i, int j) { // CraftBukkit - private->public + // CraftBukkit - private->public + public Chunk e(int i, int j) { if (this.d == null) { return null; } else { @@ -127,7 +133,7 @@ public class ChunkProviderServer implements IChunkProvider { Chunk chunk = this.d.a(this.g, i, j); if (chunk != null) { - chunk.r = this.g.k(); + chunk.r = this.g.l(); } return chunk; @@ -138,7 +144,8 @@ public class ChunkProviderServer implements IChunkProvider { } } - public void a(Chunk chunk) { // CraftBukkit - private->public + // CraftBukkit - private->public + public void a(Chunk chunk) { if (this.d != null) { try { this.d.b(this.g, chunk); @@ -148,10 +155,11 @@ public class ChunkProviderServer implements IChunkProvider { } } - public void b(Chunk chunk) { // CraftBukkit - private->public + // CraftBukkit - private->public + public void b(Chunk chunk) { if (this.d != null) { try { - chunk.r = this.g.k(); + chunk.r = this.g.l(); this.d.a(this.g, chunk); } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception ioexception.printStackTrace(); diff --git a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java index 54189802..255e90d6 100644 --- a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java +++ b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java @@ -81,10 +81,10 @@ public class ConsoleCommandHandler { int i; if (s.toLowerCase().startsWith("kick ")) { - // CraftBukkit - Start - Add kick message compatibility + // CraftBukkit start - Add kick message compatibility String[] parts = s.split(" "); s2 = ( parts.length >= 2 ) ? parts[1] : ""; - // CraftBukkit - End + // CraftBukkit end entityplayer = null; for (i = 0; i < serverconfigurationmanager.b.size(); ++i) { diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java index 3798a4d3..a4da25d3 100644 --- a/src/main/java/net/minecraft/server/ConsoleLogManager.java +++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java @@ -1,12 +1,12 @@ package net.minecraft.server; -import java.text.SimpleDateFormat; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.logging.Logger; // CraftBukkit start +import java.text.SimpleDateFormat; import java.util.logging.Handler; import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter; import org.bukkit.craftbukkit.util.TerminalConsoleHandler; @@ -24,17 +24,17 @@ public class ConsoleLogManager { ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(); a.setUseParentHandlers(false); - ConsoleHandler consolehandler = new TerminalConsoleHandler(server.reader); // Craftbukkit - // CraftBukkit start + ConsoleHandler consolehandler = new TerminalConsoleHandler(server.reader); + for (Handler handler: global.getHandlers()) { global.removeHandler(handler); } - // CraftBukkit end - consolehandler.setFormatter(new ShortConsoleLogFormatter(server)); // Craftbukkit + consolehandler.setFormatter(new ShortConsoleLogFormatter(server)); + global.addHandler(consolehandler); + // CraftBukkit end a.addHandler(consolehandler); - global.addHandler(consolehandler); // CraftBukkit try { FileHandler filehandler = new FileHandler("server.log", true); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 0b314d6f..1012c24d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -21,8 +21,8 @@ public abstract class Entity { private static int entityCount = 0; public int id; - public double aB; - public boolean aC; + public double aC; + public boolean aD; public Entity passenger; public Entity vehicle; public World world; @@ -41,18 +41,17 @@ public abstract class Entity { public float lastPitch; public final AxisAlignedBB boundingBox; public boolean onGround; - public boolean aV; public boolean aW; public boolean aX; public boolean aY; public boolean aZ; + public boolean ba; public boolean dead; public float height; public float length; public float width; - public float be; public float bf; - protected boolean bg; + public float bg; protected float fallDistance; private int b; public double bi; @@ -83,20 +82,19 @@ public abstract class Entity { public Entity(World world) { this.id = entityCount++; - this.aB = 1.0D; - this.aC = false; + this.aC = 1.0D; + this.aD = false; this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.onGround = false; - this.aX = false; this.aY = false; - this.aZ = true; + this.aZ = false; + this.ba = true; this.dead = false; this.height = 0.0F; this.length = 0.6F; this.width = 1.8F; - this.be = 0.0F; this.bf = 0.0F; - this.bg = true; + this.bg = 0.0F; this.fallDistance = 0.0F; this.b = 1; this.bl = 0.0F; @@ -124,7 +122,7 @@ public abstract class Entity { protected abstract void a(); - public DataWatcher O() { + public DataWatcher T() { return this.datawatcher; } @@ -136,11 +134,11 @@ public abstract class Entity { return this.id; } - public void C() { + public void D() { this.dead = true; } - protected void a(float f, float f1) { + protected void b(float f, float f1) { this.length = f; this.width = f1; } @@ -161,16 +159,16 @@ public abstract class Entity { } public void f_() { - this.H(); + this.L(); } - public void H() { + public void L() { if (this.vehicle != null && this.vehicle.dead) { this.vehicle = null; } ++this.ticksLived; - this.be = this.bf; + this.bf = this.bg; this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; @@ -245,12 +243,12 @@ public abstract class Entity { } } - if (this.Q()) { - this.P(); + if (this.V()) { + this.U(); } if (this.locY < -64.0D) { - this.M(); + this.R(); } if (!this.world.isStatic) { @@ -261,7 +259,7 @@ public abstract class Entity { this.justCreated = false; } - protected void P() { + protected void U() { if (!this.by) { // CraftBukkit start -- TODO: this event spams! if (this instanceof EntityLiving) { @@ -299,8 +297,8 @@ public abstract class Entity { } } - protected void M() { - this.C(); + protected void R() { + this.D(); } public boolean b(double d0, double d1, double d2) { @@ -323,7 +321,7 @@ public abstract class Entity { double d6 = d1; double d7 = d2; AxisAlignedBB axisalignedbb = this.boundingBox.b(); - boolean flag = this.onGround && this.U(); + boolean flag = this.onGround && this.Z(); if (flag) { double d8; @@ -356,7 +354,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.aZ && d6 != d1) { + if (!this.ba && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -371,7 +369,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.aZ && d5 != d0) { + if (!this.ba && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -382,7 +380,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.aZ && d7 != d2) { + if (!this.ba && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -410,7 +408,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.aZ && d6 != d1) { + if (!this.ba && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -421,7 +419,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.aZ && d5 != d0) { + if (!this.ba && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -432,7 +430,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.aZ && d7 != d2) { + if (!this.ba && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -451,10 +449,10 @@ public abstract class Entity { this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locY = this.boundingBox.b + (double) this.height - (double) this.bl; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; - this.aV = d5 != d0 || d7 != d2; - this.aW = d6 != d1; + this.aW = d5 != d0 || d7 != d2; + this.aX = d6 != d1; this.onGround = d6 != d1 && d6 < 0.0D; - this.aX = this.aV || this.aW; + this.aY = this.aW || this.aX; this.a(d1, this.onGround); if (d5 != d0) { this.motX = 0.0D; @@ -475,7 +473,7 @@ public abstract class Entity { int j1; // CraftBukkit start - if ((this.aV) && (getBukkitEntity() instanceof Vehicle)) { + if ((this.aW) && (getBukkitEntity() instanceof Vehicle)) { Vehicle vehicle = (Vehicle) getBukkitEntity(); org.bukkit.World wrld = ((WorldServer) world).getWorld(); org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ)); @@ -495,13 +493,13 @@ public abstract class Entity { } // CraftBukkit end - if (this.bg && !flag) { - this.bf = (float) ((double) this.bf + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); + if (this.l() && !flag) { + this.bg = (float) ((double) this.bg + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); l = MathHelper.b(this.locX); i1 = MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height); j1 = MathHelper.b(this.locZ); k = this.world.getTypeId(l, i1, j1); - if (this.bf > (float) this.b && k > 0) { + if (this.bg > (float) this.b && k > 0) { ++this.b; StepSound stepsound = Block.byId[k].stepSound; @@ -572,6 +570,10 @@ public abstract class Entity { } } + protected boolean l() { + return true; + } + protected void a(double d0, boolean flag) { if (flag) { if (this.fallDistance > 0.0F) { @@ -599,7 +601,7 @@ public abstract class Entity { EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone); server.getPluginManager().callEvent(event); - if (event.isCancelled()) { + if (event.isCancelled() || event.getDamage() == 0) { return; } @@ -617,7 +619,7 @@ public abstract class Entity { } public boolean a(Material material) { - double d0 = this.locY + (double) this.p(); + double d0 = this.locY + (double) this.q(); int i = MathHelper.b(this.locX); int j = MathHelper.d((float) MathHelper.b(d0)); int k = MathHelper.b(this.locZ); @@ -633,11 +635,11 @@ public abstract class Entity { } } - public float p() { + public float q() { return 0.0F; } - public boolean Q() { + public boolean V() { return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); } @@ -767,12 +769,12 @@ public abstract class Entity { this.motZ += d2; } - protected void R() { - this.aY = true; + protected void W() { + this.aZ = true; } public boolean a(Entity entity, int i) { - this.R(); + this.W(); return false; } @@ -787,7 +789,7 @@ public abstract class Entity { public void c(Entity entity, int i) {} public boolean c(NBTTagCompound nbttagcompound) { - String s = this.S(); + String s = this.X(); if (!this.dead && s != null) { nbttagcompound.a("id", s); @@ -868,7 +870,7 @@ public abstract class Entity { this.b(nbttagcompound); } - protected final String S() { + protected final String X() { return EntityTypes.b(this); } @@ -920,13 +922,13 @@ public abstract class Entity { return entityitem; } - public boolean J() { + public boolean N() { return !this.dead; } - public boolean D() { + public boolean E() { int i = MathHelper.b(this.locX); - int j = MathHelper.b(this.locY + (double) this.p()); + int j = MathHelper.b(this.locY + (double) this.q()); int k = MathHelper.b(this.locZ); return this.world.d(i, j, k); @@ -940,7 +942,7 @@ public abstract class Entity { return null; } - public void x() { + public void o_() { if (this.vehicle.dead) { this.vehicle = null; } else { @@ -995,10 +997,10 @@ public abstract class Entity { } public void h_() { - this.passenger.a(this.locX, this.locY + this.k() + this.passenger.B(), this.locZ); + this.passenger.a(this.locX, this.locY + this.k() + this.passenger.C(), this.locZ); } - public double B() { + public double C() { return (double) this.height; } @@ -1072,21 +1074,21 @@ public abstract class Entity { } } - public Vec3D N() { + public Vec3D S() { return null; } - public void T() {} + public void Y() {} public ItemStack[] k_() { return null; } - public boolean U() { + public boolean Z() { return this.d(1); } - public void b(boolean flag) { + public void e(boolean flag) { this.a(1, flag); } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 2beb2e43..509e1181 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -23,12 +23,12 @@ public class EntityArrow extends Entity { public EntityArrow(World world) { super(world); - this.a(0.5F, 0.5F); + this.b(0.5F, 0.5F); } public EntityArrow(World world, double d0, double d1, double d2) { super(world); - this.a(0.5F, 0.5F); + this.b(0.5F, 0.5F); this.a(d0, d1, d2); this.height = 0.0F; } @@ -36,8 +36,8 @@ public class EntityArrow extends Entity { public EntityArrow(World world, EntityLiving entityliving) { super(world); this.b = entityliving; - this.a(0.5F, 0.5F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.b(0.5F, 0.5F); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -92,7 +92,7 @@ public class EntityArrow extends Entity { if (i == this.f) { ++this.h; if (this.h == 1200) { - this.C(); + this.D(); } return; @@ -180,7 +180,7 @@ public class EntityArrow extends Entity { if (stick) { // CraftBukkit end this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); - this.C(); + this.D(); } else { this.motX *= -0.10000000149011612D; this.motY *= -0.10000000149011612D; @@ -274,7 +274,7 @@ public class EntityArrow extends Entity { if (this.g && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityhuman.b(this, 1); - this.C(); + this.D(); } } } diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 35a34006..b6072cfd 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -12,8 +12,8 @@ import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; -// CraftBukkit end import org.bukkit.event.vehicle.VehicleUpdateEvent; +// CraftBukkit end public class EntityBoat extends Entity { @@ -26,9 +26,10 @@ public class EntityBoat extends Entity { private double g; private double h; private double i; - public double maxSpeed = 0.4D; // CraftBukkit // CraftBukkit start + public double maxSpeed = 0.4D; + public void h(Entity entity) { CraftServer server = ((WorldServer) this.world).getServer(); Vehicle vehicle = (Vehicle) this.getBukkitEntity(); @@ -50,10 +51,13 @@ public class EntityBoat extends Entity { this.a = 0; this.b = 0; this.c = 1; - this.aC = true; - this.a(1.5F, 0.6F); + this.aD = true; + this.b(1.5F, 0.6F); this.height = this.width / 2.0F; - this.bg = false; + } + + protected boolean l() { + return false; } protected void a() {} @@ -110,7 +114,7 @@ public class EntityBoat extends Entity { this.c = -this.c; this.b = 10; this.a += i * 10; - this.R(); + this.W(); if (this.a > 40) { int j; @@ -122,7 +126,7 @@ public class EntityBoat extends Entity { this.a(Item.STICK.id, 1, 0.0F); } - this.C(); + this.D(); } return true; @@ -266,9 +270,9 @@ public class EntityBoat extends Entity { } } - if (this.aV && d5 > 0.15D) { + if (this.aW && d5 > 0.15D) { if (!this.world.isStatic) { - this.C(); + this.D(); int k; @@ -354,7 +358,7 @@ public class EntityBoat extends Entity { double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; - this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.B(), this.locZ + d1); + this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.C(), this.locZ + d1); } } diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java index de1f779e..7e7b175f 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -12,7 +12,7 @@ public class EntityCow extends EntityAnimal { public EntityCow(World world) { super(world); this.texture = "/mob/cow.png"; - this.a(0.9F, 1.3F); + this.b(0.9F, 1.3F); } public void a(NBTTagCompound nbttagcompound) { diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index cfd74655..af2eb83f 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -9,22 +9,27 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason; // CraftBukkit end public class EntityCreature extends EntityLiving { - - public PathEntity a; // CraftBukkit - public - public Entity d; // CraftBukkit - public + // CraftBukkit start - both public + public PathEntity a; + public Entity d; + // CraftBukkit end protected boolean e = false; public EntityCreature(World world) { super(world); } + protected boolean u() { + return false; + } + protected void c_() { - this.e = false; + this.e = this.u(); float f = 16.0F; if (this.d == null) { // CraftBukkit start - Entity target = this.l(); + Entity target = this.m(); if (target != null) { EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER); CraftServer server = ((WorldServer) this.world).getServer(); @@ -42,7 +47,7 @@ public class EntityCreature extends EntityLiving { if (this.d != null) { this.a = this.world.a(this, this.d, f); } - } else if (!this.d.J()) { + } else if (!this.d.N()) { // CraftBukkit start EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED); CraftServer server = ((WorldServer) this.world).getServer(); @@ -66,7 +71,7 @@ public class EntityCreature extends EntityLiving { if (!this.e && this.d != null && (this.a == null || this.random.nextInt(20) == 0)) { this.a = this.world.a(this, this.d, f); - } else if (this.a == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0) { + } else if (!this.e && (this.a == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0)) { boolean flag = false; int i = -1; int j = -1; @@ -95,7 +100,7 @@ public class EntityCreature extends EntityLiving { int l1 = MathHelper.b(this.boundingBox.b); boolean flag1 = this.g_(); - boolean flag2 = this.Q(); + boolean flag2 = this.V(); this.pitch = 0.0F; if (this.a != null && this.random.nextInt(100) != 0) { @@ -155,10 +160,10 @@ public class EntityCreature extends EntityLiving { } if (this.d != null) { - this.b(this.d, 30.0F); + this.a(this.d, 30.0F, 30.0F); } - if (this.aV) { + if (this.aW) { this.ax = true; } @@ -177,7 +182,7 @@ public class EntityCreature extends EntityLiving { return 0.0F; } - protected Entity l() { + protected Entity m() { return null; } @@ -188,4 +193,20 @@ public class EntityCreature extends EntityLiving { return super.b() && this.a(i, j, k) >= 0.0F; } + + public boolean z() { + return this.a != null; + } + + public void a(PathEntity pathentity) { + this.a = pathentity; + } + + public Entity A() { + return this.d; + } + + public void c(Entity entity) { + this.d = entity; + } } diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index 28a42995..e7439d79 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -32,7 +32,7 @@ public class EntityCreeper extends EntityMonster { public void f_() { this.b = this.a; if (this.world.isStatic) { - int i = this.r(); + int i = this.v(); if (i > 0 && this.a == 0) { this.world.a(this, "random.fuse", 1.0F, 0.5F); @@ -67,7 +67,7 @@ public class EntityCreeper extends EntityMonster { } protected void a(Entity entity, float f) { - int i = this.r(); + int i = this.v(); if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { this.e(-1); @@ -91,7 +91,7 @@ public class EntityCreeper extends EntityMonster { if (!event.isCancelled()) { this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); - this.C(); + this.D(); } else { this.a = 0; } @@ -106,7 +106,7 @@ public class EntityCreeper extends EntityMonster { return Item.SULPHUR.id; } - private int r() { + private int v() { return this.datawatcher.a(16); } diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index b28b1166..59a3df3b 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -27,7 +27,7 @@ public class EntityEgg extends Entity { public EntityEgg(World world) { super(world); - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); } protected void a() {} @@ -35,8 +35,8 @@ public class EntityEgg extends Entity { public EntityEgg(World world, EntityLiving entityliving) { super(world); this.g = entityliving; - this.a(0.25F, 0.25F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.b(0.25F, 0.25F); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -53,7 +53,7 @@ public class EntityEgg extends Entity { public EntityEgg(World world, double d0, double d1, double d2) { super(world); this.h = 0; - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); this.a(d0, d1, d2); this.height = 0.0F; } @@ -95,7 +95,7 @@ public class EntityEgg extends Entity { if (i == this.e) { ++this.h; if (this.h == 1200) { - this.C(); + this.D(); } return; @@ -261,7 +261,7 @@ public class EntityEgg extends Entity { this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); } - this.C(); + this.D(); } this.locX += this.motX; @@ -331,7 +331,7 @@ public class EntityEgg extends Entity { if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityhuman.b(this, 1); - this.C(); + this.D(); } } } diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 5c1b3705..d9727151 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -28,7 +28,7 @@ public class EntityFireball extends Entity { public EntityFireball(World world) { super(world); - this.a(1.0F, 1.0F); + this.b(1.0F, 1.0F); } protected void a() {} @@ -36,7 +36,7 @@ public class EntityFireball extends Entity { public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { super(world); this.j = entityliving; - this.a(1.0F, 1.0F); + this.b(1.0F, 1.0F); this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); this.a(this.locX, this.locY, this.locZ); this.height = 0.0F; @@ -64,7 +64,7 @@ public class EntityFireball extends Entity { if (i == this.h) { ++this.k; if (this.k == 1200) { - this.C(); + this.D(); } return; @@ -155,7 +155,7 @@ public class EntityFireball extends Entity { if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); - this.C(); + this.D(); } // CraftBukkit end } @@ -230,9 +230,9 @@ public class EntityFireball extends Entity { } public boolean a(Entity entity, int i) { - this.R(); + this.W(); if (entity != null) { - Vec3D vec3d = entity.N(); + Vec3D vec3d = entity.S(); if (vec3d != null) { this.motX = vec3d.a; diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index 139ddc8b..542ec468 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -31,7 +31,7 @@ public class EntityFish extends Entity { public EntityFish(World world) { super(world); - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); } protected void a() {} @@ -40,7 +40,7 @@ public class EntityFish extends Entity { super(world); this.b = entityhuman; this.b.hookedFish = this; - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); this.c(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; @@ -101,10 +101,10 @@ public class EntityFish extends Entity { this.c(this.yaw, this.pitch); } else { if (!this.world.isStatic) { - ItemStack itemstack = this.b.z(); + ItemStack itemstack = this.b.A(); - if (this.b.dead || !this.b.J() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) { - this.C(); + if (this.b.dead || !this.b.N() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) { + this.D(); this.b.hookedFish = null; return; } @@ -131,7 +131,7 @@ public class EntityFish extends Entity { if (i == this.g) { ++this.i; if (this.i == 1200) { - this.C(); + this.D(); } return; @@ -247,7 +247,7 @@ public class EntityFish extends Entity { this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; float f2 = 0.92F; - if (this.onGround || this.aV) { + if (this.onGround || this.aW) { f2 = 0.5F; } @@ -354,6 +354,7 @@ public class EntityFish extends Entity { entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D; entityitem.motZ = d7 * d9; this.world.a((Entity) entityitem); + this.b.a(StatisticList.x, 1); b0 = 1; } @@ -361,7 +362,7 @@ public class EntityFish extends Entity { b0 = 2; } - this.C(); + this.D(); this.b.hookedFish = null; return b0; } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index aa7e96fd..36d8593a 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -1,5 +1,6 @@ package net.minecraft.server; +import java.util.Iterator; import java.util.List; // CraftBukkit start @@ -37,7 +38,8 @@ public abstract class EntityHuman extends EntityLiving { private int sleepTicks; public float z; public float A; - private int d = 0; + private ChunkCoordinates d; + private int e = 0; public EntityFish hookedFish = null; public EntityHuman(World world) { @@ -45,7 +47,7 @@ public abstract class EntityHuman extends EntityLiving { this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic); this.activeContainer = this.defaultContainer; this.height = 1.62F; - ChunkCoordinates chunkcoordinates = world.l(); + ChunkCoordinates chunkcoordinates = world.m(); this.c((double) chunkcoordinates.a + 0.5D, (double) (chunkcoordinates.b + 1), (double) chunkcoordinates.c + 0.5D, 0.0F, 0.0F); this.health = 20; @@ -61,16 +63,16 @@ public abstract class EntityHuman extends EntityLiving { } public void f_() { - if (this.E()) { + if (this.F()) { ++this.sleepTicks; if (this.sleepTicks > 100) { this.sleepTicks = 100; } - if (!this.l()) { - this.a(true, true); - } else if (!this.world.isStatic && this.world.c()) { - this.a(false, true); + if (!this.m()) { + this.a(true, true, false); + } else if (!this.world.isStatic && this.world.d()) { + this.a(false, true, true); } } else if (this.sleepTicks > 0) { ++this.sleepTicks; @@ -81,7 +83,7 @@ public abstract class EntityHuman extends EntityLiving { super.f_(); if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) { - this.t(); + this.u(); this.activeContainer = this.defaultContainer; } @@ -120,18 +122,19 @@ public abstract class EntityHuman extends EntityLiving { this.w += d0 * 0.25D; this.y += d2 * 0.25D; this.x += d1 * 0.25D; + this.a(StatisticList.j, 1); } - protected boolean w() { - return this.health <= 0 || this.E(); + protected boolean p_() { + return this.health <= 0 || this.F(); } - protected void t() { + protected void u() { this.activeContainer = this.defaultContainer; } - public void x() { - super.x(); + public void o_() { + super.o_(); this.n = this.o; this.o = 0.0F; } @@ -150,14 +153,14 @@ public abstract class EntityHuman extends EntityLiving { this.V = (float) this.q / 8.0F; } - public void q() { + public void r() { if (this.world.j == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { this.b(1); } - this.inventory.e(); + this.inventory.f(); this.n = this.o; - super.q(); + super.r(); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); // CraftBukkit -- Math -> TrigMath float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; @@ -197,14 +200,14 @@ public abstract class EntityHuman extends EntityLiving { public void a(Entity entity) { super.a(entity); - this.a(0.2F, 0.2F); + this.b(0.2F, 0.2F); this.a(this.locX, this.locY, this.locZ); this.motY = 0.10000000149011612D; if (this.name.equals("Notch")) { this.a(new ItemStack(Item.APPLE, 1), true); } - this.inventory.g(); + this.inventory.h(); if (entity != null) { this.motX = (double) (-MathHelper.b((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F); this.motZ = (double) (-MathHelper.a((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F); @@ -213,13 +216,19 @@ public abstract class EntityHuman extends EntityLiving { } this.height = 0.1F; + this.a(StatisticList.u, 1); } public void c(Entity entity, int i) { this.m += i; + if (entity instanceof EntityHuman) { + this.a(StatisticList.w, 1); + } else { + this.a(StatisticList.v, 1); + } } - public void y() { + public void z() { this.a(this.inventory.a(this.inventory.c, 1), false); } @@ -229,7 +238,7 @@ public abstract class EntityHuman extends EntityLiving { public void a(ItemStack itemstack, boolean flag) { if (itemstack != null) { - EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.p(), this.locZ, itemstack); + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.q(), this.locZ, itemstack); entityitem.c = 40; float f = 0.1F; @@ -273,6 +282,7 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end this.a(entityitem); + this.a(StatisticList.r, 1); } } @@ -308,7 +318,11 @@ public abstract class EntityHuman extends EntityLiving { this.sleepTicks = nbttagcompound.d("SleepTimer"); if (this.sleeping) { this.b = new ChunkCoordinates(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)); - this.a(true, true); + this.a(true, true, false); + } + + if (nbttagcompound.b("SpawnX") && nbttagcompound.b("SpawnY") && nbttagcompound.b("SpawnZ")) { + this.d = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("SpawnZ")); } } @@ -318,6 +332,11 @@ public abstract class EntityHuman extends EntityLiving { nbttagcompound.a("Dimension", this.dimension); nbttagcompound.a("Sleeping", this.sleeping); nbttagcompound.a("SleepTimer", (short) this.sleepTicks); + if (this.d != null) { + nbttagcompound.a("SpawnX", this.d.a); + nbttagcompound.a("SpawnY", this.d.b); + nbttagcompound.a("SpawnZ", this.d.c); + } } public void a(IInventory iinventory) {} @@ -326,7 +345,7 @@ public abstract class EntityHuman extends EntityLiving { public void b(Entity entity, int i) {} - public float p() { + public float q() { return 0.12F; } @@ -339,8 +358,8 @@ public abstract class EntityHuman extends EntityLiving { if (this.health <= 0) { return false; } else { - if (this.E()) { - this.a(true, true); + if (this.F()) { + this.a(true, true, false); } if (entity instanceof EntityMonster || entity instanceof EntityArrow) { @@ -357,35 +376,73 @@ public abstract class EntityHuman extends EntityLiving { } } - // CraftBukkit start - this is here instead of EntityMonster because EntityLiving(s) that aren't monsters - // also damage the player in this way. For example, EntitySlime. - if (entity instanceof EntityLiving) { - CraftServer server = ((WorldServer) this.world).getServer(); - org.bukkit.entity.Entity damager = entity.getBukkitEntity(); - org.bukkit.entity.Entity damagee = this.getBukkitEntity(); - DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK; - EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i); - server.getPluginManager().callEvent(event); + if (i == 0) { + return false; + } else { + Object object = entity; - if (event.isCancelled()) { - return false; + if (entity instanceof EntityArrow && ((EntityArrow) entity).b != null) { + object = ((EntityArrow) entity).b; } - i = event.getDamage(); + // CraftBukkit start - this is here instead of EntityMonster because EntityLiving(s) that aren't monsters + // also damage the player in this way. For example, EntitySlime. + if (object instanceof EntityLiving) { + CraftServer server = ((WorldServer) this.world).getServer(); + org.bukkit.entity.Entity damager = ((Entity) object).getBukkitEntity(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK; + EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i); + server.getPluginManager().callEvent(event); + + if (event.isCancelled() || event.getDamage() == 0) { + return false; + } + + i = event.getDamage(); + // CraftBukkit end + + this.a((EntityLiving) object, false); + } + + this.a(StatisticList.t, i); + return super.a(entity, i); + } + } + } + + protected void a(EntityLiving entityliving, boolean flag) { + if (!(entityliving instanceof EntityCreeper) && !(entityliving instanceof EntityGhast)) { + if (entityliving instanceof EntityWolf) { + EntityWolf entitywolf = (EntityWolf) entityliving; + + if (entitywolf.y() && this.name.equals(entitywolf.v())) { + return; + } } - // CraftBukkit end - return i == 0 ? false : super.a(entity, i); + List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D)); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + EntityWolf entitywolf1 = (EntityWolf) entity; + + if (entitywolf1.y() && entitywolf1.A() == null && this.name.equals(entitywolf1.v()) && (!flag || !entitywolf1.w())) { + entitywolf1.b(false); + entitywolf1.c(entityliving); + } + } } } protected void c(int i) { - int j = 25 - this.inventory.f(); - int k = i * j + this.d; + int j = 25 - this.inventory.g(); + int k = i * j + this.e; this.inventory.c(i); i = k / 25; - this.d = k % 25; + this.e = k % 25; super.c(i); } @@ -397,31 +454,31 @@ public abstract class EntityHuman extends EntityLiving { public void c(Entity entity) { if (!entity.a(this)) { - ItemStack itemstack = this.z(); + ItemStack itemstack = this.A(); if (itemstack != null && entity instanceof EntityLiving) { - itemstack.b((EntityLiving) entity); + itemstack.a((EntityLiving) entity); if (itemstack.count <= 0) { itemstack.a(this); - this.A(); + this.B(); } } } } - public ItemStack z() { + public ItemStack A() { return this.inventory.b(); } - public void A() { + public void B() { this.inventory.a(this.inventory.c, (ItemStack) null); } - public double B() { + public double C() { return (double) (this.height - 0.5F); } - public void r() { + public void m_() { this.q = -1; this.p = true; } @@ -440,7 +497,7 @@ public abstract class EntityHuman extends EntityLiving { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i); server.getPluginManager().callEvent(event); - if (event.isCancelled()) { + if (event.isCancelled() || event.getDamage() == 0) { return; } @@ -449,40 +506,48 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end entity.a(this, i); - ItemStack itemstack = this.z(); + ItemStack itemstack = this.A(); if (itemstack != null && entity instanceof EntityLiving) { - itemstack.a((EntityLiving) entity); + itemstack.a((EntityLiving) entity, this); if (itemstack.count <= 0) { itemstack.a(this); - this.A(); + this.B(); + } + } + + if (entity instanceof EntityLiving) { + if (entity.N()) { + this.a((EntityLiving) entity, true); } + + this.a(StatisticList.s, i); } } } public void a(ItemStack itemstack) {} - public void C() { - super.C(); + public void D() { + super.D(); this.defaultContainer.a(this); if (this.activeContainer != null) { this.activeContainer.a(this); } } - public boolean D() { - return !this.sleeping && super.D(); + public boolean E() { + return !this.sleeping && super.E(); } - public boolean a(int i, int j, int k) { - if (!this.E() && this.J()) { + public EnumBedError a(int i, int j, int k) { + if (!this.F() && this.N()) { if (this.world.m.c) { - return false; - } else if (this.world.c()) { - return false; + return EnumBedError.NOT_POSSIBLE_HERE; + } else if (this.world.d()) { + return EnumBedError.NOT_POSSIBLE_NOW; } else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) { - this.a(0.2F, 0.2F); + this.b(0.2F, 0.2F); this.height = 0.2F; if (this.world.f(i, j, k)) { int l = this.world.getData(i, j, k); @@ -518,15 +583,15 @@ public abstract class EntityHuman extends EntityLiving { this.b = new ChunkCoordinates(i, j, k); this.motX = this.motZ = this.motY = 0.0D; if (!this.world.isStatic) { - this.world.o(); + this.world.q(); } - return true; + return EnumBedError.OK; } else { - return false; + return EnumBedError.TOO_FAR_AWAY; } } else { - return false; + return EnumBedError.OTHER_PROBLEM; } } @@ -551,21 +616,25 @@ public abstract class EntityHuman extends EntityLiving { } } - public void a(boolean flag, boolean flag1) { - this.a(0.6F, 1.8F); + public void a(boolean flag, boolean flag1, boolean flag2) { + this.b(0.6F, 1.8F); this.l_(); ChunkCoordinates chunkcoordinates = this.b; + ChunkCoordinates chunkcoordinates1 = this.b; if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c) == Block.BED.id) { BlockBed.a(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, false); - ChunkCoordinates chunkcoordinates1 = BlockBed.g(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0); + chunkcoordinates1 = BlockBed.f(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0); + if (chunkcoordinates1 == null) { + chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.a, chunkcoordinates.b + 1, chunkcoordinates.c); + } this.a((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + this.height + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F)); } this.sleeping = false; if (!this.world.isStatic && flag1) { - this.world.o(); + this.world.q(); } if (flag) { @@ -573,19 +642,107 @@ public abstract class EntityHuman extends EntityLiving { } else { this.sleepTicks = 100; } + + if (flag2) { + this.a(this.b); + } } - private boolean l() { + private boolean m() { return this.world.getTypeId(this.b.a, this.b.b, this.b.c) == Block.BED.id; } - public boolean E() { - return this.sleeping; + public static ChunkCoordinates a(World world, ChunkCoordinates chunkcoordinates) { + IChunkProvider ichunkprovider = world.n(); + + ichunkprovider.c(chunkcoordinates.a - 3 >> 4, chunkcoordinates.c - 3 >> 4); + ichunkprovider.c(chunkcoordinates.a + 3 >> 4, chunkcoordinates.c - 3 >> 4); + ichunkprovider.c(chunkcoordinates.a - 3 >> 4, chunkcoordinates.c + 3 >> 4); + ichunkprovider.c(chunkcoordinates.a + 3 >> 4, chunkcoordinates.c + 3 >> 4); + if (world.getTypeId(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c) != Block.BED.id) { + return null; + } else { + ChunkCoordinates chunkcoordinates1 = BlockBed.f(world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0); + + return chunkcoordinates1; + } } public boolean F() { + return this.sleeping; + } + + public boolean G() { return this.sleeping && this.sleepTicks >= 100; } public void a(String s) {} + + public ChunkCoordinates H() { + return this.d; + } + + public void a(ChunkCoordinates chunkcoordinates) { + if (chunkcoordinates != null) { + this.d = new ChunkCoordinates(chunkcoordinates); + } else { + this.d = null; + } + } + + public void a(Statistic statistic, int i) {} + + protected void I() { + super.I(); + this.a(StatisticList.q, 1); + } + + public void a(float f, float f1) { + double d0 = this.locX; + double d1 = this.locY; + double d2 = this.locZ; + + super.a(f, f1); + this.g(this.locX - d0, this.locY - d1, this.locZ - d2); + } + + private void g(double d0, double d1, double d2) { + int i; + + if (this.a(Material.WATER)) { + i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.p, i); + } + } else if (this.g_()) { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.l, i); + } + } else if (this.n()) { + if (d1 > 0.0D) { + this.a(StatisticList.n, (int) Math.round(d1 * 100.0D)); + } + } else if (this.onGround) { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.k, i); + } + } else { + i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); + if (i > 25) { + this.a(StatisticList.o, i); + } + } + } + + protected void a(float f) { + if (f >= 2.0F) { + this.a(StatisticList.m, (int) Math.round((double) f * 100.0D)); + } + + super.a(f); + } + + public void J() {} } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index ab283236..50299f72 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -17,7 +17,7 @@ public class EntityItem extends Entity { public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) { super(world); - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); this.height = this.width / 2.0F; this.a(d0, d1, d2); this.a = itemstack; @@ -25,12 +25,15 @@ public class EntityItem extends Entity { this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motY = 0.20000000298023224D; this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); - this.bg = false; + } + + protected boolean l() { + return false; } public EntityItem(World world) { super(world); - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); this.height = this.width / 2.0F; } @@ -76,7 +79,7 @@ public class EntityItem extends Entity { ++this.e; ++this.b; if (this.b >= 6000) { - this.C(); + this.D(); } } @@ -167,10 +170,10 @@ public class EntityItem extends Entity { } public boolean a(Entity entity, int i) { - this.R(); + this.W(); this.f -= i; if (this.f <= 0) { - this.C(); + this.D(); } return false; @@ -203,7 +206,7 @@ public class EntityItem extends Entity { if (!event.isCancelled() && entityhuman.inventory.a(this.a)) { this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityhuman.b(this, i); - this.C(); + this.D(); } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 02d17b5c..3dcc4bc3 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -69,11 +69,11 @@ public abstract class EntityLiving extends Entity { protected float ay = 0.0F; protected float az = 0.7F; private Entity b; - private int c = 0; + protected int aA = 0; public EntityLiving(World world) { super(world); - this.aC = true; + this.aD = true; this.E = (float) (Math.random() + 1.0D) * 0.01F; this.a(this.locX, this.locY, this.locZ); this.D = (float) Math.random() * 12398.0F; @@ -84,7 +84,7 @@ public abstract class EntityLiving extends Entity { protected void a() {} public boolean e(Entity entity) { - return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.p(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.p(), entity.locZ)) == null; + return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.q(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.q(), entity.locZ)) == null; } public boolean d_() { @@ -95,7 +95,7 @@ public abstract class EntityLiving extends Entity { return !this.dead; } - public float p() { + public float q() { return this.width * 0.85F; } @@ -103,7 +103,7 @@ public abstract class EntityLiving extends Entity { return 80; } - public void G() { + public void K() { String s = this.e(); if (s != null) { @@ -111,15 +111,15 @@ public abstract class EntityLiving extends Entity { } } - public void H() { + public void L() { this.U = this.V; - super.H(); + super.L(); if (this.random.nextInt(1000) < this.a++) { this.a = -this.c(); - this.G(); + this.K(); } - if (this.J() && this.D()) { + if (this.N() && this.E()) { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity victim = this.getBukkitEntity(); @@ -129,7 +129,7 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = new EntityDamageEvent(victim, damageType, damage); server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { + if (!event.isCancelled() && event.getDamage() != 0) { this.a((Entity) null, event.getDamage()); } // CraftBukkit end @@ -141,7 +141,7 @@ public abstract class EntityLiving extends Entity { int i; - if (this.J() && this.a(Material.WATER) && !this.b_()) { + if (this.N() && this.a(Material.WATER) && !this.b_()) { --this.airTicks; if (this.airTicks == -20) { this.airTicks = 0; @@ -163,7 +163,7 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone); server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { + if (!event.isCancelled() && event.getDamage() != 0) { this.a((Entity) null, event.getDamage()); } // CraftBukkit end @@ -190,8 +190,8 @@ public abstract class EntityLiving extends Entity { if (this.health <= 0) { ++this.deathTicks; if (this.deathTicks > 20) { - this.L(); - this.C(); + this.Q(); + this.D(); for (i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; @@ -209,7 +209,7 @@ public abstract class EntityLiving extends Entity { this.lastPitch = this.pitch; } - public void I() { + public void M() { for (int i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; @@ -220,15 +220,15 @@ public abstract class EntityLiving extends Entity { } } - public void x() { - super.x(); + public void o_() { + super.o_(); this.H = this.I; this.I = 0.0F; } public void f_() { super.f_(); - this.q(); + this.r(); double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = MathHelper.a(d0 * d0 + d1 * d1); @@ -323,8 +323,8 @@ public abstract class EntityLiving extends Entity { this.J += f2; } - protected void a(float f, float f1) { - super.a(f, f1); + protected void b(float f, float f1) { + super.b(f, f1); } public void b(int i) { @@ -368,7 +368,7 @@ public abstract class EntityLiving extends Entity { this.aa = 0.0F; if (flag) { this.world.a(this, (byte) 2); - this.R(); + this.W(); if (entity != null) { double d0 = entity.locX - this.locX; @@ -436,19 +436,19 @@ public abstract class EntityLiving extends Entity { } public void a(Entity entity) { - if (this.R > 0 && entity != null) { + if (this.R >= 0 && entity != null) { entity.c(this, this.R); } this.af = true; if (!this.world.isStatic) { - this.o(); + this.p(); } this.world.a(this, (byte) 3); } - protected void o() { + protected void p() { int i = this.h(); // CraftBukkit start - whole method @@ -487,7 +487,7 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i); server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { + if (!event.isCancelled() && event.getDamage() != 0) { this.a((Entity) null, event.getDamage()); } // CraftBukkit end @@ -502,7 +502,7 @@ public abstract class EntityLiving extends Entity { } } - public void b(float f, float f1) { + public void a(float f, float f1) { double d0; if (this.g_()) { @@ -513,10 +513,10 @@ public abstract class EntityLiving extends Entity { this.motY *= 0.800000011920929D; this.motZ *= 0.800000011920929D; this.motY -= 0.02D; - if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { + if (this.aW && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } - } else if (this.Q()) { + } else if (this.V()) { d0 = this.locY; this.a(f, f1, 0.02F); this.c(this.motX, this.motY, this.motZ); @@ -524,7 +524,7 @@ public abstract class EntityLiving extends Entity { this.motY *= 0.5D; this.motZ *= 0.5D; this.motY -= 0.02D; - if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { + if (this.aW && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } } else { @@ -552,15 +552,19 @@ public abstract class EntityLiving extends Entity { } } - if (this.m()) { + if (this.n()) { this.fallDistance = 0.0F; if (this.motY < -0.15D) { this.motY = -0.15D; } + + if (this.Z() && this.motY < 0.0D) { + this.motY = 0.0D; + } } this.c(this.motX, this.motY, this.motZ); - if (this.aV && this.m()) { + if (this.aW && this.n()) { this.motY = 0.2D; } @@ -583,7 +587,7 @@ public abstract class EntityLiving extends Entity { this.ak += this.aj; } - public boolean m() { + public boolean n() { int i = MathHelper.b(this.locX); int j = MathHelper.b(this.boundingBox.b); int k = MathHelper.b(this.locZ); @@ -609,7 +613,7 @@ public abstract class EntityLiving extends Entity { this.attackTicks = nbttagcompound.d("AttackTime"); } - public boolean J() { + public boolean N() { return !this.dead && this.health > 0; } @@ -617,7 +621,7 @@ public abstract class EntityLiving extends Entity { return false; } - public void q() { + public void r() { if (this.al > 0) { double d0 = this.locX + (this.am - this.locX) / (double) this.al; double d1 = this.locY + (this.an - this.locY) / (double) this.al; @@ -640,7 +644,7 @@ public abstract class EntityLiving extends Entity { this.c(this.yaw, this.pitch); } - if (this.w()) { + if (this.p_()) { this.ax = false; this.au = 0.0F; this.av = 0.0F; @@ -650,7 +654,7 @@ public abstract class EntityLiving extends Entity { } boolean flag = this.g_(); - boolean flag1 = this.Q(); + boolean flag1 = this.V(); if (this.ax) { if (flag) { @@ -658,14 +662,14 @@ public abstract class EntityLiving extends Entity { } else if (flag1) { this.motY += 0.03999999910593033D; } else if (this.onGround) { - this.K(); + this.I(); } } this.au *= 0.98F; this.av *= 0.98F; this.aw *= 0.9F; - this.b(this.au, this.av); + this.a(this.au, this.av); List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { @@ -679,33 +683,37 @@ public abstract class EntityLiving extends Entity { } } - protected boolean w() { + protected boolean p_() { return this.health <= 0; } - protected void K() { + protected void I() { this.motY = 0.41999998688697815D; } + protected boolean s() { + return true; + } + protected void c_() { ++this.at; EntityHuman entityhuman = this.world.a(this, -1.0D); - if (entityhuman != null) { + if (this.s() && entityhuman != null) { double d0 = entityhuman.locX - this.locX; double d1 = entityhuman.locY - this.locY; double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (d3 > 16384.0D) { - this.C(); + this.D(); } if (this.at > 600 && this.random.nextInt(800) == 0) { if (d3 < 1024.0D) { this.at = 0; } else { - this.C(); + this.D(); } } } @@ -718,15 +726,15 @@ public abstract class EntityLiving extends Entity { entityhuman = this.world.a(this, (double) f); if (entityhuman != null) { this.b = entityhuman; - this.c = 10 + this.random.nextInt(20); + this.aA = 10 + this.random.nextInt(20); } else { this.aw = (this.random.nextFloat() - 0.5F) * 20.0F; } } if (this.b != null) { - this.b(this.b, 10.0F); - if (this.c-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) { + this.a(this.b, 10.0F, (float) this.n_()); + if (this.aA-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) { this.b = null; } } else { @@ -739,14 +747,18 @@ public abstract class EntityLiving extends Entity { } boolean flag = this.g_(); - boolean flag1 = this.Q(); + boolean flag1 = this.V(); if (flag || flag1) { this.ax = this.random.nextFloat() < 0.8F; } } - public void b(Entity entity, float f) { + protected int n_() { + return 10; + } + + public void a(Entity entity, float f, float f1) { double d0 = entity.locX - this.locX; double d1 = entity.locZ - this.locZ; double d2; @@ -754,17 +766,25 @@ public abstract class EntityLiving extends Entity { if (entity instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) entity; - d2 = entityliving.locY + (double) entityliving.p() - (this.locY + (double) this.p()); + d2 = this.locY + (double) this.q() - (entityliving.locY + (double) entityliving.q()); } else { - d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.p()); + d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.q()); } double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1); - float f1 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; - float f2 = (float) (Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D); + float f2 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; + float f3 = (float) (Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D); + + this.pitch = -this.b(this.pitch, f3, f1); + this.yaw = this.b(this.yaw, f2, f); + } + + public boolean O() { + return this.b != null; + } - this.pitch = -this.b(this.pitch, f2, f); - this.yaw = this.b(this.yaw, f1, f); + public Entity P() { + return this.b; } private float b(float f, float f1, float f2) { @@ -789,13 +809,13 @@ public abstract class EntityLiving extends Entity { return f + f3; } - public void L() {} + public void Q() {} public boolean b() { return this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); } - protected void M() { + protected void R() { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); DamageCause damageType = EntityDamageEvent.DamageCause.VOID; @@ -805,7 +825,7 @@ public abstract class EntityLiving extends Entity { EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); server.getPluginManager().callEvent(event); - if (event.isCancelled()) { + if (event.isCancelled() || event.getDamage() == 0) { return; } damageDone = event.getDamage(); @@ -813,7 +833,7 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - public Vec3D N() { + public Vec3D S() { return this.b(1.0F); } @@ -845,7 +865,7 @@ public abstract class EntityLiving extends Entity { return 4; } - public boolean E() { + public boolean F() { return false; } } diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 46ee72aa..ce6b1143 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -51,10 +51,13 @@ public class EntityMinecart extends Entity implements IInventory { this.b = 0; this.c = 1; this.i = false; - this.aC = true; - this.a(0.98F, 0.7F); + this.aD = true; + this.b(0.98F, 0.7F); this.height = this.width / 2.0F; - this.bg = false; + } + + protected boolean l() { + return false; } protected void a() {} @@ -114,7 +117,7 @@ public class EntityMinecart extends Entity implements IInventory { this.c = -this.c; this.b = 10; - this.R(); + this.W(); this.a += i * 10; if (this.a > 40) { this.a(Item.MINECART.id, 1, 0.0F); @@ -124,7 +127,7 @@ public class EntityMinecart extends Entity implements IInventory { this.a(Block.FURNACE.id, 1, 0.0F); } - this.C(); + this.D(); } return true; @@ -137,8 +140,8 @@ public class EntityMinecart extends Entity implements IInventory { return !this.dead; } - public void C() { - for (int i = 0; i < this.m_(); ++i) { + public void D() { + for (int i = 0; i < this.q_(); ++i) { ItemStack itemstack = this.c_(i); if (itemstack != null) { @@ -165,7 +168,7 @@ public class EntityMinecart extends Entity implements IInventory { } } - super.C(); + super.D(); } public void f_() { @@ -593,7 +596,7 @@ public class EntityMinecart extends Entity implements IInventory { } else if (this.d == 1) { NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.h = new ItemStack[this.m_()]; + this.h = new ItemStack[this.q_()]; for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); @@ -692,7 +695,7 @@ public class EntityMinecart extends Entity implements IInventory { } } - public int m_() { + public int q_() { return 27; } @@ -723,8 +726,8 @@ public class EntityMinecart extends Entity implements IInventory { public void a(int i, ItemStack itemstack) { this.h[i] = itemstack; - if (itemstack != null && itemstack.count > this.n_()) { - itemstack.count = this.n_(); + if (itemstack != null && itemstack.count > this.r_()) { + itemstack.count = this.r_(); } } @@ -732,11 +735,11 @@ public class EntityMinecart extends Entity implements IInventory { return "Minecart"; } - public int n_() { + public int r_() { return 64; } - public void h() {} + public void i() {} public boolean a(EntityHuman entityhuman) { if (this.d == 0) { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index d06311b3..91b95075 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -20,24 +20,24 @@ public class EntityMonster extends EntityCreature implements IMonster { this.health = 20; } - public void q() { + public void r() { float f = this.c(1.0F); if (f > 0.5F) { this.at += 2; } - super.q(); + super.r(); } public void f_() { super.f_(); if (this.world.j == 0) { - this.C(); + this.D(); } } - protected Entity l() { + protected Entity m() { EntityHuman entityhuman = this.world.a(this, 16.0D); return entityhuman != null && this.e(entityhuman) ? entityhuman : null; @@ -77,7 +77,7 @@ public class EntityMonster extends EntityCreature implements IMonster { } protected void a(Entity entity, float f) { - if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { + if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { this.attackTicks = 20; // CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for an EntityMonster // to damage another EntityMonster, and we want to catch those events. @@ -91,7 +91,7 @@ public class EntityMonster extends EntityCreature implements IMonster { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.c); server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { + if (!event.isCancelled() && event.getDamage() != 0) { entity.a(this, event.getDamage()); } return; diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 5c2b69be..382bcdfb 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -46,12 +46,12 @@ public class EntityPigZombie extends EntityZombie { this.a = nbttagcompound.d("Anger"); } - protected Entity l() { - return this.a == 0 ? null : super.l(); + protected Entity m() { + return this.a == 0 ? null : super.m(); } - public void q() { - super.q(); + public void r() { + super.r(); } public boolean a(Entity entity, int i) { @@ -64,17 +64,17 @@ public class EntityPigZombie extends EntityZombie { if (entity1 instanceof EntityPigZombie) { EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; - entitypigzombie.c(entity); + entitypigzombie.d(entity); } } - this.c(entity); + this.d(entity); } return super.a(entity, i); } - private void c(Entity entity) { + private void d(Entity entity) { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity bukkitTarget = null; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index e6713951..bc403cfe 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -33,7 +33,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { super(world); - ChunkCoordinates chunkcoordinates = world.l(); + ChunkCoordinates chunkcoordinates = world.m(); int i = chunkcoordinates.a; int j = chunkcoordinates.c; int k = chunkcoordinates.b; @@ -60,7 +60,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public Location compassTarget; // CraftBukkit end - public void l() { + public void m() { this.activeContainer.a((ICrafting) this); } @@ -72,7 +72,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.height = 0.0F; } - public float p() { + public float q() { return 1.62F; } @@ -195,8 +195,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void q() { - super.q(); + public void r() { + super.r(); } public void b(Entity entity, int i) { @@ -214,7 +214,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.activeContainer.a(); } - public void r() { + public void m_() { if (!this.p) { this.q = -1; this.p = true; @@ -222,23 +222,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void s() {} + public void t() {} + + public EnumBedError a(int i, int j, int k) { + EnumBedError enumbederror = super.a(i, j, k); - public boolean a(int i, int j, int k) { - if (super.a(i, j, k)) { + if (enumbederror == EnumBedError.OK) { this.b.k.a(this, new Packet17(this, 0, i, j, k)); - return true; - } else { - return false; } + + return enumbederror; } - public void a(boolean flag, boolean flag1) { - if (this.E()) { + public void a(boolean flag, boolean flag1, boolean flag2) { + if (this.F()) { this.b.k.b(this, new Packet18ArmAnimation(this, 3)); } - super.a(flag, flag1); + super.a(flag, flag1, flag2); this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); } @@ -263,12 +264,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { super.a(d0, flag); } - private void V() { + private void aa() { this.bH = this.bH % 100 + 1; } public void b(int i, int j, int k) { - this.V(); + this.aa(); this.a.b((Packet) (new Packet100OpenWindow(this.bH, 1, "Crafting", 9))); this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k); this.activeContainer.f = this.bH; @@ -276,24 +277,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void a(IInventory iinventory) { - this.V(); - this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.m_()))); + this.aa(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.q_()))); this.activeContainer = new ContainerChest(this.inventory, iinventory); this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(TileEntityFurnace tileentityfurnace) { - this.V(); - this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.m_()))); + this.aa(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.q_()))); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(TileEntityDispenser tileentitydispenser) { - this.V(); - this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.m_()))); + this.aa(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.q_()))); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); @@ -309,7 +310,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(Container container, List list) { this.a.b((Packet) (new Packet104WindowItems(container.f, list))); - this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i()))); + this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.j()))); } public void a(Container container, int i, int j) { @@ -318,18 +319,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(ItemStack itemstack) {} - public void t() { + public void u() { this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f))); - this.v(); + this.w(); } - public void u() { + public void v() { if (!this.h) { - this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i()))); + this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.j()))); } } - public void v() { + public void w() { this.activeContainer.a((EntityHuman) this); this.activeContainer = this.defaultContainer; } @@ -338,7 +339,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.au = f; this.av = f1; this.ax = flag; - this.b(flag1); + this.e(flag1); this.pitch = f2; this.yaw = f3; } diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 945368e0..d61f3187 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -32,8 +32,8 @@ public class EntitySkeleton extends EntityMonster { return "mob.skeletonhurt"; } - public void q() { - if (this.world.c()) { + public void r() { + if (this.world.d()) { float f = this.c(1.0F); if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { @@ -51,7 +51,7 @@ public class EntitySkeleton extends EntityMonster { } } - super.q(); + super.r(); } protected void a(Entity entity, float f) { @@ -89,7 +89,7 @@ public class EntitySkeleton extends EntityMonster { return Item.ARROW.id; } - protected void o() { + protected void p() { // CraftBukkit start - whole method List loot = new ArrayList(); diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 7fe95631..a2b8ee3c 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -23,7 +23,7 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world) { super(world); - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); } protected void a() {} @@ -31,8 +31,8 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world, EntityLiving entityliving) { super(world); this.g = entityliving; - this.a(0.25F, 0.25F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.b(0.25F, 0.25F); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); @@ -49,7 +49,7 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world, double d0, double d1, double d2) { super(world); this.h = 0; - this.a(0.25F, 0.25F); + this.b(0.25F, 0.25F); this.a(d0, d1, d2); this.height = 0.0F; } @@ -91,7 +91,7 @@ public class EntitySnowball extends Entity { if (i == this.e) { ++this.h; if (this.h == 1200) { - this.C(); + this.D(); } return; @@ -182,7 +182,7 @@ public class EntitySnowball extends Entity { this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); } - this.C(); + this.D(); } this.locX += this.motX; @@ -252,7 +252,7 @@ public class EntitySnowball extends Entity { if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityhuman.b(this, 1); - this.C(); + this.D(); } } } diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index 19de8a1e..8fba4bdf 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -5,14 +5,14 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -// CraftBukkit stop +// CraftBukkit end public class EntitySpider extends EntityMonster { public EntitySpider(World world) { super(world); this.texture = "/mob/spider.png"; - this.a(1.4F, 0.9F); + this.b(1.4F, 0.9F); this.az = 0.8F; } @@ -20,7 +20,11 @@ public class EntitySpider extends EntityMonster { return (double) this.width * 0.75D - 0.5D; } - protected Entity l() { + protected boolean l() { + return false; + } + + protected Entity m() { float f = this.c(1.0F); if (f < 0.5F) { @@ -91,7 +95,7 @@ public class EntitySpider extends EntityMonster { return Item.STRING.id; } - public boolean m() { - return this.aV; + public boolean n() { + return this.aW; } } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index 891b78cf..7e85e6b5 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -13,8 +13,8 @@ public class EntityTNTPrimed extends Entity { public EntityTNTPrimed(World world) { super(world); this.a = 0; - this.aC = true; - this.a(0.98F, 0.98F); + this.aD = true; + this.b(0.98F, 0.98F); this.height = this.width / 2.0F; } @@ -26,7 +26,6 @@ public class EntityTNTPrimed extends Entity { this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F); this.motY = 0.20000000298023224D; this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F); - this.bg = false; this.a = 80; this.lastX = d0; this.lastY = d1; @@ -35,6 +34,10 @@ public class EntityTNTPrimed extends Entity { protected void a() {} + protected boolean l() { + return false; + } + public boolean d_() { return !this.dead; } @@ -57,7 +60,7 @@ public class EntityTNTPrimed extends Entity { if (this.a-- <= 0) { // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event. this.h(); - this.C(); + this.D(); // CraftBukkit end } else { this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java index fbb6f6ee..9f2c621d 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -17,6 +17,7 @@ public class EntityTracker { this.d = minecraftserver.f.a(); } + // CraftBukkit -- synchronized public synchronized void a(Entity entity) { if (entity instanceof EntityPlayer) { this.a(entity, 512, 2); @@ -61,6 +62,7 @@ public class EntityTracker { this.a(entity, i, j, false); } + // CraftBukkit -- synchronized public synchronized void a(Entity entity, int i, int j, boolean flag) { if (i > this.d) { i = this.d; @@ -78,6 +80,7 @@ public class EntityTracker { } } + // CraftBukkit -- synchronized public synchronized void b(Entity entity) { if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entity; @@ -98,6 +101,7 @@ public class EntityTracker { } } + // CraftBukkit -- synchronized public synchronized void a() { ArrayList arraylist = new ArrayList(); Iterator iterator = this.a.iterator(); @@ -126,6 +130,7 @@ public class EntityTracker { } } + // CraftBukkit -- synchronized public synchronized void a(Entity entity, Packet packet) { EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id); @@ -134,6 +139,7 @@ public class EntityTracker { } } + // CraftBukkit -- synchronized public synchronized void b(Entity entity, Packet packet) { EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id); @@ -142,6 +148,7 @@ public class EntityTracker { } } + // CraftBukkit -- synchronized public synchronized void a(EntityPlayer entityplayer) { Iterator iterator = this.a.iterator(); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index 31784724..2448897b 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -102,7 +102,7 @@ public class EntityTrackerEntry { this.a((Packet) object); } - DataWatcher datawatcher = this.a.O(); + DataWatcher datawatcher = this.a.T(); if (datawatcher.a()) { this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher))); @@ -120,9 +120,9 @@ public class EntityTrackerEntry { } } - if (this.a.aY) { + if (this.a.aZ) { this.b((Packet) (new Packet28EntityVelocity(this.a))); - this.a.aY = false; + this.a.aZ = false; } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 74c88b14..b9a82af3 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -14,8 +14,8 @@ public class EntityZombie extends EntityMonster { this.c = 5; } - public void q() { - if (this.world.c()) { + public void r() { + if (this.world.d()) { float f = this.c(1.0F); if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { @@ -31,7 +31,7 @@ public class EntityZombie extends EntityMonster { } } - super.q(); + super.r(); } protected String e() { diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java index 5b3d8618..1c9c9e86 100644 --- a/src/main/java/net/minecraft/server/IInventory.java +++ b/src/main/java/net/minecraft/server/IInventory.java @@ -2,7 +2,7 @@ package net.minecraft.server; public interface IInventory { - int m_(); + int q_(); ItemStack c_(int i); @@ -12,9 +12,9 @@ public interface IInventory { String c(); - int n_(); + int r_(); - void h(); + void i(); boolean a_(EntityHuman entityhuman); diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java index 0c12956d..53d56374 100644 --- a/src/main/java/net/minecraft/server/InventoryCraftResult.java +++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java @@ -12,7 +12,7 @@ public class InventoryCraftResult implements IInventory { public InventoryCraftResult() {} - public int m_() { + public int q_() { return 1; } @@ -39,11 +39,11 @@ public class InventoryCraftResult implements IInventory { this.a[i] = itemstack; } - public int n_() { + public int r_() { return 64; } - public void h() {} + public void i() {} public boolean a_(EntityHuman entityhuman) { return true; diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java index 67dd7ffc..5f0bae2e 100644 --- a/src/main/java/net/minecraft/server/InventoryCrafting.java +++ b/src/main/java/net/minecraft/server/InventoryCrafting.java @@ -20,12 +20,12 @@ public class InventoryCrafting implements IInventory { this.b = i; } - public int m_() { + public int q_() { return this.a.length; } public ItemStack c_(int i) { - return i >= this.m_() ? null : this.a[i]; + return i >= this.q_() ? null : this.a[i]; } public ItemStack b(int i, int j) { @@ -70,11 +70,11 @@ public class InventoryCrafting implements IInventory { this.c.a((IInventory) this); } - public int n_() { + public int r_() { return 64; } - public void h() {} + public void i() {} public boolean a_(EntityHuman entityhuman) { return true; diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java index 51e4cdff..60e00852 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[m_()]; + ItemStack[] result = new ItemStack[q_()]; for (int i = 0; i < result.length; i++) { result[i] = c_(i); } @@ -22,8 +22,8 @@ public class InventoryLargeChest implements IInventory { this.c = iinventory1; } - public int m_() { - return this.b.m_() + this.c.m_(); + public int q_() { + return this.b.q_() + this.c.q_(); } public String c() { @@ -31,28 +31,28 @@ public class InventoryLargeChest implements IInventory { } public ItemStack c_(int i) { - return i >= this.b.m_() ? this.c.c_(i - this.b.m_()) : this.b.c_(i); + return i >= this.b.q_() ? this.c.c_(i - this.b.q_()) : this.b.c_(i); } public ItemStack a(int i, int j) { - return i >= this.b.m_() ? this.c.a(i - this.b.m_(), j) : this.b.a(i, j); + return i >= this.b.q_() ? this.c.a(i - this.b.q_(), j) : this.b.a(i, j); } public void a(int i, ItemStack itemstack) { - if (i >= this.b.m_()) { - this.c.a(i - this.b.m_(), itemstack); + if (i >= this.b.q_()) { + this.c.a(i - this.b.q_(), itemstack); } else { this.b.a(i, itemstack); } } - public int n_() { - return this.b.n_(); + public int r_() { + return this.b.r_(); } - public void h() { - this.b.h(); - this.c.h(); + public void i() { + this.b.i(); + this.c.i(); } public boolean a_(EntityHuman entityhuman) { diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index 0ad40a0e..6029352e 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -5,9 +5,9 @@ public class InventoryPlayer implements IInventory { public ItemStack[] a = new ItemStack[36]; public ItemStack[] b = new ItemStack[4]; public int c = 0; - public EntityHuman e; // CraftBukkit - private->public + public EntityHuman d; // CraftBukkit - private->public private ItemStack f; - public boolean d = false; + public boolean e = false; // CraftBukkit start public ItemStack[] getContents() { @@ -20,15 +20,15 @@ public class InventoryPlayer implements IInventory { // CraftBukkit end public InventoryPlayer(EntityHuman entityhuman) { - this.e = entityhuman; + this.d = entityhuman; } public ItemStack b() { - if (this.c < this.a.length) { - return this.a[this.c]; - } else { - return null; - } + return this.c < 9 && this.c >= 0 ? this.a[this.c] : null; + } + + public static int e() { + return 9; } private int d(int i) { @@ -43,7 +43,7 @@ public class InventoryPlayer implements IInventory { private int c(ItemStack itemstack) { for (int i = 0; i < this.a.length; ++i) { - if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.n_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) { + if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.r_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) { return i; } } @@ -51,7 +51,7 @@ public class InventoryPlayer implements IInventory { return -1; } - private int j() { + private int k() { for (int i = 0; i < this.a.length; ++i) { if (this.a[i] == null) { return i; @@ -67,7 +67,7 @@ public class InventoryPlayer implements IInventory { int k = this.c(itemstack); if (k < 0) { - k = this.j(); + k = this.k(); } if (k < 0) { @@ -83,8 +83,8 @@ public class InventoryPlayer implements IInventory { l = this.a[k].b() - this.a[k].count; } - if (l > this.n_() - this.a[k].count) { - l = this.n_() - this.a[k].count; + if (l > this.r_() - this.a[k].count) { + l = this.r_() - this.a[k].count; } if (l == 0) { @@ -98,7 +98,7 @@ public class InventoryPlayer implements IInventory { } } - public void e() { + public void f() { for (int i = 0; i < this.a.length; ++i) { if (this.a[i] != null && this.a[i].b > 0) { --this.a[i].b; @@ -128,7 +128,7 @@ public class InventoryPlayer implements IInventory { } } - int i = this.j(); + int i = this.k(); if (i >= 0) { this.a[i] = itemstack; @@ -234,7 +234,7 @@ public class InventoryPlayer implements IInventory { } } - public int m_() { + public int q_() { return this.a.length + 4; } @@ -253,7 +253,7 @@ public class InventoryPlayer implements IInventory { return "Inventory"; } - public int n_() { + public int r_() { return 64; } @@ -273,7 +273,7 @@ public class InventoryPlayer implements IInventory { } } - public int f() { + public int g() { int i = 0; int j = 0; int k = 0; @@ -302,47 +302,47 @@ public class InventoryPlayer implements IInventory { public void c(int i) { for (int j = 0; j < this.b.length; ++j) { if (this.b[j] != null && this.b[j].a() instanceof ItemArmor) { - this.b[j].b(i); + this.b[j].a(i, this.d); if (this.b[j].count == 0) { - this.b[j].a(this.e); + this.b[j].a(this.d); this.b[j] = null; } } } } - public void g() { + public void h() { int i; for (i = 0; i < this.a.length; ++i) { if (this.a[i] != null) { - this.e.a(this.a[i], true); + this.d.a(this.a[i], true); this.a[i] = null; } } for (i = 0; i < this.b.length; ++i) { if (this.b[i] != null) { - this.e.a(this.b[i], true); + this.d.a(this.b[i], true); this.b[i] = null; } } } - public void h() { - this.d = true; + public void i() { + this.e = true; } public void b(ItemStack itemstack) { this.f = itemstack; - this.e.a(itemstack); + this.d.a(itemstack); } - public ItemStack i() { + public ItemStack j() { return this.f; } public boolean a_(EntityHuman entityhuman) { - return this.e.dead ? false : entityhuman.g(this.e) <= 64.0D; + return this.d.dead ? false : entityhuman.g(this.d) <= 64.0D; } } diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 4ad9ec1a..fda82cf6 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -108,6 +108,6 @@ public class ItemBlock extends Item { } public String a() { - return Block.byId[this.a].e(); + return Block.byId[this.a].f(); } } diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java index cad9727e..56356b14 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -15,7 +15,6 @@ public class ItemBucket extends Item { public ItemBucket(int i, int j) { super(i); this.maxStackSize = 1; - this.durability = 64; this.a = j; } diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java index 7a9c0969..ead1b8f8 100644 --- a/src/main/java/net/minecraft/server/ItemDoor.java +++ b/src/main/java/net/minecraft/server/ItemDoor.java @@ -14,7 +14,6 @@ public class ItemDoor extends Item { public ItemDoor(int i, Material material) { super(i); this.a = material; - this.durability = 64; this.maxStackSize = 1; } diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java index cad14054..29c57f15 100644 --- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java +++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java @@ -17,7 +17,7 @@ public class ItemFlintAndSteel extends Item { public ItemFlintAndSteel(int i) { super(i); this.maxStackSize = 1; - this.durability = 64; + this.d(64); } public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { @@ -63,7 +63,7 @@ public class ItemFlintAndSteel extends Item { boolean preventFire = eventIgnite.isCancelled(); if (preventFire) { - itemstack.b(1); + itemstack.a(1, entityhuman); return false; } // CraftBukkit end @@ -83,7 +83,7 @@ public class ItemFlintAndSteel extends Item { // CraftBukkit end } - itemstack.b(1); + itemstack.a(1, entityhuman); return true; } } diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java index 3a651a17..af52be9f 100644 --- a/src/main/java/net/minecraft/server/ItemHoe.java +++ b/src/main/java/net/minecraft/server/ItemHoe.java @@ -12,7 +12,7 @@ public class ItemHoe extends Item { public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) { super(i); this.maxStackSize = 1; - this.durability = enumtoolmaterial.a(); + this.d(enumtoolmaterial.a()); } public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { @@ -40,7 +40,7 @@ public class ItemHoe extends Item { } // CraftBukkit end - itemstack.b(1); + itemstack.a(1, entityhuman); if (world.k.nextInt(8) == 0 && i1 == Block.GRASS.id) { byte b0 = 1; diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 2c1d4377..090867c8 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -16,38 +16,36 @@ public class ItemInWorldManager { public EntityHuman a; private float c = 0.0F; private int d; - private int e = 0; - private float f = 0.0F; + private int e; + private int f; private int g; private int h; - private int i; + private boolean i; private int j; - private boolean k; + private int k; private int l; private int m; - private int n; - private int o; public ItemInWorldManager(World world) { this.b = world; } public void a() { - ++this.j; - if (this.k) { - int i = this.j - this.o; - int j = this.b.getTypeId(this.l, this.m, this.n); + ++this.h; + if (this.i) { + int i = this.h - this.m; + int j = this.b.getTypeId(this.j, this.k, this.l); if (j != 0) { Block block = Block.byId[j]; float f = block.a(this.a) * (float) (i + 1); if (f >= 1.0F) { - this.k = false; - this.d(this.l, this.m, this.n); + this.i = false; + this.d(this.j, this.k, this.l); } } else { - this.k = false; + this.i = false; } } } @@ -100,15 +98,15 @@ public class ItemInWorldManager { // CraftBukkit end this.d(i, j, k); } else { - this.g = i; - this.h = j; - this.i = k; + this.e = i; + this.f = j; + this.g = k; } } public void b(int i, int j, int k) { - if (i == this.g && j == this.h && k == this.i) { - int l = this.j - this.d; + if (i == this.e && j == this.f && k == this.g) { + int l = this.h - this.d; int i1 = this.b.getTypeId(i, j, k); if (i1 != 0) { @@ -117,12 +115,12 @@ public class ItemInWorldManager { if (f >= 1.0F) { this.d(i, j, k); - } else if (!this.k) { - this.k = true; - this.l = i; - this.m = j; - this.n = k; - this.o = this.d; + } else if (!this.i) { + this.i = true; + this.j = i; + this.k = j; + this.l = k; + this.m = this.d; } } // CraftBukkit start -- force blockreset to client @@ -166,18 +164,18 @@ public class ItemInWorldManager { int l = this.b.getTypeId(i, j, k); int i1 = this.b.getData(i, j, k); boolean flag = this.c(i, j, k); - ItemStack itemstack = this.a.z(); + ItemStack itemstack = this.a.A(); if (itemstack != null) { - itemstack.a(l, i, j, k); + itemstack.a(l, i, j, k, this.a); if (itemstack.count == 0) { itemstack.a(this.a); - this.a.A(); + this.a.B(); } } if (flag && this.a.b(Block.byId[l])) { - Block.byId[l].a_(this.b, i, j, k, i1); + Block.byId[l].a(this.b, this.a, i, j, k, i1); ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b))); } @@ -186,7 +184,6 @@ public class ItemInWorldManager { public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) { int i = itemstack.count; - ItemStack itemstack1 = itemstack.a(world, entityhuman); if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) { diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java index 959522c5..5e3402db 100644 --- a/src/main/java/net/minecraft/server/ItemSign.java +++ b/src/main/java/net/minecraft/server/ItemSign.java @@ -11,7 +11,6 @@ public class ItemSign extends Item { public ItemSign(int i) { super(i); - this.durability = 64; this.maxStackSize = 1; } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 2eb10def..204710e6 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -53,7 +53,13 @@ public final class ItemStack { } public boolean a(EntityHuman entityhuman, World world, int i, int j, int k, int l) { - return this.a().a(this, entityhuman, world, i, j, k, l); + boolean flag = this.a().a(this, entityhuman, world, i, j, k, l); + + if (flag) { + entityhuman.a(StatisticList.A[this.id], 1); + } + + return flag; } public float a(Block block) { @@ -109,10 +115,14 @@ public final class ItemStack { return Item.byId[this.id].d(); } - public void b(int i) { + public void a(int i, Entity entity) { if (this.d()) { this.damage += i; if (this.damage > this.i()) { + if (entity instanceof EntityHuman) { + ((EntityHuman) entity).a(StatisticList.B[this.id], 1); + } + --this.count; if (this.count < 0) { this.count = 0; @@ -123,12 +133,20 @@ public final class ItemStack { } } - public void a(EntityLiving entityliving) { - Item.byId[this.id].a(this, entityliving); + public void a(EntityLiving entityliving, EntityHuman entityhuman) { + boolean flag = Item.byId[this.id].a(this, entityliving, (EntityLiving) entityhuman); + + if (flag) { + entityhuman.a(StatisticList.A[this.id], 1); + } } - public void a(int i, int j, int k, int l) { - Item.byId[this.id].a(this, i, j, k, l); + public void a(int i, int j, int k, int l, EntityHuman entityhuman) { + boolean flag = Item.byId[this.id].a(this, i, j, k, l, entityhuman); + + if (flag) { + entityhuman.a(StatisticList.A[this.id], 1); + } } public int a(Entity entity) { @@ -141,8 +159,8 @@ public final class ItemStack { public void a(EntityHuman entityhuman) {} - public void b(EntityLiving entityliving) { - Item.byId[this.id].b(this, entityliving); + public void a(EntityLiving entityliving) { + Item.byId[this.id].a(this, entityliving); } public ItemStack j() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 42b2ba7e..ab873a5f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -9,6 +9,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; @@ -82,7 +83,7 @@ public class MinecraftServer implements Runnable, ICommandListener { System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true)); // CraftBukkit end - a.info("Starting minecraft server version Beta 1.3"); + a.info("Starting minecraft server version Beta 1.4"); 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\""); @@ -126,9 +127,19 @@ public class MinecraftServer implements Runnable, ICommandListener { this.k = new EntityTracker(this); long j = System.nanoTime(); String s1 = this.d.a("level-name", "world"); + String s2 = this.d.a("level-seed", ""); + long k = (new Random()).nextLong(); + + if (s2.length() > 0) { + try { + k = Long.parseLong(s2); + } catch (NumberFormatException numberformatexception) { + k = (long) s2.hashCode(); + } + } a.info("Preparing level \"" + s1 + "\""); - this.a((Convertable) (new WorldLoaderServer(new File("."))), s1); + this.a(new WorldLoaderServer(new File(".")), s1, k); // CraftBukkit start long elapsed = System.nanoTime() - j; @@ -139,7 +150,7 @@ public class MinecraftServer implements Runnable, ICommandListener { return true; } - private void a(Convertable convertable, String s) { + private void a(Convertable convertable, String s, long i) { if (convertable.a(s)) { a.info("Converting map!"); convertable.a(s, new ConvertProgressUpdater(this)); @@ -148,7 +159,7 @@ public class MinecraftServer implements Runnable, ICommandListener { a.info("Preparing start region"); // CraftBukkit start - WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0); + WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0, i); world.a(new WorldManager(this, world)); world.j = this.d.a("spawn-monsters", true) ? 1 : 0; world.a(this.d.a("spawn-monsters", true), this.m); @@ -157,30 +168,30 @@ public class MinecraftServer implements Runnable, ICommandListener { // CraftBukkit end short short1 = 196; - long i = System.currentTimeMillis(); - ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // CraftBukkit + long j = System.currentTimeMillis(); + ChunkCoordinates chunkcoordinates = worlds.get(0).m(); // CraftBukkit - for (int j = -short1; j <= short1 && this.p; j += 16) { - for (int k = -short1; k <= short1 && this.p; k += 16) { - long l = System.currentTimeMillis(); + for (int k = -short1; k <= short1 && this.p; k += 16) { + for (int l = -short1; l <= short1 && this.p; l += 16) { + long i1 = System.currentTimeMillis(); - if (l < i) { - i = l; + if (i1 < j) { + j = i1; } - if (l > i + 1000L) { - int i1 = (short1 * 2 + 1) * (short1 * 2 + 1); - int j1 = (j + short1) * (short1 * 2 + 1) + k + 1; + if (i1 > j + 1000L) { + int j1 = (short1 * 2 + 1) * (short1 * 2 + 1); + int k1 = (k + short1) * (short1 * 2 + 1) + l + 1; - this.a("Preparing spawn area", j1 * 100 / i1); - i = l; + this.a("Preparing spawn area", k1 * 100 / j1); + j = i1; } // CraftBukkit start for (WorldServer worldserver: worlds) { - world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); + world.u.c(chunkcoordinates.a + k >> 4, chunkcoordinates.c + l >> 4); - while (world.e() && this.p) { + while (world.f() && this.p) { ; } } @@ -210,7 +221,7 @@ public class MinecraftServer implements Runnable, ICommandListener { // CraftBukkit start for (WorldServer world: worlds) { world.a(true, (IProgressUpdate) null); - world.r(); + world.t(); WorldSaveEvent event = new WorldSaveEvent( world.getWorld() ); server.getPluginManager().callEvent( event ); @@ -263,7 +274,7 @@ public class MinecraftServer implements Runnable, ICommandListener { j += l; i = k; // CraftBukkit - TODO - Replace with loop? - if (this.worlds.size() > 0 && this.worlds.get(0).q()) { + if (this.worlds.size() > 0 && this.worlds.get(0).s()) { this.h(); j = 0L; } else { @@ -338,20 +349,20 @@ public class MinecraftServer implements Runnable, ICommandListener { if (this.h % 20 == 0) { for (int i = 0; i < this.f.b.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i); - entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.k()))); + entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.l()))); } } ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h); for (WorldServer world: worlds) { - world.g(); + world.h(); - while (world.e()) { + while (world.f()) { ; } - world.d(); + world.e(); } // CraftBukkit end this.c.a(); @@ -406,6 +417,10 @@ public class MinecraftServer implements Runnable, ICommandListener { a.info(s); } + public void c(String s) { + a.warning(s); + } + public String c() { return "CONSOLE"; } diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index a2dcf2eb..a980b479 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -57,8 +57,8 @@ public class NetLoginHandler extends NetHandler { public void a(Packet1Login packet1login) { this.g = packet1login.b; - if (packet1login.a != 9) { - if (packet1login.a > 9) { + if (packet1login.a != 10) { + if (packet1login.a > 10) { this.a("Outdated server!"); } else { this.a("Outdated client!"); @@ -80,17 +80,17 @@ public class NetLoginHandler extends NetHandler { NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer); // CraftBukkit start - ChunkCoordinates chunkcoordinates = entityplayer.world.l(); - netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (byte) entityplayer.world.m.g))); + ChunkCoordinates chunkcoordinates = entityplayer.world.m(); + netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.k(), (byte) entityplayer.world.m.g))); netserverhandler.b((Packet) (new Packet6SpawnPosition(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c))); // this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game."))); // CraftBukkit - message moved to join event this.e.f.a(entityplayer); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); this.e.c.a(netserverhandler); - netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k()))); + netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.l()))); // CraftBukkit end - entityplayer.l(); + entityplayer.m(); } this.c = true; diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 7fd3e2ac..e1fd30b5 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -248,7 +248,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { double d8 = d4 * d4 + d6 * d6 + d7 * d7; boolean flag1 = false; - if (d8 > 0.0625D && !this.e.E()) { + if (d8 > 0.0625D && !this.e.F()) { flag1 = true; a.warning(this.e.name + " moved wrongly!"); System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); @@ -259,7 +259,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; - if (flag && (flag1 || !flag2) && !this.e.E()) { + if (flag && (flag1 || !flag2) && !this.e.F()) { this.a(this.i, this.j, this.k, f2, f3); return; } @@ -311,7 +311,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet14BlockDig packet14blockdig) { if (packet14blockdig.e == 4) { - this.e.y(); + this.e.z(); } else { // CraftBukkit boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name); @@ -341,7 +341,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } // CraftBukkit - ChunkCoordinates chunkcoordinates = this.e.world.l(); + ChunkCoordinates chunkcoordinates = this.e.world.m(); int l = (int) MathHelper.e((float) (i - chunkcoordinates.a)); int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); @@ -429,7 +429,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { int l = packet15place.d; // CraftBukkit - ChunkCoordinates chunkcoordinates = this.e.world.l(); + ChunkCoordinates chunkcoordinates = this.e.world.m(); int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a)); int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); @@ -525,17 +525,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet16BlockItemSwitch packet16blockitemswitch) { // CraftBukkit start - if (packet16blockitemswitch.a < 0 || packet16blockitemswitch.a > 8) { - server.getLogger().severe( - "Player " + getPlayer().getName() + "/" + getPlayer().getAddress().toString() + - " just sent an invalid ItemInHandIndex: " + packet16blockitemswitch.a + - " - very likely a crashing exploit attempt. Recommend ban, and sending a package of joy their way." - ); - this.b(new Packet1Login("", "", 0, 0, (byte)0)); - this.a("Exploits."); - return; - } - PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), e.inventory.c, packet16blockitemswitch.a); server.getPluginManager().callEvent(event); // CraftBukkit end @@ -639,7 +628,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (this.d.f.h(this.e.name)) { s1 = s.substring(1); a.info(this.e.name + " issued server command: " + s1); - this.d.a(s1, (ICommandListener) this); + this.d.a(s1, this); } else { s1 = s.substring(1); a.info(this.e.name + " tried command: " + s1); @@ -678,7 +667,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { server.getPluginManager().callEvent(event); // CraftBukkit end - this.e.r(); + this.e.m_(); } } @@ -695,11 +684,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit: Set Sneaking if (packet19entityaction.b == 1) { - this.e.b(true); + this.e.e(true); } else if (packet19entityaction.b == 2) { - this.e.b(false); + this.e.e(false); } else if (packet19entityaction.b == 3) { - this.e.a(false, true); + this.e.a(false, true, true); this.l = false; } } @@ -745,7 +734,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet101CloseWindow packet101closewindow) { - this.e.v(); + this.e.w(); } public void a(Packet102WindowClick packet102windowclick) { @@ -756,7 +745,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true))); this.e.h = true; this.e.activeContainer.a(); - this.e.u(); + this.e.v(); this.e.h = false; } else { this.m.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d)); @@ -765,7 +754,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { ArrayList arraylist = new ArrayList(); for (int i = 0; i < this.e.activeContainer.e.size(); ++i) { - arraylist.add(((Slot) this.e.activeContainer.e.get(i)).b()); + arraylist.add(((Slot) this.e.activeContainer.e.get(i)).a()); } this.e.a(this.e.activeContainer, arraylist); @@ -786,15 +775,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) { TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c); if (tileentity instanceof TileEntitySign) { - TileEntitySign sign = (TileEntitySign)tileentity; - if (!sign.fresh) { - int x = packet130updatesign.a; - int y = packet130updatesign.b; - int z = packet130updatesign.c; - server.getLogger().severe("Player " + getPlayer().getName() + "/" + getPlayer().getAddress().toString() + " just tried to change the sign text at " + - x + "," + y + "," + z + " - very likely an exploit attempt. Recommend ban, and sending a package of joy their way."); - this.b(new Packet1Login("", "", 0, 0, (byte)0)); - this.a("Exploits."); + TileEntitySign tileentitysign = (TileEntitySign)tileentity; + if (!tileentitysign.a()) { + this.d.c("Player " + this.e.name + " just tried to change non-editable sign"); return; } } @@ -803,34 +786,34 @@ public class NetServerHandler extends NetHandler implements ICommandListener { int i; int j; - for (i = 0; i < 4; ++i) { + for (j = 0; j < 4; ++j) { boolean flag = true; - if (packet130updatesign.d[i].length() > 15) { + if (packet130updatesign.d[j].length() > 15) { flag = false; } else { - for (j = 0; j < packet130updatesign.d[i].length(); ++j) { - if (FontAllowedCharacters.a.indexOf(packet130updatesign.d[i].charAt(j)) < 0) { + for (i = 0; i < packet130updatesign.d[j].length(); ++i) { + if (FontAllowedCharacters.a.indexOf(packet130updatesign.d[j].charAt(i)) < 0) { flag = false; } } } if (!flag) { - packet130updatesign.d[i] = "!?"; + packet130updatesign.d[j] = "!?"; } } if (tileentity instanceof TileEntitySign) { - i = packet130updatesign.a; + j = packet130updatesign.a; int k = packet130updatesign.b; - j = packet130updatesign.c; - TileEntitySign tileentitysign = (TileEntitySign) tileentity; + i = packet130updatesign.c; + TileEntitySign tileentitysign1 = (TileEntitySign) tileentity; // CraftBukkit start - SIGN_CHANGE hook Player player = server.getPlayer(this.e); - SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d); + SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, j), server.getPlayer(this.e), packet130updatesign.d); server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -839,19 +822,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener { for (int l = 0; l < 4; ++l) { event.setLine(l, ""); } - } else { - tileentitysign.fresh = false; } // CraftBukkit end for (int l = 0; l < 4; ++l) { - tileentitysign.a[l] = event.getLine(l); + tileentitysign1.a[l] = event.getLine(l); // CraftBukkit } - tileentitysign.h(); + tileentitysign1.i(); // CraftBukkit - this.e.world.g(i, k, j); + this.e.world.g(j, k, j); } } } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index d143fc86..df04dc7f 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -5,6 +5,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; +import java.net.SocketException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -46,6 +47,11 @@ public class NetworkManager { try { socket.setSoTimeout(30000); socket.setTrafficClass(24); + } catch (SocketException socketexception) { + System.err.println(socketexception.getMessage()); + } + + try { this.h = new DataInputStream(socket.getInputStream()); this.i = new DataOutputStream(socket.getOutputStream()); } catch (IOException ex) { diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java index 47a1dbca..9397b216 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -67,8 +67,6 @@ public abstract class Packet { boolean flag = false; Packet packet = null; - datainputstream.mark(16384); - int i; try { @@ -85,7 +83,6 @@ public abstract class Packet { packet.a(datainputstream); } catch (EOFException eofexception) { System.out.println("Reached end of stream"); - datainputstream.reset(); return null; } @@ -217,6 +214,7 @@ public abstract class Packet { b(53, Packet53BlockChange.class); b(54, Packet54PlayNoteBlock.class); b(60, Packet60Explosion.class); + b(70, Packet70Bed.class); b(100, Packet100OpenWindow.class); b(101, Packet101CloseWindow.class); //b(102, Packet102WindowClick.class); diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java index 5b3734ec..6fc6cf73 100644 --- a/src/main/java/net/minecraft/server/PlayerInstance.java +++ b/src/main/java/net/minecraft/server/PlayerInstance.java @@ -30,7 +30,7 @@ class PlayerInstance { this.e = new ChunkCoordIntPair(i, j); // CraftBukkit - playermanager.world.u.d(i, j); + playermanager.world.u.c(i, j); } public void a(EntityPlayer entityplayer) { @@ -58,7 +58,7 @@ class PlayerInstance { } // CraftBukkit - ((WorldServer) entityplayer.world).u.c(this.c, this.d); + ((WorldServer) entityplayer.world).u.d(this.c, this.d); } entityplayer.f.remove(this.e); diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index c71a73cd..742ab54c 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -72,7 +72,7 @@ public class ServerConfigurationManager { public void a(WorldServer worldserver) { // CraftBukkit start if (this.n == null) { - this.n = worldserver.m().d(); + this.n = worldserver.o().d(); } // CraftBukkit end } @@ -85,7 +85,7 @@ public class ServerConfigurationManager { this.b.add(entityplayer); this.n.b(entityplayer); // CraftBukkit start - ((WorldServer) entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); + ((WorldServer) entityplayer.world).u.c((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) { entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ); @@ -173,12 +173,25 @@ public class ServerConfigurationManager { ((WorldServer) entityplayer.world).manager.b(entityplayer); this.b.remove(entityplayer); entityplayer.world.e(entityplayer); + ChunkCoordinates chunkcoordinates = entityplayer.H(); EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world)); entityplayer1.id = entityplayer.id; entityplayer1.a = entityplayer.a; entityplayer1.displayName = entityplayer.displayName; // CraftBukkit entityplayer1.compassTarget = entityplayer.compassTarget; // CraftBukkit + + if (chunkcoordinates != null) { + ChunkCoordinates chunkcoordinates1 = EntityHuman.a(entityplayer.world, chunkcoordinates); + + if (chunkcoordinates1 != null) { + entityplayer1.c((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F), 0.0F, 0.0F); + entityplayer1.a(chunkcoordinates); + } else { + entityplayer1.a.b((Packet) (new Packet70Bed(0))); + } + } + ((WorldServer) entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) { @@ -206,12 +219,12 @@ public class ServerConfigurationManager { entityplayer1.a.b((Packet) (new Packet9Respawn())); entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); // CraftBukkit start - ((WorldServer) entityplayer1.world).manager.a(entityplayer1); entityplayer.world.a(entityplayer1); + ((WorldServer) entityplayer1.world).manager.a(entityplayer1); // CraftBukkit end this.b.add(entityplayer1); - entityplayer1.l(); - entityplayer1.s(); + entityplayer1.m(); + entityplayer1.t(); return entityplayer1; } diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java index 1708ec02..a45cb2aa 100644 --- a/src/main/java/net/minecraft/server/Slot.java +++ b/src/main/java/net/minecraft/server/Slot.java @@ -15,29 +15,29 @@ public class Slot { this.c = k; } - public void a() { - this.c(); + public void a(ItemStack itemstack) { + this.b(); } - public boolean a(ItemStack itemstack) { + public boolean b(ItemStack itemstack) { return true; } - public ItemStack b() { + public ItemStack a() { return this.e.c_(this.d); } - public void b(ItemStack itemstack) { + public void c(ItemStack itemstack) { this.e.a(this.d, itemstack); - this.c(); + this.b(); } - public void c() { - this.e.h(); + public void b() { + this.e.i(); } - public int d() { - return this.e.n_(); + public int c() { + return this.e.r_(); } public ItemStack a(int i) { @@ -47,4 +47,8 @@ public class Slot { public boolean a(IInventory iinventory, int i) { return iinventory == this.e && i == this.d; } + + public boolean d() { + return false; + } } diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java index 3605c997..71efc0ad 100644 --- a/src/main/java/net/minecraft/server/ThreadCommandReader.java +++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java @@ -23,7 +23,7 @@ public class ThreadCommandReader extends Thread { ConsoleReader reader = a.reader; String line = null; while ((!this.a.g) && (MinecraftServer.a(this.a)) && ((line = reader.readLine(">", null)) != null)) { - this.a.a(line, (ICommandListener) this.a); + this.a.a(line, this.a); } } catch (IOException ex) { Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ex); diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java deleted file mode 100644 index 6680e0fa..00000000 --- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.minecraft.server; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLEncoder; - -class ThreadLoginVerifier extends Thread { - - final Packet1Login a; - - final NetLoginHandler b; - - ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login) { - this.b = netloginhandler; - this.a = packet1login; - } - - public void run() { - try { - String s = NetLoginHandler.a(this.b); - // Craftbukkit - URL url = new URL("http://www.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.a.b, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); - String s1 = bufferedreader.readLine(); - - bufferedreader.close(); - if (s1.equals("YES")) { - NetLoginHandler.a(this.b, this.a); - } else { - this.b.a("Failed to verify username!"); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - } -} diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index e1d05766..275ab04c 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -12,7 +12,7 @@ public class TileEntityChest extends TileEntity implements IInventory { public TileEntityChest() {} - public int m_() { + public int q_() { return 27; } @@ -27,7 +27,7 @@ public class TileEntityChest extends TileEntity implements IInventory { if (this.a[i].count <= j) { itemstack = this.a[i]; this.a[i] = null; - this.h(); + this.i(); return itemstack; } else { itemstack = this.a[i].a(j); @@ -35,7 +35,7 @@ public class TileEntityChest extends TileEntity implements IInventory { this.a[i] = null; } - this.h(); + this.i(); return itemstack; } } else { @@ -45,11 +45,11 @@ public class TileEntityChest extends TileEntity implements IInventory { public void a(int i, ItemStack itemstack) { this.a[i] = itemstack; - if (itemstack != null && itemstack.count > this.n_()) { - itemstack.count = this.n_(); + if (itemstack != null && itemstack.count > this.r_()) { + itemstack.count = this.r_(); } - this.h(); + this.i(); } public String c() { @@ -60,7 +60,7 @@ public class TileEntityChest extends TileEntity implements IInventory { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.a = new ItemStack[this.m_()]; + this.a = new ItemStack[this.q_()]; for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); @@ -89,7 +89,7 @@ public class TileEntityChest extends TileEntity implements IInventory { nbttagcompound.a("Items", (NBTBase) nbttaglist); } - public int n_() { + public int r_() { return 64; } diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java index 41a4ab81..d13acca4 100644 --- a/src/main/java/net/minecraft/server/TileEntityDispenser.java +++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java @@ -15,7 +15,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { public TileEntityDispenser() {} - public int m_() { + public int q_() { return 9; } @@ -30,7 +30,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { if (this.a[i].count <= j) { itemstack = this.a[i]; this.a[i] = null; - this.h(); + this.i(); return itemstack; } else { itemstack = this.a[i].a(j); @@ -38,7 +38,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { this.a[i] = null; } - this.h(); + this.i(); return itemstack; } } else { @@ -66,11 +66,11 @@ public class TileEntityDispenser extends TileEntity implements IInventory { public void a(int i, ItemStack itemstack) { this.a[i] = itemstack; - if (itemstack != null && itemstack.count > this.n_()) { - itemstack.count = this.n_(); + if (itemstack != null && itemstack.count > this.r_()) { + itemstack.count = this.r_(); } - this.h(); + this.i(); } public String c() { @@ -81,7 +81,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.a = new ItemStack[this.m_()]; + this.a = new ItemStack[this.q_()]; for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); @@ -110,7 +110,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { nbttagcompound.a("Items", (NBTBase) nbttaglist); } - public int n_() { + public int r_() { return 64; } diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index f500d8bb..848a74af 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -15,7 +15,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { public TileEntityFurnace() {} - public int m_() { + public int q_() { return this.h.length; } @@ -46,8 +46,8 @@ public class TileEntityFurnace extends TileEntity implements IInventory { public void a(int i, ItemStack itemstack) { this.h[i] = itemstack; - if (itemstack != null && itemstack.count > this.n_()) { - itemstack.count = this.n_(); + if (itemstack != null && itemstack.count > this.r_()) { + itemstack.count = this.r_(); } } @@ -59,7 +59,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.h = new ItemStack[this.m_()]; + this.h = new ItemStack[this.q_()]; for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); @@ -94,7 +94,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { nbttagcompound.a("Items", (NBTBase) nbttaglist); } - public int n_() { + public int r_() { return 64; } @@ -111,7 +111,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } if (!this.d.isStatic) { - if (this.a == 0 && this.i()) { + if (this.a == 0 && this.h()) { this.b = this.a = this.a(this.h[1]); if (this.a > 0) { flag1 = true; @@ -124,7 +124,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } } - if (this.f() && this.i()) { + if (this.f() && this.h()) { ++this.c; if (this.c == 200) { this.c = 0; @@ -142,22 +142,22 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } if (flag1) { - this.h(); + this.i(); } } - private boolean i() { + private boolean h() { if (this.h[0] == null) { return false; } else { ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); - return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.n_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b()))); + return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.r_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b()))); } } public void g() { - if (this.i()) { + if (this.h()) { ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); if (this.h[2] == null) { diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index 5566ad28..c2bbdb17 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -80,7 +80,7 @@ public class TileEntityMobSpawner extends TileEntity { this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); } - entityliving.I(); + entityliving.M(); this.c(); } } diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java deleted file mode 100644 index d55f91e9..00000000 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.minecraft.server; - -public class TileEntitySign extends TileEntity { - - public String[] a = new String[] { "", "", "", ""}; - public int b = -1; - public boolean fresh = true; // Craftbukkit - - public TileEntitySign() {} - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - nbttagcompound.a("Text1", this.a[0]); - nbttagcompound.a("Text2", this.a[1]); - nbttagcompound.a("Text3", this.a[2]); - nbttagcompound.a("Text4", this.a[3]); - } - - public void a(NBTTagCompound nbttagcompound) { - fresh = false; // Craftbukkit - super.a(nbttagcompound); - - for (int i = 0; i < 4; ++i) { - this.a[i] = nbttagcompound.i("Text" + (i + 1)); - if (this.a[i].length() > 15) { - this.a[i] = this.a[i].substring(0, 15); - } - } - } - - public Packet e() { - String[] astring = new String[4]; - - for (int i = 0; i < 4; ++i) { - astring[i] = this.a[i]; - } - - return new Packet130UpdateSign(this.e, this.f, this.g, astring); - } -} diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 20c3ead2..cadaf7d3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -84,21 +84,10 @@ public class World implements IBlockAccess { this.m.a(this); this.o = this.b(); if (flag) { - this.r = true; - int j = 0; - byte b0 = 64; - - int k; - - for (k = 0; !this.m.a(j, k); k += this.k.nextInt(64) - this.k.nextInt(64)) { - j += this.k.nextInt(64) - this.k.nextInt(64); - } - - this.q.a(j, b0, k); - this.r = false; + this.c(); } - this.f(); + this.g(); } protected IChunkProvider b() { @@ -107,6 +96,21 @@ public class World implements IBlockAccess { return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.m.c()); } + protected void c() { + this.r = true; + int i = 0; + byte b0 = 64; + + int j; + + for (j = 0; !this.m.a(i, j); j += this.k.nextInt(64) - this.k.nextInt(64)) { + i += this.k.nextInt(64) - this.k.nextInt(64); + } + + this.q.a(i, b0, j); + this.r = false; + } + public int a(int i, int j) { int k; @@ -123,7 +127,7 @@ public class World implements IBlockAccess { iprogressupdate.a("Saving level"); } - this.r(); + this.t(); if (iprogressupdate != null) { iprogressupdate.b("Saving chunks"); } @@ -132,8 +136,8 @@ public class World implements IBlockAccess { } } - private void r() { - this.i(); + private void t() { + this.j(); this.p.a(this.q, this.d); } @@ -530,7 +534,7 @@ public class World implements IBlockAccess { return this.m.f[this.j(i, j, k)]; } - public boolean c() { + public boolean d() { return this.e < 4; } @@ -731,7 +735,7 @@ public class World implements IBlockAccess { EntityHuman entityhuman = (EntityHuman) entity; this.d.add(entityhuman); - this.o(); + this.q(); } this.c(i, j).a(entity); @@ -762,18 +766,18 @@ public class World implements IBlockAccess { entity.b((Entity) null); } - entity.C(); + entity.D(); if (entity instanceof EntityHuman) { this.d.remove((EntityHuman) entity); - this.o(); + this.q(); } } public void e(Entity entity) { - entity.C(); + entity.D(); if (entity instanceof EntityHuman) { this.d.remove((EntityHuman) entity); - this.o(); + this.q(); } int i = entity.chunkX; @@ -900,7 +904,7 @@ public class World implements IBlockAccess { } } - public void d() { + public void e() { this.b.removeAll(this.v); int i; @@ -974,7 +978,7 @@ public class World implements IBlockAccess { entity.lastPitch = entity.pitch; if (flag && entity.bA) { if (entity.vehicle != null) { - entity.x(); + entity.o_(); } else { entity.f_(); } @@ -1034,7 +1038,7 @@ public class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - if (!entity.dead && entity.aC) { + if (!entity.dead && entity.aD) { return false; } } @@ -1268,7 +1272,7 @@ public class World implements IBlockAccess { return block == null ? false : block.a(); } - public boolean e() { + public boolean f() { if (this.C >= 50) { return false; } else { @@ -1345,7 +1349,7 @@ public class World implements IBlockAccess { } } - public void f() { + public void g() { int i = this.a(1.0F); if (i != this.e) { @@ -1358,10 +1362,10 @@ public class World implements IBlockAccess { this.E = flag1; } - public void g() { + public void h() { long i; - if (this.q()) { + if (this.s()) { boolean flag = false; if (this.D && this.j >= 1) { @@ -1371,7 +1375,7 @@ public class World implements IBlockAccess { if (!flag) { i = this.q.f() + 24000L; this.q.a(i - i % 24000L); - this.p(); + this.r(); } } @@ -1399,10 +1403,10 @@ public class World implements IBlockAccess { this.q.a(i); this.a(false); - this.h(); + this.i(); } - protected void h() { + protected void i() { this.F.clear(); int i; @@ -1465,10 +1469,10 @@ public class World implements IBlockAccess { j1 = l & 15; k1 = l >> 8 & 15; l1 = l >> 16 & 127; - byte b1 = chunk.b[j1 << 11 | k1 << 7 | l1]; + int i2 = chunk.b[j1 << 11 | k1 << 7 | l1] & 255; - if (Block.n[b1]) { - Block.byId[b1].a(this, j1 + i, l1, k1 + j, this.k); + if (Block.n[i2]) { + Block.byId[i2].a(this, j1 + i, l1, k1 + j, this.k); } } } @@ -1692,6 +1696,16 @@ public class World implements IBlockAccess { return entityhuman; } + public EntityHuman a(String s) { + for (int i = 0; i < this.d.size(); ++i) { + if (s.equals(((EntityHuman) this.d.get(i)).name)) { + return (EntityHuman) this.d.get(i); + } + } + + return null; + } + public byte[] c(int i, int j, int k, int l, int i1, int j1) { byte[] abyte = new byte[l * i1 * j1 * 5 / 2]; int k1 = i >> 4; @@ -1741,7 +1755,7 @@ public class World implements IBlockAccess { return abyte; } - public void i() { + public void j() { this.p.b(); } @@ -1749,15 +1763,15 @@ public class World implements IBlockAccess { this.q.a(i); } - public long j() { + public long k() { return this.q.b(); } - public long k() { + public long l() { return this.q.f(); } - public ChunkCoordinates l() { + public ChunkCoordinates m() { return new ChunkCoordinates(this.q.c(), this.q.d(), this.q.e()); } @@ -1767,6 +1781,10 @@ public class World implements IBlockAccess { public void a(Entity entity, byte b0) {} + public IChunkProvider n() { + return this.o; + } + public void d(int i, int j, int k, int l, int i1) { int j1 = this.getTypeId(i, j, k); @@ -1775,42 +1793,42 @@ public class World implements IBlockAccess { } } - public IDataManager m() { + public IDataManager o() { return this.p; } - public WorldData n() { + public WorldData p() { return this.q; } - public void o() { + public void q() { this.A = !this.d.isEmpty(); Iterator iterator = this.d.iterator(); while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); - if (!entityhuman.E()) { + if (!entityhuman.F()) { this.A = false; break; } } } - protected void p() { + protected void r() { this.A = false; Iterator iterator = this.d.iterator(); while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); - if (entityhuman.E()) { - entityhuman.a(false, false); + if (entityhuman.F()) { + entityhuman.a(false, false, false); } } } - public boolean q() { + public boolean s() { if (this.A && !this.isStatic) { Iterator iterator = this.d.iterator(); @@ -1822,7 +1840,7 @@ public class World implements IBlockAccess { } entityhuman = (EntityHuman) iterator.next(); - } while (entityhuman.F()); + } while (entityhuman.G()); return false; } else { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 4b07b047..5172d506 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -19,8 +19,8 @@ public class WorldServer extends World implements BlockChangeDelegate { private EntityList y = new EntityList(); public PlayerManager manager; // CraftBukkit - public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) { - super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i)); + public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, long j) { + super(idatamanager, s, j, WorldProvider.a(i)); this.x = minecraftserver; // CraftBukkit start @@ -44,7 +44,7 @@ public class WorldServer extends World implements BlockChangeDelegate { public void a(Entity entity, boolean flag) { // CraftBukkit start -- We prevent spawning in general, so this butchering is not needed //if (!this.x.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { - // entity.C(); + // entity.D(); //} // CraftBukkit end @@ -128,7 +128,7 @@ public class WorldServer extends World implements BlockChangeDelegate { this.x.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1)); } - public void r() { + public void t() { this.p.e(); } } -- cgit v1.2.3