From f759e0b60d3a575d31921c930e436af321b0e7e8 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Wed, 23 Feb 2011 02:37:56 +0000 Subject: [PATCH] Update to Minecraft 1.3 beta --- pom.xml | 2 +- .../net/minecraft/server/BlockButton.java | 132 ++-- .../net/minecraft/server/BlockCactus.java | 4 +- .../java/net/minecraft/server/BlockChest.java | 4 +- .../net/minecraft/server/BlockDispenser.java | 6 +- .../java/net/minecraft/server/BlockDoor.java | 39 +- .../java/net/minecraft/server/BlockFence.java | 24 - .../java/net/minecraft/server/BlockFire.java | 42 +- .../net/minecraft/server/BlockFlowing.java | 22 +- .../net/minecraft/server/BlockJukeBox.java | 12 +- .../net/minecraft/server/BlockLeaves.java | 48 +- .../java/net/minecraft/server/BlockLever.java | 28 +- .../minecraft/server/BlockPressurePlate.java | 8 +- .../minecraft/server/BlockRedstoneTorch.java | 22 +- .../minecraft/server/BlockRedstoneWire.java | 30 +- .../net/minecraft/server/BlockStationary.java | 10 +- .../net/minecraft/server/BlockWorkbench.java | 2 +- src/main/java/net/minecraft/server/Chunk.java | 75 +- .../server/ChunkProviderGenerate.java | 567 --------------- .../minecraft/server/ChunkProviderServer.java | 15 +- .../server/ConsoleCommandHandler.java | 290 ++++++++ .../java/net/minecraft/server/Entity.java | 302 ++++---- .../net/minecraft/server/EntityArrow.java | 60 +- .../java/net/minecraft/server/EntityBoat.java | 54 +- .../net/minecraft/server/EntityCreature.java | 30 +- .../net/minecraft/server/EntityCreeper.java | 24 +- .../java/net/minecraft/server/EntityEgg.java | 72 +- .../net/minecraft/server/EntityFireball.java | 76 +- .../java/net/minecraft/server/EntityFish.java | 113 ++- .../net/minecraft/server/EntityHuman.java | 364 +++++++--- .../java/net/minecraft/server/EntityItem.java | 24 +- .../net/minecraft/server/EntityLiving.java | 366 +++++----- .../net/minecraft/server/EntityMinecart.java | 184 ++--- .../net/minecraft/server/EntityMonster.java | 26 +- .../net/minecraft/server/EntityPigZombie.java | 24 +- .../net/minecraft/server/EntityPlayer.java | 207 +++--- .../net/minecraft/server/EntitySkeleton.java | 10 +- .../net/minecraft/server/EntitySnowball.java | 66 +- .../net/minecraft/server/EntitySpider.java | 8 +- .../net/minecraft/server/EntityTNTPrimed.java | 22 +- .../minecraft/server/EntityTrackerEntry.java | 29 +- .../net/minecraft/server/EntityZombie.java | 10 +- .../java/net/minecraft/server/Explosion.java | 14 +- .../java/net/minecraft/server/IInventory.java | 12 +- .../server/InventoryCraftResult.java | 14 +- .../minecraft/server/InventoryCrafting.java | 18 +- .../minecraft/server/InventoryLargeChest.java | 32 +- .../net/minecraft/server/InventoryPlayer.java | 40 +- .../java/net/minecraft/server/ItemBlock.java | 12 +- .../java/net/minecraft/server/ItemBucket.java | 4 +- .../java/net/minecraft/server/ItemHoe.java | 6 +- .../minecraft/server/ItemInWorldManager.java | 123 ++-- .../java/net/minecraft/server/ItemStack.java | 6 +- .../net/minecraft/server/MinecraftServer.java | 306 ++------ .../net/minecraft/server/NetLoginHandler.java | 11 +- .../minecraft/server/NetServerHandler.java | 187 ++--- .../net/minecraft/server/PlayerInstance.java | 12 +- .../net/minecraft/server/PlayerManager.java | 65 +- .../net/minecraft/server/PropertyManager.java | 6 + .../server/ServerConfigurationManager.java | 146 ++-- src/main/java/net/minecraft/server/Slot.java | 40 +- .../net/minecraft/server/TileEntityChest.java | 64 +- .../minecraft/server/TileEntityDispenser.java | 240 +++---- .../minecraft/server/TileEntityFurnace.java | 82 +-- .../server/TileEntityMobSpawner.java | 80 +-- src/main/java/net/minecraft/server/World.java | 656 +++++++++--------- .../java/net/minecraft/server/WorldData.java | 147 ++++ .../net/minecraft/server/WorldGenTrees.java | 200 +++--- .../net/minecraft/server/WorldServer.java | 62 +- .../org/bukkit/craftbukkit/CraftServer.java | 15 +- .../org/bukkit/craftbukkit/CraftWorld.java | 21 +- .../bukkit/craftbukkit/block/CraftBlock.java | 3 +- .../bukkit/craftbukkit/block/CraftChest.java | 80 +-- .../block/CraftCreatureSpawner.java | 168 ++--- .../craftbukkit/block/CraftDispenser.java | 2 +- .../craftbukkit/block/CraftFurnace.java | 112 +-- .../craftbukkit/block/CraftNoteBlock.java | 4 +- .../bukkit/craftbukkit/block/CraftSign.java | 9 +- .../craftbukkit/entity/CraftPlayer.java | 2 +- .../bukkit/craftbukkit/entity/CraftSheep.java | 4 +- .../craftbukkit/inventory/CraftInventory.java | 8 +- .../inventory/CraftInventoryPlayer.java | 2 +- .../craftbukkit/inventory/CraftSlot.java | 6 +- 83 files changed, 3182 insertions(+), 3292 deletions(-) delete mode 100644 src/main/java/net/minecraft/server/BlockFence.java delete mode 100644 src/main/java/net/minecraft/server/ChunkProviderGenerate.java create mode 100644 src/main/java/net/minecraft/server/ConsoleCommandHandler.java create mode 100644 src/main/java/net/minecraft/server/WorldData.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/block/CraftChest.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/block/CraftSign.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java mode change 100644 => 100755 src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java diff --git a/pom.xml b/pom.xml index da81536713..9628e8bc23 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ org.bukkit minecraft-server - 1.2_01_02 + 1.3 jar compile diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 9f11dec6d0..ba4d1fe804 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -35,46 +35,32 @@ public class BlockButton extends Block { return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : world.d(i, j, k + 1))); } - public void c(World world, int i, int j, int k, int l) { + public void d(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); int j1 = i1 & 8; i1 &= 7; if (l == 2 && world.d(i, j, k + 1)) { i1 = 4; - } - - if (l == 3 && world.d(i, j, k - 1)) { + } else if (l == 3 && world.d(i, j, k - 1)) { i1 = 3; - } - - if (l == 4 && world.d(i + 1, j, k)) { + } else if (l == 4 && world.d(i + 1, j, k)) { i1 = 2; - } - - if (l == 5 && world.d(i - 1, j, k)) { + } else if (l == 5 && world.d(i - 1, j, k)) { i1 = 1; + } else { + i1 = this.g(world, i, j, k); } world.c(i, j, k, i1 + j1); } - public void e(World world, int i, int j, int k) { - if (world.d(i - 1, j, k)) { - world.c(i, j, k, 1); - } else if (world.d(i + 1, j, k)) { - world.c(i, j, k, 2); - } else if (world.d(i, j, k - 1)) { - world.c(i, j, k, 3); - } else if (world.d(i, j, k + 1)) { - world.c(i, j, k, 4); - } - - this.g(world, i, j, k); + private int g(World world, int i, int j, int k) { + return world.d(i - 1, j, k) ? 1 : (world.d(i + 1, j, k) ? 2 : (world.d(i, j, k - 1) ? 3 : (world.d(i, j, k + 1) ? 4 : 1))); } - public void b(World world, int i, int j, int k, int l) { - if (this.g(world, i, j, k)) { + public void a(World world, int i, int j, int k, int l) { + if (this.h(world, i, j, k)) { int i1 = world.getData(i, j, k) & 7; boolean flag = false; @@ -95,15 +81,15 @@ public class BlockButton extends Block { } if (flag) { - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } } - private boolean g(World world, int i, int j, int k) { + private boolean h(World world, int i, int j, int k) { if (!this.a(world, i, j, k)) { - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); return false; } else { @@ -140,60 +126,56 @@ public class BlockButton extends Block { } public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) { - if (world.isStatic) { + // CraftBukkit start - Interact Button + CraftWorld craftWorld = ((WorldServer) world).getWorld(); + CraftServer server = ((WorldServer) world).getServer(); + Type eventType = Type.BLOCK_INTERACT; + CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); + LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity(); + + BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); + server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return true; + } + // CraftBukkit end + + int l = world.getData(i, j, k); + int i1 = l & 7; + int j1 = 8 - (l & 8); + + if (j1 == 0) { return true; } else { - // CraftBukkit start - Interact Button - CraftWorld craftWorld = ((WorldServer) world).getWorld(); - CraftServer server = ((WorldServer) world).getServer(); - Type eventType = Type.BLOCK_INTERACT; - CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); - LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity(); - - BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); - server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { + // Craftbukkit start + int old = (j1 != 8) ? 1 : 0; + int current = (j1 == 8) ? 1 : 0; + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); + server.getPluginManager().callEvent(eventRedstone); + if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) { return true; } - // CraftBukkit end + // Craftbukkit end - int l = world.getData(i, j, k); - int i1 = l & 7; - int j1 = 8 - (l & 8); - - if (j1 == 0) { - return true; + world.c(i, j, k, i1 + j1); + world.b(i, j, k, i, j, k); + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); + world.h(i, j, k, this.id); + if (i1 == 1) { + world.h(i - 1, j, k, this.id); + } else if (i1 == 2) { + world.h(i + 1, j, k, this.id); + } else if (i1 == 3) { + world.h(i, j, k - 1, this.id); + } else if (i1 == 4) { + world.h(i, j, k + 1, this.id); } else { - // Craftbukkit start - int old = (j1 != 8) ? 1 : 0; - int current = (j1 == 8) ? 1 : 0; - BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); - server.getPluginManager().callEvent(eventRedstone); - if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) { - return true; - } - // Craftbukkit end - - world.c(i, j, k, i1 + j1); - world.b(i, j, k, i, j, k); - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); - world.h(i, j, k, this.id); - if (i1 == 1) { - world.h(i - 1, j, k, this.id); - } else if (i1 == 2) { - world.h(i + 1, j, k, this.id); - } else if (i1 == 3) { - world.h(i, j, k - 1, this.id); - } else if (i1 == 4) { - world.h(i, j, k + 1, this.id); - } else { - world.h(i, j - 1, k, this.id); - } - - world.i(i, j, k, this.id); - return true; + world.h(i, j - 1, k, this.id); } + + world.c(i, j, k, this.id, this.b()); + return true; } } @@ -224,7 +206,7 @@ public class BlockButton extends Block { return (iblockaccess.getData(i, j, k) & 8) > 0; } - public boolean d(World world, int i, int j, int k, int l) { + public boolean c(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); if ((i1 & 8) == 0) { diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index e71e0f4ef4..b0831145f9 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -55,9 +55,9 @@ public class BlockCactus extends Block { return !super.a(world, i, j, k) ? false : this.f(world, i, j, k); } - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { if (!this.f(world, i, j, k)) { - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java index 224fd576ce..85a6d5a4b3 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java @@ -53,8 +53,8 @@ public class BlockChest extends BlockContainer { public void b(World world, int i, int j, int k) { TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k); - for (int l = 0; l < tileentitychest.h_(); ++l) { - ItemStack itemstack = tileentitychest.a(l); + for (int l = 0; l < tileentitychest.m_(); ++l) { + ItemStack itemstack = tileentitychest.c_(l); if (itemstack != null) { float f = this.a.nextFloat() * 0.8F + 0.1F; diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java index 473a79bf05..e86b1c5664 100644 --- a/src/main/java/net/minecraft/server/BlockDispenser.java +++ b/src/main/java/net/minecraft/server/BlockDispenser.java @@ -101,7 +101,7 @@ public class BlockDispenser extends BlockContainer { } TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); - ItemStack itemstack = tileentitydispenser.e(); + ItemStack itemstack = tileentitydispenser.b(); double d0 = (double) i + (double) f * 0.5D + 0.5D; double d1 = (double) j + 0.5D; double d2 = (double) k + (double) f1 * 0.5D + 0.5D; @@ -157,12 +157,12 @@ public class BlockDispenser extends BlockContainer { } } - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { if (l > 0 && Block.byId[l].c()) { boolean flag = world.p(i, j, k) || world.p(i, j + 1, k); if (flag) { - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); } } } diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index 76f1fd9cf2..9496b9fd1b 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -26,6 +26,29 @@ public class BlockDoor extends Block { this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); } + public int a(int i, int j) { + if (i != 0 && i != 1) { + int k = this.d(j); + + if ((k == 0 || k == 2) ^ i <= 3) { + return this.textureId; + } else { + int l = k / 2 + (i & 1 ^ k); + + l += (j & 4) / 4; + int i1 = this.textureId - (j & 8) * 2; + + if ((l & 1) != 0) { + i1 = -i1; + } + + return i1; + } + } else { + return this.textureId; + } + } + public boolean a() { return false; } @@ -103,9 +126,9 @@ public class BlockDoor extends Block { world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } else { - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } return true; @@ -131,15 +154,15 @@ public class BlockDoor extends Block { world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } else { - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } } } } - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); if ((i1 & 8) != 0) { @@ -148,7 +171,7 @@ public class BlockDoor extends Block { } if (l > 0 && Block.byId[l].c()) { - this.b(world, i, j - 1, k, l); + this.a(world, i, j - 1, k, l); } } else { boolean flag = false; @@ -167,7 +190,9 @@ public class BlockDoor extends Block { } if (flag) { - this.a_(world, i, j, k, i1); + if (!world.isStatic) { + this.b_(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/BlockFence.java b/src/main/java/net/minecraft/server/BlockFence.java deleted file mode 100644 index 7ed8589827..0000000000 --- a/src/main/java/net/minecraft/server/BlockFence.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.minecraft.server; - -import java.util.ArrayList; - -public class BlockFence extends Block { - - public BlockFence(int i, int j) { - super(i, j, Material.WOOD); - this.a(0, 0, 0, 1, (float) 1.5, 1); //Craftbukkit - } - - //Removed by craftbukkit -// public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) { -// arraylist.add(AxisAlignedBB.b((double) i, (double) j, (double) k, (double) (i + 1), (double) j + 2.0D, (double) (k + 1))); -// } - - public boolean a(World world, int i, int j, int k) { - return world.getTypeId(i, j - 1, k) == this.id ? false : (!world.getMaterial(i, j - 1, k).isBuildable() ? false : super.a(world, i, j, k)); - } - - public boolean a() { - return false; - } -} diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index 62cbbc1bdf..8dde05536f 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -54,7 +54,7 @@ public class BlockFire extends Block { if (l < 15) { world.c(i, j, k, l + 1); - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); } if (!flag && !this.g(world, i, j, k)) { @@ -112,18 +112,16 @@ public class BlockFire extends Block { } } } - } - // Craftbukkit start - won't be needed next port hopefully - if(l == 15) { - this.a(world, i + 1, j, k, 1, random); - this.a(world, i - 1, j, k, 1, random); - this.a(world, i, j - 1, k, 1, random); - this.a(world, i, j + 1, k, 1, random); - this.a(world, i, j, k - 1, 1, random); - this.a(world, i, j, k + 1, 1, random); + if (l == 15) { + this.a(world, i + 1, j, k, 1, random); + this.a(world, i - 1, j, k, 1, random); + this.a(world, i, j - 1, k, 1, random); + this.a(world, i, j + 1, k, 1, random); + this.a(world, i, j, k - 1, 1, random); + this.a(world, i, j, k + 1, 1, random); + } } - // Craftbukkit end } private void a(World world, int i, int j, int k, int l, Random random) { @@ -149,7 +147,7 @@ public class BlockFire extends Block { } if (flag) { - Block.TNT.a(world, i, j, k, 0); + Block.TNT.b(world, i, j, k, 0); } } } @@ -167,13 +165,13 @@ public class BlockFire extends Block { if (!world.isEmpty(i, j, k)) { return 0; } else { - int l = this.f(world, i + 1, j, k, b0); + int l = this.g(world, i + 1, j, k, b0); - 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); + 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); return l; } } @@ -186,7 +184,7 @@ public class BlockFire extends Block { return this.a[iblockaccess.getTypeId(i, j, k)] > 0; } - public int f(World world, int i, int j, int k, int l) { + public int g(World world, int i, int j, int k, int l) { int i1 = this.a[world.getTypeId(i, j, k)]; return i1 > l ? i1 : l; @@ -196,18 +194,18 @@ public class BlockFire extends Block { return world.d(i, j - 1, k) || this.g(world, i, j, k); } - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) { world.e(i, j, k, 0); } } public void e(World world, int i, int j, int k) { - if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) { + if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.a_(world, i, j, k)) { if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) { world.e(i, j, k, 0); } else { - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); } } } diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 5d89484a07..cb567d4199 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids { int l = this.g(world, i, j, k); byte b0 = 1; - if (this.material == Material.LAVA && !world.q.d) { + if (this.material == Material.LAVA && !world.m.d) { b0 = 2; } @@ -46,11 +46,11 @@ public class BlockFlowing extends BlockFluids { byte b1 = -100; this.a = 0; - int j1 = this.e(world, i - 1, j, k, b1); + int j1 = this.f(world, i - 1, j, k, b1); - 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); + 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); i1 = j1 + b0; if (i1 >= 8 || j1 < 0) { i1 = -1; @@ -85,7 +85,7 @@ public class BlockFlowing extends BlockFluids { world.e(i, j, k, 0); } else { world.c(i, j, k, i1); - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); world.h(i, j, k, this.id); } } else if (flag) { @@ -129,7 +129,7 @@ public class BlockFlowing extends BlockFluids { BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace); ((WorldServer) world).getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1); + this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1); } } index++; @@ -138,7 +138,7 @@ public class BlockFlowing extends BlockFluids { } } - private void f(World world, int i, int j, int k, int l) { + private void g(World world, int i, int j, int k, int l) { if (this.l(world, i, j, k)) { int i1 = world.getTypeId(i, j, k); @@ -146,7 +146,7 @@ public class BlockFlowing extends BlockFluids { if (this.material == Material.LAVA) { this.h(world, i, j, k); } else { - Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k)); + Block.byId[i1].b_(world, i, j, k, world.getData(i, j, k)); } } @@ -262,7 +262,7 @@ public class BlockFlowing extends BlockFluids { } } - protected int e(World world, int i, int j, int k, int l) { + protected int f(World world, int i, int j, int k, int l) { int i1 = this.g(world, i, j, k); if (i1 < 0) { @@ -289,7 +289,7 @@ public class BlockFlowing extends BlockFluids { public void e(World world, int i, int j, int k) { super.e(world, i, j, k); if (world.getTypeId(i, j, k) == this.id) { - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); } } } diff --git a/src/main/java/net/minecraft/server/BlockJukeBox.java b/src/main/java/net/minecraft/server/BlockJukeBox.java index 536df7f015..bf802f1a9f 100644 --- a/src/main/java/net/minecraft/server/BlockJukeBox.java +++ b/src/main/java/net/minecraft/server/BlockJukeBox.java @@ -38,21 +38,21 @@ public class BlockJukeBox extends Block { } // CraftBukkit end - this.f(world, i, j, k, l); + this.e(world, i, j, k, l); return true; } else { return false; } } - public void f(World world, int i, int j, int k, int l) { + public void e(World world, int i, int j, int k, int l) { world.a((String) null, i, j, k); world.c(i, j, k, 0); int i1 = Item.GOLD_RECORD.id + l - 1; float f = 0.7F; - double d0 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; - double d2 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d0 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; + double d2 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0)); entityitem.c = 10; @@ -62,7 +62,7 @@ public class BlockJukeBox extends Block { public void a(World world, int i, int j, int k, int l, float f) { if (!world.isStatic) { if (l > 0) { - this.f(world, i, j, k, l); + this.e(world, i, j, k, l); } super.a(world, i, j, k, l, f); diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index 692989ec7a..b098322524 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -12,7 +12,7 @@ import org.bukkit.event.block.LeavesDecayEvent; public class BlockLeaves extends BlockLeavesBase { private int c; - int[] b; + int[] a; protected BlockLeaves(int i, int j) { super(i, j, Material.LEAVES, false); @@ -52,8 +52,8 @@ public class BlockLeaves extends BlockLeavesBase { int j1 = b1 * b1; int k1 = b1 / 2; - if (this.b == null) { - this.b = new int[b1 * b1 * b1]; + if (this.a == null) { + this.a = new int[b1 * b1 * b1]; } int l1; @@ -68,11 +68,11 @@ public class BlockLeaves extends BlockLeavesBase { for (j2 = -b0; j2 <= b0; ++j2) { k2 = world.getTypeId(i + l1, j + i2, k + j2); if (k2 == Block.LOG.id) { - this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; + this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; } else if (k2 == Block.LEAVES.id) { - this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; + this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; } else { - this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1; + this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1; } } } @@ -82,29 +82,29 @@ public class BlockLeaves extends BlockLeavesBase { for (i2 = -b0; i2 <= b0; ++i2) { for (j2 = -b0; j2 <= b0; ++j2) { for (k2 = -b0; k2 <= b0; ++k2) { - if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) { - if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { - this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; + if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) { + if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { + this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; } - if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { - this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; + if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { + this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; } - if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) { - this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1; + if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) { + this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1; } - if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) { - this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1; + if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) { + this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1; } - if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) { - this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1; + if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) { + this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1; } - if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) { - this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1; + if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) { + this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1; } } } @@ -113,7 +113,7 @@ public class BlockLeaves extends BlockLeavesBase { } } - l1 = this.b[k1 * j1 + k1 * b1 + k1]; + l1 = this.a[k1 * j1 + k1 * b1 + k1]; if (l1 >= 0) { world.c(i, j, k, l & -5); } else { @@ -133,7 +133,7 @@ public class BlockLeaves extends BlockLeavesBase { if (event.isCancelled()) return; // CraftBukkit end - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } @@ -146,7 +146,11 @@ public class BlockLeaves extends BlockLeavesBase { } public boolean a() { - return !this.a; + return !this.b; + } + + public int a(int i, int j) { + return (j & 3) == 1 ? this.textureId + 80 : this.textureId; } public void b(World world, int i, int j, int k, Entity entity) { diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java index 1db1637ecd..d7ffb60823 100644 --- a/src/main/java/net/minecraft/server/BlockLever.java +++ b/src/main/java/net/minecraft/server/BlockLever.java @@ -28,13 +28,13 @@ public class BlockLever extends Block { return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : (world.d(i, j, k + 1) ? true : world.d(i, j - 1, k)))); } - public void c(World world, int i, int j, int k, int l) { + public void d(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); int j1 = i1 & 8; i1 &= 7; if (l == 1 && world.d(i, j - 1, k)) { - i1 = 5 + world.l.nextInt(2); + i1 = 5 + world.k.nextInt(2); } if (l == 2 && world.d(i, j, k + 1)) { @@ -56,23 +56,7 @@ public class BlockLever extends Block { world.c(i, j, k, i1 + j1); } - public void e(World world, int i, int j, int k) { - if (world.d(i - 1, j, k)) { - world.c(i, j, k, 1); - } else if (world.d(i + 1, j, k)) { - world.c(i, j, k, 2); - } else if (world.d(i, j, k - 1)) { - world.c(i, j, k, 3); - } else if (world.d(i, j, k + 1)) { - world.c(i, j, k, 4); - } else if (world.d(i, j - 1, k)) { - world.c(i, j, k, 5 + world.l.nextInt(2)); - } - - this.g(world, i, j, k); - } - - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { if (this.g(world, i, j, k)) { int i1 = world.getData(i, j, k) & 7; boolean flag = false; @@ -98,7 +82,7 @@ public class BlockLever extends Block { } if (flag) { - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } @@ -106,7 +90,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.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); return false; } else { @@ -220,7 +204,7 @@ public class BlockLever extends Block { return (iblockaccess.getData(i, j, k) & 8) > 0; } - public boolean d(World world, int i, int j, int k, int l) { + public boolean c(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); if ((i1 & 8) == 0) { diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index 10e55f190d..98391e494c 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -44,7 +44,7 @@ public class BlockPressurePlate extends Block { public void e(World world, int i, int j, int k) {} - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { boolean flag = false; if (!world.d(i, j - 1, k)) { @@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block { } if (flag) { - this.a_(world, i, j, k, world.getData(i, j, k)); + this.b_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } @@ -139,7 +139,7 @@ public class BlockPressurePlate extends Block { } if (flag1) { - world.i(i, j, k, this.id); + world.c(i, j, k, this.id, this.b()); } } @@ -169,7 +169,7 @@ public class BlockPressurePlate extends Block { return iblockaccess.getData(i, j, k) > 0; } - public boolean d(World world, int i, int j, int k, int l) { + public boolean c(World world, int i, int j, int k, int l) { return world.getData(i, j, k) == 0 ? false : l == 1; } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java index d745686fc1..4733f78bd2 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -14,9 +14,13 @@ public class BlockRedstoneTorch extends BlockTorch { private boolean a = false; private static List b = new ArrayList(); + public int a(int i, int j) { + return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j); + } + private boolean a(World world, int i, int j, int k, boolean flag) { if (flag) { - b.add(new RedstoneUpdateInfo(i, j, k, world.e)); + b.add(new RedstoneUpdateInfo(i, j, k, world.k())); } int l = 0; @@ -84,13 +88,13 @@ public class BlockRedstoneTorch extends BlockTorch { private boolean g(World world, int i, int j, int k) { int l = world.getData(i, j, k); - return l == 5 && world.k(i, j - 1, k, 0) ? true : (l == 3 && world.k(i, j, k - 1, 2) ? true : (l == 4 && world.k(i, j, k + 1, 3) ? true : (l == 1 && world.k(i - 1, j, k, 4) ? true : l == 2 && world.k(i + 1, j, k, 5)))); + return l == 5 && world.j(i, j - 1, k, 0) ? true : (l == 3 && world.j(i, j, k - 1, 2) ? true : (l == 4 && world.j(i, j, k + 1, 3) ? true : (l == 1 && world.j(i - 1, j, k, 4) ? true : l == 2 && world.j(i + 1, j, k, 5)))); } 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.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L) { + while (b.size() > 0 && world.k() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) { b.remove(0); } @@ -107,7 +111,7 @@ public class BlockRedstoneTorch extends BlockTorch { if (flag) { world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k)); if (this.a(world, i, j, k, true)) { - world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F); + world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F); for (int l = 0; l < 5; ++l) { double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D; @@ -123,13 +127,13 @@ public class BlockRedstoneTorch extends BlockTorch { } } - public void b(World world, int i, int j, int k, int l) { - super.b(world, i, j, k, l); - world.i(i, j, k, this.id); + public void a(World world, int i, int j, int k, int l) { + super.a(world, i, j, k, l); + world.c(i, j, k, this.id, this.b()); } - public boolean d(World world, int i, int j, int k, int l) { - return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; + public boolean c(World world, int i, int j, int k, int l) { + return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; // CraftBukkit -- cast to IBlockAccess } public int a(int i, Random random) { diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java index a12c023af7..2b62393f37 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -20,6 +20,10 @@ public class BlockRedstoneWire extends Block { this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); } + public int a(int i, int j) { + return this.textureId; + } + public AxisAlignedBB d(World world, int i, int j, int k) { return null; } @@ -80,15 +84,15 @@ public class BlockRedstoneWire extends Block { } if (j2 != l || j != i1 || k2 != j1) { - l1 = this.f(world, j2, j, k2, l1); + l1 = this.g(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.f(world, j2, j + 1, k2, l1); + l1 = this.g(world, j2, j + 1, k2, l1); } } else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) { - l1 = this.f(world, j2, j - 1, k2, l1); + l1 = this.g(world, j2, j - 1, k2, l1); } } @@ -109,10 +113,10 @@ public class BlockRedstoneWire extends Block { // Craftbukkit end if (k1 != l1) { - world.i = true; + world.h = true; world.c(i, j, k, l1); world.b(i, j, k, i, j, k); - world.i = false; + world.h = false; for (i2 = 0; i2 < 4; ++i2) { j2 = i; @@ -140,7 +144,7 @@ public class BlockRedstoneWire extends Block { } boolean flag1 = false; - int i3 = this.f(world, j2, j, k2, -1); + int i3 = this.g(world, j2, j, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { @@ -151,7 +155,7 @@ public class BlockRedstoneWire extends Block { this.a(world, j2, j, k2, i, j, k); } - i3 = this.f(world, j2, l2, k2, -1); + i3 = this.g(world, j2, l2, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { --l1; @@ -258,7 +262,7 @@ public class BlockRedstoneWire extends Block { } } - private int f(World world, int i, int j, int k, int l) { + private int g(World world, int i, int j, int k, int l) { if (world.getTypeId(i, j, k) != this.id) { return l; } else { @@ -268,19 +272,19 @@ public class BlockRedstoneWire extends Block { } } - public void b(World world, int i, int j, int k, int l) { + public void a(World world, int i, int j, int k, int l) { if (!world.isStatic) { int i1 = world.getData(i, j, k); boolean flag = this.a(world, i, j, k); if (!flag) { - this.a_(world, i, j, k, i1); + this.b_(world, i, j, k, i1); world.e(i, j, k, 0); } else { this.g(world, i, j, k); } - super.b(world, i, j, k, l); + super.a(world, i, j, k, l); } } @@ -288,8 +292,8 @@ public class BlockRedstoneWire extends Block { return Item.REDSTONE.id; } - public boolean d(World world, int i, int j, int k, int l) { - return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); + public boolean c(World world, int i, int j, int k, int l) { + return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); // CraftBukkit -- cast to IBlockAccess } public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) { diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java index ad86284ee8..dfe1e58d75 100644 --- a/src/main/java/net/minecraft/server/BlockStationary.java +++ b/src/main/java/net/minecraft/server/BlockStationary.java @@ -20,8 +20,8 @@ public class BlockStationary extends BlockFluids { } } - public void b(World world, int i, int j, int k, int l) { - super.b(world, i, j, k, l); + public void a(World world, int i, int j, int k, int l) { + super.a(world, i, j, k, l); if (world.getTypeId(i, j, k) == this.id) { this.i(world, i, j, k); } @@ -30,11 +30,11 @@ public class BlockStationary extends BlockFluids { private void i(World world, int i, int j, int k) { int l = world.getData(i, j, k); - world.i = true; + world.h = true; world.setTypeIdAndData(i, j, k, this.id - 1, l); world.b(i, j, k, i, j, k); - world.i(i, j, k, this.id - 1); - world.i = false; + world.c(i, j, k, this.id - 1, this.b()); + world.h = false; } public void a(World world, int i, int j, int k, Random random) { diff --git a/src/main/java/net/minecraft/server/BlockWorkbench.java b/src/main/java/net/minecraft/server/BlockWorkbench.java index 213b7750aa..6add34a4ea 100644 --- a/src/main/java/net/minecraft/server/BlockWorkbench.java +++ b/src/main/java/net/minecraft/server/BlockWorkbench.java @@ -39,7 +39,7 @@ public class BlockWorkbench extends Block { } // CraftBukkit end - entityhuman.a(i, j, k); + entityhuman.b(i, j, k); return true; } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index ef81adf90f..3f71badc73 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -95,7 +95,7 @@ public class Chunk { i = l; } - if (!this.d.q.e) { + if (!this.d.m.e) { int j1 = 15; int k1 = 127; @@ -122,50 +122,7 @@ public class Chunk { this.o = true; } - public void c() { - byte b0 = 32; - - for (int i = 0; i < 16; ++i) { - for (int j = 0; j < 16; ++j) { - int k = i << 11 | j << 7; - - int l; - int i1; - - for (l = 0; l < 128; ++l) { - i1 = Block.s[this.b[k + l]]; - if (i1 > 0) { - this.g.a(i, l, j, i1); - } - } - - l = 15; - - for (i1 = b0 - 2; i1 < 128 && l > 0; this.g.a(i, i1, j, l)) { - ++i1; - byte b1 = this.b[k + i1]; - int j1 = Block.q[b1]; - int k1 = Block.s[b1]; - - if (j1 == 0) { - j1 = 1; - } - - l -= j1; - if (k1 > l) { - l = k1; - } - - if (l < 0) { - l = 0; - } - } - } - } - - this.d.a(EnumSkyBlock.BLOCK, this.j * 16, b0 - 1, this.k * 16, this.j * 16 + 16, b0 + 1, this.k * 16 + 16); - this.o = true; - } + public void c() {} private void c(int i, int j) { int k = this.b(i, j); @@ -290,7 +247,7 @@ public class Chunk { } this.e.a(i, j, k, i1); - if (!this.d.q.e) { + if (!this.d.m.e) { if (Block.q[b0] != 0) { if (j >= j1) { this.g(i, j + 1, k); @@ -415,15 +372,15 @@ public class Chunk { k = this.m.length - 1; } - entity.ag = true; + entity.bA = true; entity.chunkX = this.j; - entity.ai = k; + entity.bC = k; entity.chunkZ = this.k; this.m[k].add(entity); } public void b(Entity entity) { - this.a(entity, entity.ai); + this.a(entity, entity.bC); } public void a(Entity entity, int i) { @@ -463,9 +420,9 @@ public class Chunk { } public void a(TileEntity tileentity) { - int i = tileentity.b - this.j * 16; - int j = tileentity.c; - int k = tileentity.d - this.k * 16; + int i = tileentity.e - this.j * 16; + int j = tileentity.f; + int k = tileentity.g - this.k * 16; this.a(i, j, k, tileentity); } @@ -473,10 +430,10 @@ public class Chunk { public void a(int i, int j, int k, TileEntity tileentity) { ChunkPosition chunkposition = new ChunkPosition(i, j, k); - tileentity.a = this.d; - tileentity.b = this.j * 16 + i; - tileentity.c = j; - tileentity.d = this.k * 16 + k; + tileentity.d = this.d; + tileentity.e = this.j * 16 + i; + tileentity.f = j; + tileentity.g = this.k * 16 + k; if (this.a(i, j, k) != 0 && Block.byId[this.a(i, j, k)] instanceof BlockContainer) { if (this.c) { if (this.l.get(chunkposition) != null) { @@ -577,10 +534,10 @@ public class Chunk { return false; } else { if (flag) { - if (this.q && this.d.e != this.r) { + if (this.q && this.d.k() != this.r) { return true; } - } else if (this.q && this.d.e >= this.r + 600L) { + } else if (this.q && this.d.k() >= this.r + 600L) { return true; } @@ -634,7 +591,7 @@ public class Chunk { } public Random a(long i) { - return new Random(this.d.u + (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.j() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i); } public boolean g() { diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java deleted file mode 100644 index a1987ce325..0000000000 --- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +++ /dev/null @@ -1,567 +0,0 @@ -package net.minecraft.server; - -import java.util.Random; - -public class ChunkProviderGenerate implements IChunkProvider { - - private Random j; - private NoiseGeneratorOctaves k; - private NoiseGeneratorOctaves l; - private NoiseGeneratorOctaves m; - private NoiseGeneratorOctaves n; - private NoiseGeneratorOctaves o; - public NoiseGeneratorOctaves a; - public NoiseGeneratorOctaves b; - public NoiseGeneratorOctaves c; - private World p; - private double[] q; - private double[] r = new double[256]; - private double[] s = new double[256]; - private double[] t = new double[256]; - private MapGenBase u = new MapGenCaves(); - private BiomeBase[] v; - double[] d; - double[] e; - double[] f; - double[] g; - double[] h; - int[][] i = new int[32][32]; - private double[] w; - - public ChunkProviderGenerate(World world, long i) { - this.p = world; - this.j = new Random(i); - this.k = new NoiseGeneratorOctaves(this.j, 16); - this.l = new NoiseGeneratorOctaves(this.j, 16); - this.m = new NoiseGeneratorOctaves(this.j, 8); - this.n = new NoiseGeneratorOctaves(this.j, 4); - this.o = new NoiseGeneratorOctaves(this.j, 4); - this.a = new NoiseGeneratorOctaves(this.j, 10); - this.b = new NoiseGeneratorOctaves(this.j, 16); - this.c = new NoiseGeneratorOctaves(this.j, 8); - } - - public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase, double[] adouble) { - byte b0 = 4; - byte b1 = 64; - int k = b0 + 1; - byte b2 = 17; - int l = b0 + 1; - - this.q = this.a(this.q, i * b0, 0, j * b0, k, b2, l); - - for (int i1 = 0; i1 < b0; ++i1) { - for (int j1 = 0; j1 < b0; ++j1) { - for (int k1 = 0; k1 < 16; ++k1) { - double d0 = 0.125D; - double d1 = this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0]; - double d2 = this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0]; - double d3 = this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0]; - double d4 = this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0]; - double d5 = (this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0; - double d6 = (this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0; - double d7 = (this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0; - double d8 = (this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0; - - for (int l1 = 0; l1 < 8; ++l1) { - double d9 = 0.25D; - double d10 = d1; - double d11 = d2; - double d12 = (d3 - d1) * d9; - double d13 = (d4 - d2) * d9; - - for (int i2 = 0; i2 < 4; ++i2) { - int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1; - short short1 = 128; - double d14 = 0.25D; - double d15 = d10; - double d16 = (d11 - d10) * d14; - - for (int k2 = 0; k2 < 4; ++k2) { - double d17 = adouble[(i1 * 4 + i2) * 16 + j1 * 4 + k2]; - int l2 = 0; - - if (k1 * 8 + l1 < b1) { - if (d17 < 0.5D && k1 * 8 + l1 >= b1 - 1) { - l2 = Block.ICE.id; - } else { - l2 = Block.STATIONARY_WATER.id; - } - } - - if (d15 > 0.0D) { - l2 = Block.STONE.id; - } - - abyte[j2] = (byte) l2; - j2 += short1; - d15 += d16; - } - - d10 += d12; - d11 += d13; - } - - d1 += d5; - d2 += d6; - d3 += d7; - d4 += d8; - } - } - } - } - } - - public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase) { - byte b0 = 64; - double d0 = 0.03125D; - - this.r = this.n.a(this.r, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0, d0, 1.0D); - this.s = this.n.a(this.s, (double) (i * 16), 109.0134D, (double) (j * 16), 16, 1, 16, d0, 1.0D, d0); // CraftBukkit -- i & j swapped. - this.t = this.o.a(this.t, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); - - for (int k = 0; k < 16; ++k) { - for (int l = 0; l < 16; ++l) { - BiomeBase biomebase = abiomebase[k + l * 16]; - boolean flag = this.r[k + l * 16] + this.j.nextDouble() * 0.2D > 0.0D; - boolean flag1 = this.s[k + l * 16] + this.j.nextDouble() * 0.2D > 3.0D; - int i1 = (int) (this.t[k + l * 16] / 3.0D + 3.0D + this.j.nextDouble() * 0.25D); - int j1 = -1; - byte b1 = biomebase.o; - byte b2 = biomebase.p; - - for (int k1 = 127; k1 >= 0; --k1) { - int l1 = (k + l * 16) * 128 + k1; // CraftBukkit (k*16+l) -> (k+l*16) - - if (k1 <= 0 + this.j.nextInt(5)) { - abyte[l1] = (byte) Block.BEDROCK.id; - } else { - byte b3 = abyte[l1]; - - if (b3 == 0) { - j1 = -1; - } else if (b3 == Block.STONE.id) { - if (j1 == -1) { - if (i1 <= 0) { - b1 = 0; - b2 = (byte) Block.STONE.id; - } else if (k1 >= b0 - 4 && k1 <= b0 + 1) { - b1 = biomebase.o; - b2 = biomebase.p; - if (flag1) { - b1 = 0; - } - - if (flag1) { - b2 = (byte) Block.GRAVEL.id; - } - - if (flag) { - b1 = (byte) Block.SAND.id; - } - - if (flag) { - b2 = (byte) Block.SAND.id; - } - } - - if (k1 < b0 && b1 == 0) { - b1 = (byte) Block.STATIONARY_WATER.id; - } - - j1 = i1; - if (k1 >= b0 - 1) { - abyte[l1] = b1; - } else { - abyte[l1] = b2; - } - } else if (j1 > 0) { - --j1; - abyte[l1] = b2; - } - } - } - } - } - } - } - - public Chunk b(int i, int j) { - this.j.setSeed((long) i * 341873128712L + (long) j * 132897987541L); - byte[] abyte = new byte['\u8000']; - Chunk chunk = new Chunk(this.p, abyte, i, j); - - this.v = this.p.a().a(this.v, i * 16, j * 16, 16, 16); - double[] adouble = this.p.a().a; - - this.a(i, j, abyte, this.v, adouble); - this.a(i, j, abyte, this.v); - this.u.a(this, this.p, i, j, abyte); - chunk.b(); - return chunk; - } - - private double[] a(double[] adouble, int i, int j, int k, int l, int i1, int j1) { - if (adouble == null) { - adouble = new double[l * i1 * j1]; - } - - double d0 = 684.412D; - double d1 = 684.412D; - double[] adouble1 = this.p.a().a; - double[] adouble2 = this.p.a().b; - - this.g = this.a.a(this.g, i, k, l, j1, 1.121D, 1.121D, 0.5D); - this.h = this.b.a(this.h, i, k, l, j1, 200.0D, 200.0D, 0.5D); - this.d = this.m.a(this.d, (double) i, (double) j, (double) k, l, i1, j1, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D); - this.e = this.k.a(this.e, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0); - this.f = this.l.a(this.f, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0); - int k1 = 0; - int l1 = 0; - int i2 = 16 / l; - - for (int j2 = 0; j2 < l; ++j2) { - int k2 = j2 * i2 + i2 / 2; - - for (int l2 = 0; l2 < j1; ++l2) { - int i3 = l2 * i2 + i2 / 2; - double d2 = adouble1[k2 * 16 + i3]; - double d3 = adouble2[k2 * 16 + i3] * d2; - double d4 = 1.0D - d3; - - d4 *= d4; - d4 *= d4; - d4 = 1.0D - d4; - double d5 = (this.g[l1] + 256.0D) / 512.0D; - - d5 *= d4; - if (d5 > 1.0D) { - d5 = 1.0D; - } - - double d6 = this.h[l1] / 8000.0D; - - if (d6 < 0.0D) { - d6 = -d6 * 0.3D; - } - - d6 = d6 * 3.0D - 2.0D; - if (d6 < 0.0D) { - d6 /= 2.0D; - if (d6 < -1.0D) { - d6 = -1.0D; - } - - d6 /= 1.4D; - d6 /= 2.0D; - d5 = 0.0D; - } else { - if (d6 > 1.0D) { - d6 = 1.0D; - } - - d6 /= 8.0D; - } - - if (d5 < 0.0D) { - d5 = 0.0D; - } - - d5 += 0.5D; - d6 = d6 * (double) i1 / 16.0D; - double d7 = (double) i1 / 2.0D + d6 * 4.0D; - - ++l1; - - for (int j3 = 0; j3 < i1; ++j3) { - double d8 = 0.0D; - double d9 = ((double) j3 - d7) * 12.0D / d5; - - if (d9 < 0.0D) { - d9 *= 4.0D; - } - - double d10 = this.e[k1] / 512.0D; - double d11 = this.f[k1] / 512.0D; - double d12 = (this.d[k1] / 10.0D + 1.0D) / 2.0D; - - if (d12 < 0.0D) { - d8 = d10; - } else if (d12 > 1.0D) { - d8 = d11; - } else { - d8 = d10 + (d11 - d10) * d12; - } - - d8 -= d9; - if (j3 > i1 - 4) { - double d13 = (double) ((float) (j3 - (i1 - 4)) / 3.0F); - - d8 = d8 * (1.0D - d13) + -10.0D * d13; - } - - adouble[k1] = d8; - ++k1; - } - } - } - - return adouble; - } - - public boolean a(int i, int j) { - return true; - } - - public void a(IChunkProvider ichunkprovider, int i, int j) { - BlockSand.a = true; - int k = i * 16; - int l = j * 16; - BiomeBase biomebase = this.p.a().a(k + 16, l + 16); - - this.j.setSeed(this.p.u); - long i1 = this.j.nextLong() / 2L * 2L + 1L; - long j1 = this.j.nextLong() / 2L * 2L + 1L; - - this.j.setSeed((long) i * i1 + (long) j * j1 ^ this.p.u); - double d0 = 0.25D; - int k1; - int l1; - int i2; - - if (this.j.nextInt(4) == 0) { - k1 = k + this.j.nextInt(16) + 8; - l1 = this.j.nextInt(128); - i2 = l + this.j.nextInt(16) + 8; - (new WorldGenLakes(Block.STATIONARY_WATER.id)).a(this.p, this.j, k1, l1, i2); - } - - if (this.j.nextInt(8) == 0) { - k1 = k + this.j.nextInt(16) + 8; - l1 = this.j.nextInt(this.j.nextInt(120) + 8); - i2 = l + this.j.nextInt(16) + 8; - if (l1 < 64 || this.j.nextInt(10) == 0) { - (new WorldGenLakes(Block.STATIONARY_LAVA.id)).a(this.p, this.j, k1, l1, i2); - } - } - - int j2; - - for (k1 = 0; k1 < 8; ++k1) { - l1 = k + this.j.nextInt(16) + 8; - i2 = this.j.nextInt(128); - j2 = l + this.j.nextInt(16) + 8; - (new WorldGenDungeons()).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 10; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(128); - j2 = l + this.j.nextInt(16); - (new WorldGenClay(32)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 20; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(128); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.DIRT.id, 32)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 10; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(128); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.GRAVEL.id, 32)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 20; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(128); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.COAL_ORE.id, 16)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 20; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(64); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.IRON_ORE.id, 8)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 2; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(32); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.GOLD_ORE.id, 8)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 8; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(16); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.REDSTONE_ORE.id, 7)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 1; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(16); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.DIAMOND_ORE.id, 7)).a(this.p, this.j, l1, i2, j2); - } - - for (k1 = 0; k1 < 1; ++k1) { - l1 = k + this.j.nextInt(16); - i2 = this.j.nextInt(16) + this.j.nextInt(16); - j2 = l + this.j.nextInt(16); - (new WorldGenMinable(Block.LAPIS_ORE.id, 6)).a(this.p, this.j, l1, i2, j2); - } - - d0 = 0.5D; - k1 = (int) ((this.c.a((double) k * d0, (double) l * d0) / 8.0D + this.j.nextDouble() * 4.0D + 4.0D) / 3.0D); - l1 = 0; - if (this.j.nextInt(10) == 0) { - ++l1; - } - - if (biomebase == BiomeBase.FOREST) { - l1 += k1 + 5; - } - - if (biomebase == BiomeBase.RAINFOREST) { - l1 += k1 + 5; - } - - if (biomebase == BiomeBase.SEASONAL_FOREST) { - l1 += k1 + 2; - } - - if (biomebase == BiomeBase.TAIGA) { - l1 += k1 + 5; - } - - if (biomebase == BiomeBase.DESERT) { - l1 -= 20; - } - - if (biomebase == BiomeBase.TUNDRA) { - l1 -= 20; - } - - if (biomebase == BiomeBase.PLAINS) { - l1 -= 20; - } - - int k2; - - for (i2 = 0; i2 < l1; ++i2) { - j2 = k + this.j.nextInt(16) + 8; - k2 = l + this.j.nextInt(16) + 8; - WorldGenerator worldgenerator = biomebase.a(this.j); - - worldgenerator.a(1.0D, 1.0D, 1.0D); - worldgenerator.a(this.p, this.j, j2, this.p.d(j2, k2), k2); - } - - int l2; - - for (i2 = 0; i2 < 2; ++i2) { - j2 = k + this.j.nextInt(16) + 8; - k2 = this.j.nextInt(128); - l2 = l + this.j.nextInt(16) + 8; - (new WorldGenFlowers(Block.YELLOW_FLOWER.id)).a(this.p, this.j, j2, k2, l2); - } - - if (this.j.nextInt(2) == 0) { - i2 = k + this.j.nextInt(16) + 8; - j2 = this.j.nextInt(128); - k2 = l + this.j.nextInt(16) + 8; - (new WorldGenFlowers(Block.RED_ROSE.id)).a(this.p, this.j, i2, j2, k2); - } - - if (this.j.nextInt(4) == 0) { - i2 = k + this.j.nextInt(16) + 8; - j2 = this.j.nextInt(128); - k2 = l + this.j.nextInt(16) + 8; - (new WorldGenFlowers(Block.BROWN_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2); - } - - if (this.j.nextInt(8) == 0) { - i2 = k + this.j.nextInt(16) + 8; - j2 = this.j.nextInt(128); - k2 = l + this.j.nextInt(16) + 8; - (new WorldGenFlowers(Block.RED_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2); - } - - for (i2 = 0; i2 < 10; ++i2) { - j2 = k + this.j.nextInt(16) + 8; - k2 = this.j.nextInt(128); - l2 = l + this.j.nextInt(16) + 8; - (new WorldGenReed()).a(this.p, this.j, j2, k2, l2); - } - - if (this.j.nextInt(32) == 0) { - i2 = k + this.j.nextInt(16) + 8; - j2 = this.j.nextInt(128); - k2 = l + this.j.nextInt(16) + 8; - (new WorldGenPumpkin()).a(this.p, this.j, i2, j2, k2); - } - - i2 = 0; - if (biomebase == BiomeBase.DESERT) { - i2 += 10; - } - - int i3; - - for (j2 = 0; j2 < i2; ++j2) { - k2 = k + this.j.nextInt(16) + 8; - l2 = this.j.nextInt(128); - i3 = l + this.j.nextInt(16) + 8; - (new WorldGenCactus()).a(this.p, this.j, k2, l2, i3); - } - - for (j2 = 0; j2 < 50; ++j2) { - k2 = k + this.j.nextInt(16) + 8; - l2 = this.j.nextInt(this.j.nextInt(120) + 8); - i3 = l + this.j.nextInt(16) + 8; - (new WorldGenLiquids(Block.WATER.id)).a(this.p, this.j, k2, l2, i3); - } - - for (j2 = 0; j2 < 20; ++j2) { - k2 = k + this.j.nextInt(16) + 8; - l2 = this.j.nextInt(this.j.nextInt(this.j.nextInt(112) + 8) + 8); - i3 = l + this.j.nextInt(16) + 8; - (new WorldGenLiquids(Block.LAVA.id)).a(this.p, this.j, k2, l2, i3); - } - - this.w = this.p.a().a(this.w, k + 8, l + 8, 16, 16); - - for (j2 = k + 8; j2 < k + 8 + 16; ++j2) { - for (k2 = l + 8; k2 < l + 8 + 16; ++k2) { - l2 = j2 - (k + 8); - i3 = k2 - (l + 8); - int j3 = this.p.e(j2, k2); - double d1 = this.w[l2 * 16 + i3] - (double) (j3 - 64) / 64.0D * 0.3D; - - if (d1 < 0.5D && j3 > 0 && j3 < 128 && this.p.isEmpty(j2, j3, k2) && this.p.getMaterial(j2, j3 - 1, k2).isSolid() && this.p.getMaterial(j2, j3 - 1, k2) != Material.ICE) { - this.p.e(j2, j3, k2, Block.SNOW.id); - } - } - } - - BlockSand.a = false; - } - - public boolean a(boolean flag, IProgressUpdate iprogressupdate) { - return true; - } - - public boolean a() { - return false; - } - - public boolean b() { - return true; - } -} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 5a6116d9a3..1153e688ce 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -38,8 +38,9 @@ public class ChunkProviderServer implements IChunkProvider { } public void c(int i, int j) { - int k = i * 16 + 8 - this.g.spawnX; - int l = j * 16 + 8 - this.g.spawnZ; + ChunkCoordinates chunkcoordinates = this.g.l(); + int k = i * 16 + 8 - chunkcoordinates.a; + int l = j * 16 + 8 - chunkcoordinates.c; short short1 = 128; if (k < -short1 || k > short1 || l < -short1 || l > short1) { @@ -105,7 +106,7 @@ public class ChunkProviderServer implements IChunkProvider { public Chunk b(int i, int j) { Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit - return chunk == null ? (this.g.x ? this.d(i, j) : this.b) : chunk; + return chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk; } public Chunk e(int i, int j) { // Craftbukkit - public @@ -116,7 +117,7 @@ public class ChunkProviderServer implements IChunkProvider { Chunk chunk = this.d.a(this.g, i, j); if (chunk != null) { - chunk.r = this.g.e; + chunk.r = this.g.k(); } return chunk; @@ -140,7 +141,7 @@ public class ChunkProviderServer implements IChunkProvider { public void b(Chunk chunk) { // Craftbukkit - public if (this.d != null) { try { - chunk.r = this.g.e; + chunk.r = this.g.k(); this.d.a(this.g, chunk); } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception ioexception.printStackTrace(); @@ -192,7 +193,7 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean a() { - if (!this.g.C) { + if (!this.g.w) { // CraftBukkit start Server server = g.getServer(); while (!this.a.isEmpty()) { @@ -223,6 +224,6 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean b() { - return !this.g.C; + return !this.g.w; } } diff --git a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java new file mode 100644 index 0000000000..cdccfa7b29 --- /dev/null +++ b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java @@ -0,0 +1,290 @@ +package net.minecraft.server; + +import java.util.Iterator; +import java.util.Set; +import java.util.logging.Logger; + +public class ConsoleCommandHandler { + + private static Logger a = Logger.getLogger("Minecraft"); + private MinecraftServer b; + + public ConsoleCommandHandler(MinecraftServer minecraftserver) { + this.b = minecraftserver; + } + + public void a(ServerCommand servercommand) { + String s = servercommand.a; + ICommandListener icommandlistener = servercommand.b; + String s1 = icommandlistener.c(); + WorldServer worldserver = b.worlds.get(0); // Craftbukkit + ServerConfigurationManager serverconfigurationmanager = this.b.f; + + if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) { + if (s.toLowerCase().startsWith("list")) { + icommandlistener.b("Connected players: " + serverconfigurationmanager.c()); + } else if (s.toLowerCase().startsWith("stop")) { + this.a(s1, "Stopping the server.."); + this.b.a(); + } else if (s.toLowerCase().startsWith("save-all")) { + this.a(s1, "Forcing save.."); + worldserver.a(true, (IProgressUpdate) null); + this.a(s1, "Save complete."); + } else if (s.toLowerCase().startsWith("save-off")) { + this.a(s1, "Disabling level saving.."); + worldserver.w = true; + } else if (s.toLowerCase().startsWith("save-on")) { + this.a(s1, "Enabling level saving.."); + worldserver.w = false; + } else { + String s2; + + if (s.toLowerCase().startsWith("op ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.e(s2); + this.a(s1, "Opping " + s2); + serverconfigurationmanager.a(s2, "\u00A7eYou are now op!"); + } else if (s.toLowerCase().startsWith("deop ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.f(s2); + serverconfigurationmanager.a(s2, "\u00A7eYou are no longer op!"); + this.a(s1, "De-opping " + s2); + } else if (s.toLowerCase().startsWith("ban-ip ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.c(s2); + this.a(s1, "Banning ip " + s2); + } else if (s.toLowerCase().startsWith("pardon-ip ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.d(s2); + this.a(s1, "Pardoning ip " + s2); + } else { + EntityPlayer entityplayer; + + if (s.toLowerCase().startsWith("ban ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.a(s2); + this.a(s1, "Banning " + s2); + entityplayer = serverconfigurationmanager.i(s2); + if (entityplayer != null) { + entityplayer.a.a("Banned by admin"); + } + } else if (s.toLowerCase().startsWith("pardon ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + serverconfigurationmanager.b(s2); + this.a(s1, "Pardoning " + s2); + } else { + int i; + + if (s.toLowerCase().startsWith("kick ")) { + s2 = s.substring(s.indexOf(" ")).trim(); + entityplayer = null; + + for (i = 0; i < serverconfigurationmanager.b.size(); ++i) { + EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.b.get(i); + + if (entityplayer1.name.equalsIgnoreCase(s2)) { + entityplayer = entityplayer1; + } + } + + if (entityplayer != null) { + entityplayer.a.a("Kicked by admin"); + this.a(s1, "Kicking " + entityplayer.name); + } else { + icommandlistener.b("Can\'t find user " + s2 + ". No kick."); + } + } else { + String[] astring; + EntityPlayer entityplayer2; + + if (s.toLowerCase().startsWith("tp ")) { + astring = s.split(" "); + if (astring.length == 3) { + entityplayer = serverconfigurationmanager.i(astring[1]); + entityplayer2 = serverconfigurationmanager.i(astring[2]); + if (entityplayer == null) { + icommandlistener.b("Can\'t find user " + astring[1] + ". No tp."); + } else if (entityplayer2 == null) { + icommandlistener.b("Can\'t find user " + astring[2] + ". No tp."); + } else { + entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch); + this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + "."); + } + } else { + icommandlistener.b("Syntax error, please provice a source and a target."); + } + } else { + String s3; + + if (s.toLowerCase().startsWith("give ")) { + astring = s.split(" "); + if (astring.length != 3 && astring.length != 4) { + return; + } + + s3 = astring[1]; + entityplayer2 = serverconfigurationmanager.i(s3); + if (entityplayer2 != null) { + try { + int j = Integer.parseInt(astring[2]); + + if (Item.byId[j] != null) { + this.a(s1, "Giving " + entityplayer2.name + " some " + j); + int k = 1; + + if (astring.length > 3) { + k = this.a(astring[3], 1); + } + + if (k < 1) { + k = 1; + } + + if (k > 64) { + k = 64; + } + + entityplayer2.b(new ItemStack(j, k, 0)); + } else { + icommandlistener.b("There\'s no item with id " + j); + } + } catch (NumberFormatException numberformatexception) { + icommandlistener.b("There\'s no item with id " + astring[2]); + } + } else { + icommandlistener.b("Can\'t find user " + s3); + } + } else if (s.toLowerCase().startsWith("time ")) { + astring = s.split(" "); + if (astring.length != 3) { + return; + } + + s3 = astring[1]; + + try { + i = Integer.parseInt(astring[2]); + if ("add".equalsIgnoreCase(s3)) { + worldserver.a(worldserver.k() + (long) i); + this.a(s1, "Added " + i + " to time"); + } else if ("set".equalsIgnoreCase(s3)) { + worldserver.a((long) i); + this.a(s1, "Set time to " + i); + } else { + icommandlistener.b("Unknown method, use either \"add\" or \"set\""); + } + } catch (NumberFormatException numberformatexception1) { + icommandlistener.b("Unable to convert time value, " + astring[2]); + } + } else if (s.toLowerCase().startsWith("say ")) { + s = s.substring(s.indexOf(" ")).trim(); + a.info("[" + s1 + "] " + s); + serverconfigurationmanager.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s))); + } else if (s.toLowerCase().startsWith("tell ")) { + astring = s.split(" "); + if (astring.length >= 3) { + s = s.substring(s.indexOf(" ")).trim(); + s = s.substring(s.indexOf(" ")).trim(); + a.info("[" + s1 + "->" + astring[1] + "] " + s); + s = "\u00A77" + s1 + " whispers " + s; + a.info(s); + if (!serverconfigurationmanager.a(astring[1], (Packet) (new Packet3Chat(s)))) { + icommandlistener.b("There\'s no player by that name online."); + } + } + } else if (s.toLowerCase().startsWith("whitelist ")) { + this.a(s1, s, icommandlistener); + } else { + a.info("Unknown console command. Type \"help\" for help."); + } + } + } + } + } + } + } else { + this.a(icommandlistener); + } + } + + private void a(String s, String s1, ICommandListener icommandlistener) { + String[] astring = s1.split(" "); + + if (astring.length >= 2) { + String s2 = astring[1].toLowerCase(); + + if ("on".equals(s2)) { + this.a(s, "Turned on white-listing"); + this.b.d.b("white-list", true); + } else if ("off".equals(s2)) { + this.a(s, "Turned off white-listing"); + this.b.d.b("white-list", false); + } else if ("list".equals(s2)) { + Set set = this.b.f.e(); + String s3 = ""; + + String s4; + + for (Iterator iterator = set.iterator(); iterator.hasNext(); s3 = s3 + s4 + " ") { + s4 = (String) iterator.next(); + } + + icommandlistener.b("White-listed players: " + s3); + } else { + String s5; + + if ("add".equals(s2) && astring.length == 3) { + s5 = astring[2].toLowerCase(); + this.b.f.k(s5); + this.a(s, "Added " + s5 + " to white-list"); + } else if ("remove".equals(s2) && astring.length == 3) { + s5 = astring[2].toLowerCase(); + this.b.f.l(s5); + this.a(s, "Removed " + s5 + " from white-list"); + } else if ("reload".equals(s2)) { + this.b.f.f(); + this.a(s, "Reloaded white-list from file"); + } + } + } + } + + private void a(ICommandListener icommandlistener) { + icommandlistener.b("To run the server without a gui, start it like this:"); + icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui"); + icommandlistener.b("Console commands:"); + icommandlistener.b(" help or ? shows this message"); + icommandlistener.b(" kick removes a player from the server"); + icommandlistener.b(" ban bans a player from the server"); + icommandlistener.b(" pardon pardons a banned player so that they can connect again"); + icommandlistener.b(" ban-ip bans an IP address from the server"); + icommandlistener.b(" pardon-ip pardons a banned IP address so that they can connect again"); + icommandlistener.b(" op turns a player into an op"); + icommandlistener.b(" deop removes op status from a player"); + icommandlistener.b(" tp moves one player to the same location as another player"); + icommandlistener.b(" give [num] gives a player a resource"); + icommandlistener.b(" tell sends a private message to a player"); + icommandlistener.b(" stop gracefully stops the server"); + icommandlistener.b(" save-all forces a server-wide level save"); + icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)"); + icommandlistener.b(" save-on re-enables terrain saving"); + icommandlistener.b(" list lists all currently connected players"); + icommandlistener.b(" say broadcasts a message to all players"); + icommandlistener.b(" time adds to or sets the world time (0-24000)"); + } + + private void a(String s, String s1) { + String s2 = s + ": " + s1; + + this.b.f.j("\u00A77(" + s2 + ")"); + a.info(s2); + } + + private int a(String s, int i) { + try { + return Integer.parseInt(s); + } catch (NumberFormatException numberformatexception) { + return i; + } + } +} diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 51e9876998..1ce82ac9e9 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -22,8 +22,8 @@ public abstract class Entity { private static int entityCount = 0; public int id; - public double h; - public boolean i; + public double aB; + public boolean aC; public Entity passenger; public Entity vehicle; public World world; @@ -42,81 +42,81 @@ public abstract class Entity { public float lastPitch; public final AxisAlignedBB boundingBox; public boolean onGround; - public boolean B; - public boolean C; - public boolean D; - public boolean E; - public boolean F; + public boolean aV; + public boolean aW; + public boolean aX; + public boolean aY; + public boolean aZ; public boolean dead; public float height; public float length; public float width; - public float K; - public float L; - protected boolean M; + public float be; + public float bf; + protected boolean bg; protected float fallDistance; private int b; - public double O; - public double P; - public double Q; - public float R; - public float S; - public boolean T; - public float U; - public boolean V; + public double bi; + public double bj; + public double bk; + public float bl; + public float bm; + public boolean bn; + public float bo; + public boolean bp; protected Random random; public int ticksLived; public int maxFireTicks; public int fireTicks; public int maxAirTicks; // Craftbukkit: Make public - protected boolean ab; + protected boolean bv; public int noDamageTicks; public int airTicks; private boolean justCreated; - protected boolean ae; + protected boolean by; protected DataWatcher datawatcher; private double d; private double e; - public boolean ag; + public boolean bA; public int chunkX; - public int ai; + public int bC; public int chunkZ; public Entity(World world) { this.id = entityCount++; - this.h = 1.0D; - this.i = false; + this.aB = 1.0D; + this.aC = false; this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.onGround = false; - this.D = false; - this.E = false; - this.F = true; + this.aX = false; + this.aY = false; + this.aZ = true; this.dead = false; this.height = 0.0F; this.length = 0.6F; this.width = 1.8F; - this.K = 0.0F; - this.L = 0.0F; - this.M = true; + this.be = 0.0F; + this.bf = 0.0F; + this.bg = true; this.fallDistance = 0.0F; this.b = 1; - this.R = 0.0F; - this.S = 0.0F; - this.T = false; - this.U = 0.0F; - this.V = false; + this.bl = 0.0F; + this.bm = 0.0F; + this.bn = false; + this.bo = 0.0F; + this.bp = false; this.random = new Random(); this.ticksLived = 0; this.maxFireTicks = 1; this.fireTicks = 0; this.maxAirTicks = 300; - this.ab = false; + this.bv = false; this.noDamageTicks = 0; this.airTicks = 300; this.justCreated = true; - this.ae = false; + this.by = false; this.datawatcher = new DataWatcher(); - this.ag = false; + this.bA = false; this.world = world; this.a(0.0D, 0.0D, 0.0D); this.datawatcher.a(0, Byte.valueOf((byte) 0)); @@ -125,7 +125,7 @@ public abstract class Entity { protected abstract void a(); - public DataWatcher p() { + public DataWatcher O() { return this.datawatcher; } @@ -137,7 +137,7 @@ public abstract class Entity { return this.id; } - public void q() { + public void C() { this.dead = true; } @@ -146,7 +146,7 @@ public abstract class Entity { this.width = f1; } - protected void b(float f, float f1) { + protected void c(float f, float f1) { this.yaw = f; this.pitch = f1; } @@ -158,27 +158,27 @@ public abstract class Entity { float f = this.length / 2.0F; float f1 = this.width; - this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.R, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.R + (double) f1, d2 + (double) f); + this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bl, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bl + (double) f1, d2 + (double) f); } - public void b_() { - this.r(); + public void f_() { + this.H(); } - public void r() { + public void H() { if (this.vehicle != null && this.vehicle.dead) { this.vehicle = null; } ++this.ticksLived; - this.K = this.L; + this.be = this.bf; this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; this.lastPitch = this.pitch; this.lastYaw = this.yaw; - if (this.v()) { - if (!this.ab && !this.justCreated) { + if (this.g_()) { + if (!this.bv && !this.justCreated) { float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; if (f > 1.0F) { @@ -206,16 +206,16 @@ public abstract class Entity { } this.fallDistance = 0.0F; - this.ab = true; + this.bv = true; this.fireTicks = 0; } else { - this.ab = false; + this.bv = false; } if (this.world.isStatic) { this.fireTicks = 0; } else if (this.fireTicks > 0) { - if (this.ae) { + if (this.by) { this.fireTicks -= 4; if (this.fireTicks < 0) { this.fireTicks = 0; @@ -246,12 +246,12 @@ public abstract class Entity { } } - if (this.x()) { - this.s(); + if (this.Q()) { + this.P(); } if (this.locY < -64.0D) { - this.t(); + this.M(); } if (!this.world.isStatic) { @@ -262,8 +262,8 @@ public abstract class Entity { this.justCreated = false; } - protected void s() { - if (!this.ae) { + protected void P() { + if (!this.by) { // CraftBukkit start // TODO: this event spams! if(this instanceof EntityLiving) { @@ -301,8 +301,8 @@ public abstract class Entity { } } - protected void t() { - this.q(); + protected void M() { + this.C(); } public boolean b(double d0, double d1, double d2) { @@ -313,10 +313,10 @@ public abstract class Entity { } public void c(double d0, double d1, double d2) { - if (this.T) { + if (this.bn) { this.boundingBox.d(d0, d1, d2); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; - this.locY = this.boundingBox.b + (double) this.height - (double) this.R; + this.locY = this.boundingBox.b + (double) this.height - (double) this.bl; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; } else { double d3 = this.locX; @@ -325,7 +325,7 @@ public abstract class Entity { double d6 = d1; double d7 = d2; AxisAlignedBB axisalignedbb = this.boundingBox.b(); - boolean flag = this.onGround && this.J(); + boolean flag = this.onGround && this.U(); if (flag) { double d8; @@ -358,7 +358,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.F && d6 != d1) { + if (!this.aZ && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -373,7 +373,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.F && d5 != d0) { + if (!this.aZ && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -384,7 +384,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.F && d7 != d2) { + if (!this.aZ && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -394,13 +394,13 @@ public abstract class Entity { double d10; int k; - if (this.S > 0.0F && flag1 && this.R < 0.05F && (d5 != d0 || d7 != d2)) { + if (this.bm > 0.0F && flag1 && this.bl < 0.05F && (d5 != d0 || d7 != d2)) { d9 = d0; d10 = d1; double d11 = d2; d0 = d5; - d1 = (double) this.S; + d1 = (double) this.bm; d2 = d7; AxisAlignedBB axisalignedbb1 = this.boundingBox.b(); @@ -412,7 +412,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.F && d6 != d1) { + if (!this.aZ && d6 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -423,7 +423,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.F && d5 != d0) { + if (!this.aZ && d5 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -434,7 +434,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.F && d7 != d2) { + if (!this.aZ && d7 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -446,17 +446,17 @@ public abstract class Entity { d2 = d11; this.boundingBox.b(axisalignedbb1); } else { - this.R = (float) ((double) this.R + 0.5D); + this.bl = (float) ((double) this.bl + 0.5D); } } this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; - this.locY = this.boundingBox.b + (double) this.height - (double) this.R; + this.locY = this.boundingBox.b + (double) this.height - (double) this.bl; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; - this.B = d5 != d0 || d7 != d2; - this.C = d6 != d1; + this.aV = d5 != d0 || d7 != d2; + this.aW = d6 != d1; this.onGround = d6 != d1 && d6 < 0.0D; - this.D = this.B || this.C; + this.aX = this.aV || this.aW; this.a(d1, this.onGround); if (d5 != d0) { this.motX = 0.0D; @@ -477,7 +477,7 @@ public abstract class Entity { int j1; // Craftbukkit start - if ((B) && (getBukkitEntity() instanceof Vehicle)) { + if ((this.bg) && (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)); @@ -493,17 +493,17 @@ public abstract class Entity { } VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block); - ((WorldServer)world).getServer().getPluginManager().callEvent(event); + ((WorldServer) world).getServer().getPluginManager().callEvent(event); } // Craftbukkit end - if (this.M && !flag) { - this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); + if (this.bg && !flag) { + this.bf = (float) ((double) this.bf + (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.L > (float) this.b && k > 0) { + if (this.bf > (float) this.b && k > 0) { ++this.b; StepSound stepsound = Block.byId[k].stepSound; @@ -539,11 +539,11 @@ public abstract class Entity { } } - this.R *= 0.4F; - boolean flag2 = this.v(); + this.bl *= 0.4F; + boolean flag2 = this.g_(); if (this.world.c(this.boundingBox)) { - this.b(1); + this.a(1); if (!flag2) { ++this.fireTicks; // CraftBukkit start @@ -586,14 +586,14 @@ public abstract class Entity { } } - public AxisAlignedBB u() { + public AxisAlignedBB d() { return null; } - protected void b(int i) { - if (!this.ae) { + protected void a(int i) { + if (!this.by) { // CraftBukkit start - if(this instanceof EntityLiving) { + if (this instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity damagee = this.getBukkitEntity(); DamageCause damageType = EntityDamageEvent.DamageCause.FIRE; @@ -614,12 +614,12 @@ public abstract class Entity { protected void a(float f) {} - public boolean v() { + public boolean g_() { return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D), Material.WATER, this); } public boolean a(Material material) { - double d0 = this.locY + (double) this.w(); + double d0 = this.locY + (double) this.p(); int i = MathHelper.b(this.locX); int j = MathHelper.d((float) MathHelper.b(d0)); int k = MathHelper.b(this.locZ); @@ -635,11 +635,11 @@ public abstract class Entity { } } - public float w() { + public float p() { return 0.0F; } - public boolean x() { + public boolean Q() { return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); } @@ -662,7 +662,7 @@ public abstract class Entity { } } - public float b(float f) { + public float c(float f) { int i = MathHelper.b(this.locX); double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D; int j = MathHelper.b(this.locY - (double) this.height + d0); @@ -677,7 +677,7 @@ public abstract class Entity { this.lastZ = this.locZ = d2; this.lastYaw = this.yaw = f; this.lastPitch = this.pitch = f1; - this.R = 0.0F; + this.bl = 0.0F; double d3 = (double) (this.lastYaw - f); if (d3 < -180.0D) { @@ -689,19 +689,19 @@ public abstract class Entity { } this.a(this.locX, this.locY, this.locZ); - this.b(f, f1); + this.c(f, f1); } public void c(double d0, double d1, double d2, float f, float f1) { - this.O = this.lastX = this.locX = d0; - this.P = this.lastY = this.locY = d1 + (double) this.height; - this.Q = this.lastZ = this.locZ = d2; + this.bi = this.lastX = this.locX = d0; + this.bj = this.lastY = this.locY = d1 + (double) this.height; + this.bk = this.lastZ = this.locZ = d2; this.yaw = f; this.pitch = f1; this.a(this.locX, this.locY, this.locZ); } - public float a(Entity entity) { + public float f(Entity entity) { float f = (float) (this.locX - entity.locX); float f1 = (float) (this.locY - entity.locY); float f2 = (float) (this.locZ - entity.locZ); @@ -725,7 +725,7 @@ public abstract class Entity { return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5); } - public double b(Entity entity) { + public double g(Entity entity) { double d0 = this.locX - entity.locX; double d1 = this.locY - entity.locY; double d2 = this.locZ - entity.locZ; @@ -735,7 +735,7 @@ public abstract class Entity { public void b(EntityHuman entityhuman) {} - public void c(Entity entity) { + public void h(Entity entity) { if (entity.passenger != this && entity.vehicle != this) { double d0 = entity.locX - this.locX; double d1 = entity.locZ - this.locZ; @@ -755,8 +755,8 @@ public abstract class Entity { d1 *= d3; d0 *= 0.05000000074505806D; d1 *= 0.05000000074505806D; - d0 *= (double) (1.0F - this.U); - d1 *= (double) (1.0F - this.U); + d0 *= (double) (1.0F - this.bo); + d1 *= (double) (1.0F - this.bo); this.f(-d0, 0.0D, -d1); entity.f(d0, 0.0D, d1); } @@ -769,27 +769,27 @@ public abstract class Entity { this.motZ += d2; } - protected void y() { - this.E = true; + protected void R() { + this.aY = true; } public boolean a(Entity entity, int i) { - this.y(); + this.R(); return false; } - public boolean c_() { + public boolean d_() { return false; } - public boolean z() { + public boolean e_() { return false; } - public void b(Entity entity, int i) {} + public void c(Entity entity, int i) {} public boolean c(NBTTagCompound nbttagcompound) { - String s = this.A(); + String s = this.S(); if (!this.dead && s != null) { nbttagcompound.a("id", s); @@ -808,35 +808,47 @@ public abstract class Entity { nbttagcompound.a("Fire", (short) this.fireTicks); nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("OnGround", this.onGround); - nbttagcompound.a("World", world.w); // Craftbukkit + nbttagcompound.a("World", world.q.j); // CraftBukkit this.a(nbttagcompound); } public void e(NBTTagCompound nbttagcompound) { - NBTTagList nbttaglist = nbttagcompound.k("Pos"); - NBTTagList nbttaglist1 = nbttagcompound.k("Motion"); - NBTTagList nbttaglist2 = nbttagcompound.k("Rotation"); + NBTTagList nbttaglist = nbttagcompound.l("Pos"); + NBTTagList nbttaglist1 = nbttagcompound.l("Motion"); + NBTTagList nbttaglist2 = nbttagcompound.l("Rotation"); this.a(0.0D, 0.0D, 0.0D); this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; - this.lastX = this.O = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; - this.lastY = this.P = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; - this.lastZ = this.Q = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; - this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; - this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; - this.fallDistance = nbttagcompound.f("FallDistance"); - this.fireTicks = nbttagcompound.c("Fire"); - this.airTicks = nbttagcompound.c("Air"); - this.onGround = nbttagcompound.l("OnGround"); + if (Math.abs(this.motX) > 10.0D) { + this.motX = 0.0D; + } + + if (Math.abs(this.motY) > 10.0D) { + this.motY = 0.0D; + } + + if (Math.abs(this.motZ) > 10.0D) { + this.motZ = 0.0D; + } + + this.lastX = this.bi = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; + this.lastY = this.bj = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; + this.lastZ = this.bk = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; + this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a % 6.2831855F; + this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a % 6.2831855F; + this.fallDistance = nbttagcompound.g("FallDistance"); + this.fireTicks = nbttagcompound.d("Fire"); + this.airTicks = nbttagcompound.d("Air"); + this.onGround = nbttagcompound.m("OnGround"); // Craftbukkit start - if (nbttagcompound.a("World")) { - String worldName = nbttagcompound.h("World"); - + if (nbttagcompound.b("World")) { + String worldName = nbttagcompound.i("World"); + for (WorldServer world : ((WorldServer)this.world).getServer().getServer().worlds) { - if (world.w.equals(worldName)) { + if (world.q.j.equals(worldName)) { this.world = world; break; } @@ -848,7 +860,7 @@ public abstract class Entity { this.b(nbttagcompound); } - protected final String A() { + protected final String S() { return EntityTypes.b(this); } @@ -884,7 +896,7 @@ public abstract class Entity { return nbttaglist; } - public EntityItem a(int i, int j) { + public EntityItem b(int i, int j) { return this.a(i, j, 0.0F); } @@ -900,13 +912,13 @@ public abstract class Entity { return entityitem; } - public boolean B() { + public boolean J() { return !this.dead; } - public boolean C() { + public boolean D() { int i = MathHelper.b(this.locX); - int j = MathHelper.b(this.locY + (double) this.w()); + int j = MathHelper.b(this.locY + (double) this.p()); int k = MathHelper.b(this.locZ); return this.world.d(i, j, k); @@ -916,19 +928,19 @@ public abstract class Entity { return false; } - public AxisAlignedBB d(Entity entity) { + public AxisAlignedBB a_(Entity entity) { return null; } - public void D() { + public void x() { if (this.vehicle.dead) { this.vehicle = null; } else { this.motX = 0.0D; this.motY = 0.0D; this.motZ = 0.0D; - this.b_(); - this.vehicle.E(); + this.f_(); + this.vehicle.h_(); this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw); for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) { @@ -974,11 +986,11 @@ public abstract class Entity { } } - public void E() { - this.passenger.a(this.locX, this.locY + this.k() + this.passenger.F(), this.locZ); + public void h_() { + this.passenger.a(this.locX, this.locY + this.k() + this.passenger.B(), this.locZ); } - public double F() { + public double B() { return (double) this.height; } @@ -986,7 +998,7 @@ public abstract class Entity { return (double) this.width * 0.75D; } - public void e(Entity entity) { + public void b(Entity entity) { // CraftBukkit start setPassengerOf(entity); } @@ -1001,7 +1013,7 @@ public abstract class Entity { } public void setPassengerOf(Entity entity) { - // e(null) doesn't really fly for overloaded methods, + // b(null) doesn't really fly for overloaded methods, // so this method is needed // CraftBukkit end @@ -1050,25 +1062,25 @@ public abstract class Entity { } } - public Vec3D G() { + public Vec3D N() { return null; } - public void H() {} + public void T() {} - public ItemStack[] I() { + public ItemStack[] k_() { return null; } - public boolean J() { - return this.c(1); + public boolean U() { + return this.d(1); } public void b(boolean flag) { this.a(1, flag); } - protected boolean c(int i) { + protected boolean d(int i) { return (this.datawatcher.a(0) & 1 << i) != 0; } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 368e7396fb..7820aa2b1a 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -15,11 +15,11 @@ public class EntityArrow extends Entity { private int d = -1; private int e = -1; private int f = 0; - private boolean ak = false; + private boolean g = false; public int a = 0; public EntityLiving b; - private int al; - private int am = 0; + private int h; + private int i = 0; public EntityArrow(World world) { super(world); @@ -37,7 +37,7 @@ public class EntityArrow extends Entity { super(world); this.b = entityliving; this.a(0.5F, 0.5F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), 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); @@ -70,11 +70,11 @@ public class EntityArrow extends Entity { this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); - this.al = 0; + this.h = 0; } - public void b_() { - super.b_(); + public void f_() { + super.f_(); if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) { float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); @@ -86,26 +86,26 @@ public class EntityArrow extends Entity { --this.a; } - if (this.ak) { + if (this.g) { int i = this.world.getTypeId(this.c, this.d, this.e); if (i == this.f) { - ++this.al; - if (this.al == 1200) { - this.q(); + ++this.h; + if (this.h == 1200) { + this.C(); } return; } - this.ak = false; + this.g = false; this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.al = 0; - this.am = 0; + this.h = 0; + this.i = 0; } else { - ++this.am; + ++this.i; } Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); @@ -127,7 +127,7 @@ public class EntityArrow extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.c_() && (entity1 != this.b || this.am >= 5)) { + if (entity1.d_() && (entity1 != this.b || this.i >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -180,14 +180,14 @@ 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.q(); + this.C(); } else { this.motX *= -0.10000000149011612D; this.motY *= -0.10000000149011612D; this.motZ *= -0.10000000149011612D; this.yaw += 180.0F; this.lastYaw += 180.0F; - this.am = 0; + this.i = 0; } } else { this.c = movingobjectposition.b; @@ -202,7 +202,7 @@ public class EntityArrow extends Entity { this.locY -= this.motY / (double) f2 * 0.05000000074505806D; this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D; this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); - this.ak = true; + this.g = true; this.a = 7; } } @@ -234,7 +234,7 @@ public class EntityArrow extends Entity { float f3 = 0.99F; f1 = 0.03F; - if (this.v()) { + if (this.g_()) { for (int k = 0; k < 4; ++k) { float f4 = 0.25F; @@ -257,24 +257,24 @@ public class EntityArrow extends Entity { nbttagcompound.a("zTile", (short) this.e); nbttagcompound.a("inTile", (byte) this.f); nbttagcompound.a("shake", (byte) this.a); - nbttagcompound.a("inGround", (byte) (this.ak ? 1 : 0)); + nbttagcompound.a("inGround", (byte) (this.g ? 1 : 0)); } public void b(NBTTagCompound nbttagcompound) { - this.c = nbttagcompound.c("xTile"); - this.d = nbttagcompound.c("yTile"); - this.e = nbttagcompound.c("zTile"); - this.f = nbttagcompound.b("inTile") & 255; - this.a = nbttagcompound.b("shake") & 255; - this.ak = nbttagcompound.b("inGround") == 1; + this.c = nbttagcompound.d("xTile"); + this.d = nbttagcompound.d("yTile"); + this.e = nbttagcompound.d("zTile"); + this.f = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.g = nbttagcompound.c("inGround") == 1; } public void b(EntityHuman entityhuman) { if (!this.world.isStatic) { - if (this.ak && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { + 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.c(this, 1); - this.q(); + entityhuman.b(this, 1); + this.C(); } } } diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 6aa0d3b976..c0412a0c10 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -24,13 +24,13 @@ public class EntityBoat extends Entity { private int d; private double e; private double f; - private double ak; - private double al; - private double am; + private double g; + private double h; + private double i; public double maxSpeed = 0.4D; // CraftBukkit // CraftBukkit start - public void c(Entity entity) { + public void h(Entity entity) { CraftServer server = ((WorldServer) this.world).getServer(); Type eventType = Type.VEHICLE_COLLISION_ENTITY; Vehicle vehicle = (Vehicle) this.getBukkitEntity(); @@ -43,7 +43,7 @@ public class EntityBoat extends Entity { return; } - super.c(entity); + super.h(entity); } // CraftBukkit end @@ -52,23 +52,23 @@ public class EntityBoat extends Entity { this.a = 0; this.b = 0; this.c = 1; - this.i = true; + this.aC = true; this.a(1.5F, 0.6F); this.height = this.width / 2.0F; - this.M = false; + this.bg = false; } protected void a() {} - public AxisAlignedBB d(Entity entity) { + public AxisAlignedBB a_(Entity entity) { return entity.boundingBox; } - public AxisAlignedBB u() { + public AxisAlignedBB d() { return this.boundingBox; } - public boolean z() { + public boolean e_() { return true; } @@ -114,7 +114,7 @@ public class EntityBoat extends Entity { this.c = -this.c; this.b = 10; this.a += i * 10; - this.y(); + this.R(); if (this.a > 40) { int j; @@ -126,7 +126,7 @@ public class EntityBoat extends Entity { this.a(Item.STICK.id, 1, 0.0F); } - this.q(); + this.C(); } return true; @@ -135,11 +135,11 @@ public class EntityBoat extends Entity { } } - public boolean c_() { + public boolean d_() { return !this.dead; } - public void b_() { + public void f_() { // CraftBukkit start double prevX = this.locX; double prevY = this.locY; @@ -148,7 +148,7 @@ public class EntityBoat extends Entity { float prevPitch = this.pitch; // CraftBukkit end - super.b_(); + super.f_(); if (this.b > 0) { --this.b; } @@ -182,9 +182,9 @@ public class EntityBoat extends Entity { if (this.d > 0) { d3 = this.locX + (this.e - this.locX) / (double) this.d; d4 = this.locY + (this.f - this.locY) / (double) this.d; - d5 = this.locZ + (this.ak - this.locZ) / (double) this.d; + d5 = this.locZ + (this.g - this.locZ) / (double) this.d; - for (d6 = this.al - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) { + for (d6 = this.h - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) { ; } @@ -193,10 +193,10 @@ public class EntityBoat extends Entity { } this.yaw = (float) ((double) this.yaw + d6 / (double) this.d); - this.pitch = (float) ((double) this.pitch + (this.am - (double) this.pitch) / (double) this.d); + this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d); --this.d; this.a(d3, d4, d5); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); } else { d3 = this.locX + this.motX; d4 = this.locY + this.motY; @@ -269,9 +269,9 @@ public class EntityBoat extends Entity { } } - if (this.B && d5 > 0.15D) { + if (this.aV && d5 > 0.15D) { if (!this.world.isStatic) { - this.q(); + this.C(); int k; @@ -317,7 +317,7 @@ public class EntityBoat extends Entity { } this.yaw = (float) ((double) this.yaw + d13); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); @@ -338,8 +338,8 @@ public class EntityBoat extends Entity { for (int l = 0; l < list.size(); ++l) { Entity entity = (Entity) list.get(l); - if (entity != this.passenger && entity.z() && entity instanceof EntityBoat) { - entity.c((Entity) this); + if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) { + entity.h(this); } } } @@ -350,12 +350,12 @@ public class EntityBoat extends Entity { } } - public void E() { + public void h_() { if (this.passenger != null) { double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; - this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.F(), this.locZ + d1); + this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.B(), this.locZ + d1); } } @@ -382,7 +382,7 @@ public class EntityBoat extends Entity { } // CraftBukkit end - entityhuman.e(this); + entityhuman.b((Entity) this); } return true; diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index a068372c55..f5fe8a978a 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -18,7 +18,7 @@ public class EntityCreature extends EntityLiving { super(world); } - protected void d() { + protected void c_() { this.e = false; float f = 16.0F; @@ -41,7 +41,7 @@ public class EntityCreature extends EntityLiving { if (this.d != null) { this.a = this.world.a(this, this.d, f); } - } else if (!this.d.B()) { + } else if (!this.d.J()) { // CraftBukkit start EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED); CraftServer server = ((WorldServer) this.world).getServer(); @@ -55,9 +55,9 @@ public class EntityCreature extends EntityLiving { } // CraftBukkit end } else { - float f1 = this.d.a((Entity) this); + float f1 = this.d.f(this); - if (this.i(this.d)) { + if (this.e(this.d)) { this.a(this.d, f1); } } @@ -92,8 +92,8 @@ public class EntityCreature extends EntityLiving { } int l1 = MathHelper.b(this.boundingBox.b); - boolean flag1 = this.v(); - boolean flag2 = this.x(); + boolean flag1 = this.g_(); + boolean flag2 = this.Q(); this.pitch = 0.0F; if (this.a != null && this.random.nextInt(100) != 0) { @@ -110,7 +110,7 @@ public class EntityCreature extends EntityLiving { } } - this.bA = false; + this.ax = false; if (vec3d != null) { double d1 = vec3d.a - this.locX; double d2 = vec3d.c - this.locZ; @@ -118,7 +118,7 @@ public class EntityCreature extends EntityLiving { float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; // Craftbukkit float f5 = f4 - this.yaw; - for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) { + for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) { ; } @@ -142,12 +142,12 @@ public class EntityCreature extends EntityLiving { this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F; - this.bx = -MathHelper.a(f5) * this.by * 1.0F; - this.by = MathHelper.b(f5) * this.by * 1.0F; + this.au = -MathHelper.a(f5) * this.av * 1.0F; + this.av = MathHelper.b(f5) * this.av * 1.0F; } if (d3 > 0.0D) { - this.bA = true; + this.ax = true; } } @@ -155,15 +155,15 @@ public class EntityCreature extends EntityLiving { this.b(this.d, 30.0F); } - if (this.B) { - this.bA = true; + if (this.aV) { + this.ax = true; } if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) { - this.bA = true; + this.ax = true; } } else { - super.d(); + super.c_(); this.a = null; } } diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index c7f25b0935..d17d4e5681 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -29,10 +29,10 @@ public class EntityCreeper extends EntityMonster { super.b(nbttagcompound); } - public void b_() { + public void f_() { this.b = this.a; if (this.world.isStatic) { - int i = this.K(); + int i = this.r(); if (i > 0 && this.a == 0) { this.world.a(this, "random.fuse", 1.0F, 0.5F); @@ -48,7 +48,7 @@ public class EntityCreeper extends EntityMonster { } } - super.b_(); + super.f_(); } protected String f() { @@ -59,18 +59,18 @@ public class EntityCreeper extends EntityMonster { return "mob.creeperdeath"; } - public void f(Entity entity) { - super.f(entity); + public void a(Entity entity) { + super.a(entity); if (entity instanceof EntitySkeleton) { - this.a(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); + this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); } } protected void a(Entity entity, float f) { - int i = this.K(); + int i = this.r(); if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { - this.a(-1); + this.e(-1); --this.a; if (this.a < 0) { this.a = 0; @@ -80,7 +80,7 @@ public class EntityCreeper extends EntityMonster { this.world.a(this, "random.fuse", 1.0F, 0.5F); } - this.a(1); + this.e(1); ++this.a; if (this.a >= 30) { // Craftbukkit start @@ -90,7 +90,7 @@ public class EntityCreeper extends EntityMonster { server.getPluginManager().callEvent(event); if(!event.isCancelled()) { this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); - this.q(); + this.C(); } else { this.a = 0; } @@ -105,11 +105,11 @@ public class EntityCreeper extends EntityMonster { return Item.SULPHUR.id; } - private int K() { + private int r() { return this.datawatcher.a(16); } - private void a(int i) { + private void e(int i) { this.datawatcher.b(16, Byte.valueOf((byte) i)); } } diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 9a0467fa7a..6204c9cb8f 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -22,9 +22,9 @@ public class EntityEgg extends Entity { private int e = 0; private boolean f = false; public int a = 0; - private EntityLiving ak; - private int al; - private int am = 0; + private EntityLiving g; + private int h; + private int i = 0; public EntityEgg(World world) { super(world); @@ -35,9 +35,9 @@ public class EntityEgg extends Entity { public EntityEgg(World world, EntityLiving entityliving) { super(world); - this.ak = entityliving; + this.g = entityliving; this.a(0.25F, 0.25F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), 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.al = 0; + this.h = 0; this.a(0.25F, 0.25F); this.a(d0, d1, d2); this.height = 0.0F; @@ -78,14 +78,14 @@ public class EntityEgg extends Entity { this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); - this.al = 0; + this.h = 0; } - public void b_() { - this.O = this.locX; - this.P = this.locY; - this.Q = this.locZ; - super.b_(); + public void f_() { + this.bi = this.locX; + this.bj = this.locY; + this.bk = this.locZ; + super.f_(); if (this.a > 0) { --this.a; } @@ -94,9 +94,9 @@ public class EntityEgg extends Entity { int i = this.world.getTypeId(this.b, this.c, this.d); if (i == this.e) { - ++this.al; - if (this.al == 1200) { - this.q(); + ++this.h; + if (this.h == 1200) { + this.C(); } return; @@ -106,10 +106,10 @@ public class EntityEgg extends Entity { this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.al = 0; - this.am = 0; + this.h = 0; + this.i = 0; } else { - ++this.am; + ++this.i; } Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); @@ -130,7 +130,7 @@ public class EntityEgg extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) { + if (entity1.d_() && (entity1 != this.g || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -157,7 +157,7 @@ public class EntityEgg extends Entity { boolean stick; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); - org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity(); + org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity(); DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; @@ -169,13 +169,13 @@ public class EntityEgg extends Entity { if(!event.isCancelled()) { // this function returns if the egg should stick or not, i.e. !bounce - stick = movingobjectposition.g.a(this.ak, event.getDamage()); + stick = movingobjectposition.g.a(this.g, event.getDamage()); } else { // event was cancelled, get if the egg should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.ak, 0); + stick = movingobjectposition.g.a(this.g, 0); } if (stick) { @@ -190,10 +190,10 @@ public class EntityEgg extends Entity { } MobType hatchingType = MobType.CHICKEN; - if (this.ak instanceof EntityPlayer) { + if (this.g instanceof EntityPlayer) { CraftServer server = ((WorldServer) this.world).getServer(); Type eventType = Type.PLAYER_EGG_THROW; - Player player = (this.ak == null) ? null : (Player) this.ak.getBukkitEntity(); + Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity(); PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType); server.getPluginManager().callEvent(event); @@ -246,7 +246,7 @@ public class EntityEgg extends Entity { // The world we're spawning in accepts this creature boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal; - if ((isAnimal && this.world.L) || (!isAnimal && this.world.K)) { + if ((isAnimal && this.world.E) || (!isAnimal && this.world.D)) { entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F); this.world.a(entity); } @@ -258,7 +258,7 @@ public class EntityEgg extends Entity { this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); } - this.q(); + this.C(); } this.locX += this.motX; @@ -289,7 +289,7 @@ public class EntityEgg extends Entity { float f2 = 0.99F; float f3 = 0.03F; - if (this.v()) { + if (this.g_()) { for (int i1 = 0; i1 < 4; ++i1) { float f4 = 0.25F; @@ -316,19 +316,19 @@ public class EntityEgg extends Entity { } public void b(NBTTagCompound nbttagcompound) { - this.b = nbttagcompound.c("xTile"); - this.c = nbttagcompound.c("yTile"); - this.d = nbttagcompound.c("zTile"); - this.e = nbttagcompound.b("inTile") & 255; - this.a = nbttagcompound.b("shake") & 255; - this.f = nbttagcompound.b("inGround") == 1; + this.b = nbttagcompound.d("xTile"); + this.c = nbttagcompound.d("yTile"); + this.d = nbttagcompound.d("zTile"); + this.e = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.f = nbttagcompound.c("inGround") == 1; } public void b(EntityHuman entityhuman) { - if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { + 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.c(this, 1); - this.q(); + entityhuman.b(this, 1); + this.C(); } } } diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index d822bb5035..3560896606 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -15,13 +15,13 @@ public class EntityFireball extends Entity { private int e = -1; private int f = -1; - private int ak = -1; - private int al = 0; - private boolean am = false; + private int g = -1; + private int h = 0; + private boolean i = false; public int a = 0; - private EntityLiving an; - private int ao; - private int ap = 0; + private EntityLiving j; + private int k; + private int l = 0; public double b; public double c; public double d; @@ -35,7 +35,7 @@ public class EntityFireball extends Entity { public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { super(world); - this.an = entityliving; + this.j = entityliving; this.a(1.0F, 1.0F); this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); this.a(this.locX, this.locY, this.locZ); @@ -51,33 +51,33 @@ public class EntityFireball extends Entity { this.d = d2 / d3 * 0.1D; } - public void b_() { - super.b_(); + public void f_() { + super.f_(); this.fireTicks = 10; if (this.a > 0) { --this.a; } - if (this.am) { - int i = this.world.getTypeId(this.e, this.f, this.ak); + if (this.i) { + int i = this.world.getTypeId(this.e, this.f, this.g); - if (i == this.al) { - ++this.ao; - if (this.ao == 1200) { - this.q(); + if (i == this.h) { + ++this.k; + if (this.k == 1200) { + this.C(); } return; } - this.am = false; + this.i = false; this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.ao = 0; - this.ap = 0; + this.k = 0; + this.l = 0; } else { - ++this.ap; + ++this.l; } Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); @@ -97,7 +97,7 @@ public class EntityFireball extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.c_() && (entity1 != this.an || this.ap >= 25)) { + if (entity1.d_() && (entity1 != this.j || this.l >= 25)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -123,7 +123,7 @@ public class EntityFireball extends Entity { boolean stick; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); - org.bukkit.entity.Entity shooter = (this.an == null) ? null : this.an.getBukkitEntity(); + org.bukkit.entity.Entity shooter = (this.j == null) ? null : this.j.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity(); DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; @@ -135,27 +135,27 @@ public class EntityFireball extends Entity { if(!event.isCancelled()) { // this function returns if the fireball should stick or not, i.e. !bounce - stick = movingobjectposition.g.a(this.an, event.getDamage()); + stick = movingobjectposition.g.a(this.j, event.getDamage()); } else { // event was cancelled, get if the fireball should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.an, 0); + stick = movingobjectposition.g.a(this.j, 0); } if (stick) { // CraftBukkit end ; } } - + CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false); server.getPluginManager().callEvent(event); if(!event.isCancelled()) { this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); - this.q(); + this.C(); } // Craftbukkit end } @@ -187,7 +187,7 @@ public class EntityFireball extends Entity { this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; float f2 = 0.95F; - if (this.v()) { + if (this.g_()) { for (int k = 0; k < 4; ++k) { float f3 = 0.25F; @@ -210,29 +210,29 @@ public class EntityFireball extends Entity { public void a(NBTTagCompound nbttagcompound) { nbttagcompound.a("xTile", (short) this.e); nbttagcompound.a("yTile", (short) this.f); - nbttagcompound.a("zTile", (short) this.ak); - nbttagcompound.a("inTile", (byte) this.al); + nbttagcompound.a("zTile", (short) this.g); + nbttagcompound.a("inTile", (byte) this.h); nbttagcompound.a("shake", (byte) this.a); - nbttagcompound.a("inGround", (byte) (this.am ? 1 : 0)); + nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0)); } public void b(NBTTagCompound nbttagcompound) { - this.e = nbttagcompound.c("xTile"); - this.f = nbttagcompound.c("yTile"); - this.ak = nbttagcompound.c("zTile"); - this.al = nbttagcompound.b("inTile") & 255; - this.a = nbttagcompound.b("shake") & 255; - this.am = nbttagcompound.b("inGround") == 1; + this.e = nbttagcompound.d("xTile"); + this.f = nbttagcompound.d("yTile"); + this.g = nbttagcompound.d("zTile"); + this.h = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.i = nbttagcompound.c("inGround") == 1; } - public boolean c_() { + public boolean d_() { return true; } public boolean a(Entity entity, int i) { - this.y(); + this.R(); if (entity != null) { - Vec3D vec3d = entity.G(); + Vec3D vec3d = entity.N(); 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 d69e50ed6b..82153e35e9 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -14,20 +14,20 @@ public class EntityFish extends Entity { private int d = -1; private int e = -1; private int f = -1; - private int ak = 0; - private boolean al = false; + private int g = 0; + private boolean h = false; public int a = 0; public EntityHuman b; - private int am; - private int an = 0; - private int ao = 0; + private int i; + private int j = 0; + private int k = 0; public Entity c = null; - private int ap; - private double aq; - private double ar; - private double as; - private double at; - private double au; + private int l; + private double m; + private double n; + private double o; + private double p; + private double q; public EntityFish(World world) { super(world); @@ -74,19 +74,19 @@ public class EntityFish extends Entity { this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); - this.am = 0; + this.i = 0; } - public void b_() { - super.b_(); - if (this.ap > 0) { - double d0 = this.locX + (this.aq - this.locX) / (double) this.ap; - double d1 = this.locY + (this.ar - this.locY) / (double) this.ap; - double d2 = this.locZ + (this.as - this.locZ) / (double) this.ap; + public void f_() { + super.f_(); + if (this.l > 0) { + double d0 = this.locX + (this.m - this.locX) / (double) this.l; + double d1 = this.locY + (this.n - this.locY) / (double) this.l; + double d2 = this.locZ + (this.o - this.locZ) / (double) this.l; double d3; - for (d3 = this.at - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { + for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { ; } @@ -94,18 +94,17 @@ public class EntityFish extends Entity { d3 -= 360.0D; } - this.yaw = (float) ((double) this.yaw + d3 / (double) this.ap); - this.pitch = (float) ((double) this.pitch + (this.au - (double) this.pitch) / (double) this.ap); - --this.ap; + this.yaw = (float) ((double) this.yaw + d3 / (double) this.l); + this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l); + --this.l; this.a(d0, d1, d2); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); } else { if (!this.world.isStatic) { - ItemStack itemstack = this.b.P(); + ItemStack itemstack = this.b.z(); - // CraftBukkit - cast this.b to Entity - if (this.b.dead || !this.b.B() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.b((Entity) this.b) > 1024.0D) { - this.q(); + if (this.b.dead || !this.b.J() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) { + this.C(); this.b.hookedFish = null; return; } @@ -126,26 +125,26 @@ public class EntityFish extends Entity { --this.a; } - if (this.al) { + if (this.h) { int i = this.world.getTypeId(this.d, this.e, this.f); - if (i == this.ak) { - ++this.am; - if (this.am == 1200) { - this.q(); + if (i == this.g) { + ++this.i; + if (this.i == 1200) { + this.C(); } return; } - this.al = false; + this.h = false; this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.am = 0; - this.an = 0; + this.i = 0; + this.j = 0; } else { - ++this.an; + ++this.j; } Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); @@ -167,7 +166,7 @@ public class EntityFish extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.c_() && (entity1 != this.b || this.an >= 5)) { + if (entity1.d_() && (entity1 != this.b || this.j >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -214,15 +213,15 @@ public class EntityFish extends Entity { stick = movingobjectposition.g.a(this.b, 0); } if (!stick) { - c = movingobjectposition.g; + this.c = movingobjectposition.g; } // CraftBukkit end } else { - this.al = true; + this.h = true; } } - if (!this.al) { + if (!this.h) { this.c(this.motX, this.motY, this.motZ); float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); @@ -248,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.B) { + if (this.onGround || this.aV) { f2 = 0.5F; } @@ -266,10 +265,10 @@ public class EntityFish extends Entity { } if (d6 > 0.0D) { - if (this.ao > 0) { - --this.ao; + if (this.k > 0) { + --this.k; } else if (this.random.nextInt(500) == 0) { - this.ao = this.random.nextInt(30) + 10; + this.k = this.random.nextInt(30) + 10; this.motY -= 0.20000000298023224D; this.world.a(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); float f3 = (float) MathHelper.b(this.boundingBox.b); @@ -292,7 +291,7 @@ public class EntityFish extends Entity { } } - if (this.ao > 0) { + if (this.k > 0) { this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D; } @@ -315,21 +314,21 @@ public class EntityFish extends Entity { nbttagcompound.a("xTile", (short) this.d); nbttagcompound.a("yTile", (short) this.e); nbttagcompound.a("zTile", (short) this.f); - nbttagcompound.a("inTile", (byte) this.ak); + nbttagcompound.a("inTile", (byte) this.g); nbttagcompound.a("shake", (byte) this.a); - nbttagcompound.a("inGround", (byte) (this.al ? 1 : 0)); + nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); } public void b(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.c("xTile"); - this.e = nbttagcompound.c("yTile"); - this.f = nbttagcompound.c("zTile"); - this.ak = nbttagcompound.b("inTile") & 255; - this.a = nbttagcompound.b("shake") & 255; - this.al = nbttagcompound.b("inGround") == 1; + this.d = nbttagcompound.d("xTile"); + this.e = nbttagcompound.d("yTile"); + this.f = nbttagcompound.d("zTile"); + this.g = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.h = nbttagcompound.c("inGround") == 1; } - public int d() { + public int h() { byte b0 = 0; if (this.c != null) { @@ -343,7 +342,7 @@ public class EntityFish extends Entity { this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D; this.c.motZ += d2 * d4; b0 = 3; - } else if (this.ao > 0) { + } else if (this.k > 0) { EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH)); double d5 = this.b.locX - this.locX; double d6 = this.b.locY - this.locY; @@ -358,11 +357,11 @@ public class EntityFish extends Entity { b0 = 1; } - if (this.al) { + if (this.h) { b0 = 2; } - this.q(); + this.C(); 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 c48157359b..053f8542fb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -18,21 +18,26 @@ public abstract class EntityHuman extends EntityLiving { public InventoryPlayer inventory = new InventoryPlayer(this); public Container defaultContainer; public Container activeContainer; - public byte aq = 0; - public int ar = 0; - public float as; - public float at; - public boolean au = false; - public int av = 0; + public byte l = 0; + public int m = 0; + public float n; + public float o; + public boolean p = false; + public int q = 0; public String name; public int dimension; - public double ay; - public double az; - public double aA; - public double aB; - public double aC; - public double aD; - private int a = 0; + public double t; + public double u; + public double v; + public double w; + public double x; + public double y; + private boolean sleeping; + private ChunkCoordinates b; + private int sleepTicks; + public float z; + public float A; + private int d = 0; public EntityFish hookedFish = null; public EntityHuman(World world) { @@ -40,92 +45,121 @@ public abstract class EntityHuman extends EntityLiving { this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic); this.activeContainer = this.defaultContainer; this.height = 1.62F; - this.c((double) world.spawnX + 0.5D, (double) (world.spawnY + 1), (double) world.spawnZ + 0.5D, 0.0F, 0.0F); + ChunkCoordinates chunkcoordinates = world.l(); + + this.c((double) chunkcoordinates.a + 0.5D, (double) (chunkcoordinates.b + 1), (double) chunkcoordinates.c + 0.5D, 0.0F, 0.0F); this.health = 20; - this.aS = "humanoid"; - this.aR = 180.0F; + this.P = "humanoid"; + this.O = 180.0F; this.maxFireTicks = 20; this.texture = "/mob/char.png"; } - public void b_() { - super.b_(); + protected void a() { + super.a(); + this.datawatcher.a(16, Byte.valueOf((byte) 0)); + } + + public void f_() { + if (this.E()) { + ++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); + } + } else if (this.sleepTicks > 0) { + ++this.sleepTicks; + if (this.sleepTicks >= 110) { + this.sleepTicks = 0; + } + } + + super.f_(); if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) { - this.L(); + this.t(); this.activeContainer = this.defaultContainer; } - this.ay = this.aB; - this.az = this.aC; - this.aA = this.aD; - double d0 = this.locX - this.aB; - double d1 = this.locY - this.aC; - double d2 = this.locZ - this.aD; + this.t = this.w; + this.u = this.x; + this.v = this.y; + double d0 = this.locX - this.w; + double d1 = this.locY - this.x; + double d2 = this.locZ - this.y; double d3 = 10.0D; if (d0 > d3) { - this.ay = this.aB = this.locX; + this.t = this.w = this.locX; } if (d2 > d3) { - this.aA = this.aD = this.locZ; + this.v = this.y = this.locZ; } if (d1 > d3) { - this.az = this.aC = this.locY; + this.u = this.x = this.locY; } if (d0 < -d3) { - this.ay = this.aB = this.locX; + this.t = this.w = this.locX; } if (d2 < -d3) { - this.aA = this.aD = this.locZ; + this.v = this.y = this.locZ; } if (d1 < -d3) { - this.az = this.aC = this.locY; + this.u = this.x = this.locY; } - this.aB += d0 * 0.25D; - this.aD += d2 * 0.25D; - this.aC += d1 * 0.25D; + this.w += d0 * 0.25D; + this.y += d2 * 0.25D; + this.x += d1 * 0.25D; } - protected void L() { + protected boolean w() { + return this.health <= 0 || this.E(); + } + + protected void t() { this.activeContainer = this.defaultContainer; } - public void D() { - super.D(); - this.as = this.at; - this.at = 0.0F; + public void x() { + super.x(); + this.n = this.o; + this.o = 0.0F; } - protected void d() { - if (this.au) { - ++this.av; - if (this.av == 8) { - this.av = 0; - this.au = false; + protected void c_() { + if (this.p) { + ++this.q; + if (this.q == 8) { + this.q = 0; + this.p = false; } } else { - this.av = 0; + this.q = 0; } - this.aY = (float) this.av / 8.0F; + this.V = (float) this.q / 8.0F; } - public void o() { - if (this.world.k == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { - this.d(1); + public void q() { + if (this.world.j == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { + this.b(1); } - this.inventory.f(); - this.as = this.at; - super.o(); + this.inventory.e(); + this.n = this.o; + super.q(); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); - float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; + float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; // CraftBukkit if (f > 0.1F) { f = 0.1F; @@ -139,8 +173,8 @@ public abstract class EntityHuman extends EntityLiving { f1 = 0.0F; } - this.at += (f - this.at) * 0.4F; - this.bh += (f1 - this.bh) * 0.8F; + this.o += (f - this.o) * 0.4F; + this.ae += (f1 - this.ae) * 0.8F; if (this.health > 0) { List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D)); @@ -149,19 +183,19 @@ public abstract class EntityHuman extends EntityLiving { Entity entity = (Entity) list.get(i); if (!entity.dead) { - this.j(entity); + this.i(entity); } } } } } - private void j(Entity entity) { + private void i(Entity entity) { entity.b(this); } - public void f(Entity entity) { - super.f(entity); + public void a(Entity entity) { + super.a(entity); this.a(0.2F, 0.2F); this.a(this.locX, this.locY, this.locZ); this.motY = 0.10000000149011612D; @@ -169,10 +203,10 @@ public abstract class EntityHuman extends EntityLiving { this.a(new ItemStack(Item.APPLE, 1), true); } - this.inventory.h(); + this.inventory.g(); if (entity != null) { - this.motX = (double) (-MathHelper.b((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F); - this.motZ = (double) (-MathHelper.a((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F); + 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); } else { this.motX = this.motZ = 0.0D; } @@ -180,12 +214,12 @@ public abstract class EntityHuman extends EntityLiving { this.height = 0.1F; } - public void b(Entity entity, int i) { - this.ar += i; + public void c(Entity entity, int i) { + this.m += i; } - public void O() { - this.a(this.inventory.b(this.inventory.c, 1), false); + public void y() { + this.a(this.inventory.a(this.inventory.c, 1), false); } public void b(ItemStack itemstack) { @@ -194,7 +228,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.w(), this.locZ, itemstack); + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.p(), this.locZ, itemstack); entityitem.c = 40; float f = 0.1F; @@ -264,43 +298,59 @@ public abstract class EntityHuman extends EntityLiving { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.k("Inventory"); + NBTTagList nbttaglist = nbttagcompound.l("Inventory"); this.inventory.b(nbttaglist); - this.dimension = nbttagcompound.d("Dimension"); + this.dimension = nbttagcompound.e("Dimension"); + this.sleeping = nbttagcompound.m("Sleeping"); + 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); + } } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList())); nbttagcompound.a("Dimension", this.dimension); + nbttagcompound.a("Sleeping", this.sleeping); + nbttagcompound.a("SleepTimer", (short) this.sleepTicks); } public void a(IInventory iinventory) {} - public void a(int i, int j, int k) {} + public void b(int i, int j, int k) {} - public void c(Entity entity, int i) {} + public void b(Entity entity, int i) {} - public float w() { + public float p() { return 0.12F; } + protected void l_() { + this.height = 1.62F; + } + public boolean a(Entity entity, int i) { - this.bw = 0; + this.at = 0; if (this.health <= 0) { return false; } else { + if (this.E()) { + this.a(true, true); + } + if (entity instanceof EntityMonster || entity instanceof EntityArrow) { - if (this.world.k == 0) { + if (this.world.j == 0) { i = 0; } - if (this.world.k == 1) { + if (this.world.j == 1) { i = i / 3 + 1; } - if (this.world.k == 3) { + if (this.world.j == 3) { i = i * 3 / 2; } } @@ -309,14 +359,14 @@ public abstract class EntityHuman extends EntityLiving { } } - protected void e(int i) { - int j = 25 - this.inventory.g(); - int k = i * j + this.a; + protected void c(int i) { + int j = 25 - this.inventory.f(); + int k = i * j + this.d; this.inventory.c(i); i = k / 25; - this.a = k % 25; - super.e(i); + this.d = k % 25; + super.c(i); } public void a(TileEntityFurnace tileentityfurnace) {} @@ -325,43 +375,43 @@ public abstract class EntityHuman extends EntityLiving { public void a(TileEntitySign tileentitysign) {} - public void g(Entity entity) { + public void c(Entity entity) { if (!entity.a(this)) { - ItemStack itemstack = this.P(); + ItemStack itemstack = this.z(); if (itemstack != null && entity instanceof EntityLiving) { itemstack.b((EntityLiving) entity); if (itemstack.count <= 0) { itemstack.a(this); - this.Q(); + this.A(); } } } } - public ItemStack P() { - return this.inventory.e(); + public ItemStack z() { + return this.inventory.b(); } - public void Q() { + public void A() { this.inventory.a(this.inventory.c, (ItemStack) null); } - public double F() { + public double B() { return (double) (this.height - 0.5F); } - public void K() { - this.av = -1; - this.au = true; + public void r() { + this.q = -1; + this.p = true; } - public void h(Entity entity) { + public void d(Entity entity) { int i = this.inventory.a(entity); if (i > 0) { // CraftBukkit start - if(entity instanceof EntityLiving) { + if (entity instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity damager = this.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); @@ -381,13 +431,13 @@ public abstract class EntityHuman extends EntityLiving { } // CraftBukkit end - ItemStack itemstack = this.P(); + ItemStack itemstack = this.z(); if (itemstack != null && entity instanceof EntityLiving) { itemstack.a((EntityLiving) entity); if (itemstack.count <= 0) { itemstack.a(this); - this.Q(); + this.A(); } } } @@ -395,11 +445,129 @@ public abstract class EntityHuman extends EntityLiving { public void a(ItemStack itemstack) {} - public void q() { - super.q(); + public void C() { + super.C(); this.defaultContainer.a(this); if (this.activeContainer != null) { this.activeContainer.a(this); } } + + public boolean D() { + return !this.sleeping && super.D(); + } + + public boolean a(int i, int j, int k) { + if (!this.E() && this.J()) { + if (this.world.m.c) { + return false; + } else if (this.world.c()) { + return false; + } 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.height = 0.2F; + if (this.world.f(i, j, k)) { + int l = this.world.getData(i, j, k); + int i1 = BlockBed.c(l); + float f = 0.5F; + float f1 = 0.5F; + + switch (i1) { + case 0: + f1 = 0.9F; + break; + + case 1: + f = 0.1F; + break; + + case 2: + f1 = 0.1F; + break; + + case 3: + f = 0.9F; + } + + this.e(i1); + this.a((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1)); + } else { + this.a((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F)); + } + + this.sleeping = true; + this.sleepTicks = 0; + this.b = new ChunkCoordinates(i, j, k); + this.motX = this.motZ = this.motY = 0.0D; + if (!this.world.isStatic) { + this.world.o(); + } + + return true; + } else { + return false; + } + } else { + return false; + } + } + + private void e(int i) { + this.z = 0.0F; + this.A = 0.0F; + switch (i) { + case 0: + this.A = -1.8F; + break; + + case 1: + this.z = 1.8F; + break; + + case 2: + this.A = 1.8F; + break; + + case 3: + this.z = -1.8F; + } + } + + public void a(boolean flag, boolean flag1) { + this.a(0.6F, 1.8F); + this.l_(); + ChunkCoordinates chunkcoordinates = 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); + + 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(); + } + + if (flag) { + this.sleepTicks = 0; + } else { + this.sleepTicks = 100; + } + } + + private boolean l() { + return this.world.getTypeId(this.b.a, this.b.b, this.b.c) == Block.BED.id; + } + + public boolean E() { + return this.sleeping; + } + + public boolean F() { + return this.sleeping && this.sleepTicks >= 100; + } + + public void a(String s) {} } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index d79054364e..219e0f5292 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -25,7 +25,7 @@ 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.M = false; + this.bg = false; } public EntityItem(World world) { @@ -36,8 +36,8 @@ public class EntityItem extends Entity { protected void a() {} - public void b_() { - super.b_(); + public void f_() { + super.f_(); if (this.c > 0) { --this.c; } @@ -76,11 +76,11 @@ public class EntityItem extends Entity { ++this.e; ++this.b; if (this.b >= 6000) { - this.q(); + this.C(); } } - public boolean v() { + public boolean g_() { return this.world.a(this.boundingBox, Material.WATER, this); } @@ -162,15 +162,15 @@ public class EntityItem extends Entity { return false; } - protected void b(int i) { + protected void a(int i) { this.a((Entity) null, i); } public boolean a(Entity entity, int i) { - this.y(); + this.R(); this.f -= i; if (this.f <= 0) { - this.q(); + this.C(); } return false; @@ -183,9 +183,9 @@ public class EntityItem extends Entity { } public void b(NBTTagCompound nbttagcompound) { - this.f = nbttagcompound.c("Health") & 255; - this.b = nbttagcompound.c("Age"); - NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item"); + this.f = nbttagcompound.d("Health") & 255; + this.b = nbttagcompound.d("Age"); + NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item"); this.a = new ItemStack(nbttagcompound1); } @@ -203,7 +203,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.c(this, i); - this.q(); + this.C(); } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index d23e2d341e..aae79da9a0 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1,9 +1,9 @@ package net.minecraft.server; -import java.util.ArrayList; import java.util.List; // CraftBukkit start +import java.util.ArrayList; import org.bukkit.Server; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -18,84 +18,84 @@ import org.bukkit.event.entity.EntityDeathEvent; public abstract class EntityLiving extends Entity { public int maxNoDamageTicks = 20; - public float aG; - public float aH; - public float aI = 0.0F; - public float aJ = 0.0F; - protected float aK; - protected float aL; - protected float aM; - protected float aN; - protected boolean aO = true; + public float D; + public float E; + public float F = 0.0F; + public float G = 0.0F; + protected float H; + protected float I; + protected float J; + protected float K; + protected boolean L = true; protected String texture = "/mob/char.png"; - protected boolean aQ = true; - protected float aR = 0.0F; - protected String aS = null; - protected float aT = 1.0F; - protected int aU = 0; - protected float aV = 0.0F; - public boolean aW = false; - public float aX; - public float aY; + protected boolean N = true; + protected float O = 0.0F; + protected String P = null; + protected float Q = 1.0F; + protected int R = 0; + protected float S = 0.0F; + public boolean T = false; + public float U; + public float V; public int health = 10; - public int ba; + public int X; private int a; public int hurtTicks; - public int bc; - public float bd = 0.0F; + public int Z; + public float aa = 0.0F; public int deathTicks = 0; public int attackTicks = 0; - public float bg; - public float bh; - protected boolean bi = false; - public int bj = -1; - public float bk = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D); - public float bl; - public float bm; - public float bn; - protected int bo; - protected double bp; - protected double bq; - protected double br; - protected double bs; - protected double bt; - float bu = 0.0F; + public float ad; + public float ae; + protected boolean af = false; + public int ag = -1; + public float ah = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D); + public float ai; + public float aj; + public float ak; + protected int al; + protected double am; + protected double an; + protected double ao; + protected double ap; + protected double aq; + float ar = 0.0F; protected int lastDamage = 0; - protected int bw = 0; - protected float bx; - protected float by; - protected float bz; - protected boolean bA = false; - protected float bB = 0.0F; - protected float bC = 0.7F; + protected int at = 0; + protected float au; + protected float av; + protected float aw; + protected boolean ax = false; + protected float ay = 0.0F; + protected float az = 0.7F; private Entity b; private int c = 0; public EntityLiving(World world) { super(world); - this.i = true; - this.aH = (float) (Math.random() + 1.0D) * 0.01F; + this.aC = true; + this.E = (float) (Math.random() + 1.0D) * 0.01F; this.a(this.locX, this.locY, this.locZ); - this.aG = (float) Math.random() * 12398.0F; + this.D = (float) Math.random() * 12398.0F; this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D); - this.S = 0.5F; + this.bm = 0.5F; } protected void a() {} - public boolean i(Entity entity) { - return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.w(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.w(), entity.locZ)) == null; + 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; } - public boolean c_() { + public boolean d_() { return !this.dead; } - public boolean z() { + public boolean e_() { return !this.dead; } - public float w() { + public float p() { return this.width * 0.85F; } @@ -103,19 +103,23 @@ public abstract class EntityLiving extends Entity { return 80; } - public void r() { - this.aX = this.aY; - super.r(); + public void G() { + String s = this.e(); + + if (s != null) { + this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + } + } + + public void H() { + this.U = this.V; + super.H(); if (this.random.nextInt(1000) < this.a++) { this.a = -this.c(); - String s = this.e(); - - if (s != null) { - this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - } + this.G(); } - if (this.B() && this.C()) { + if (this.J() && this.D()) { // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity victim = this.getBukkitEntity(); @@ -129,13 +133,13 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - if (this.ae || this.world.isStatic) { + if (this.by || this.world.isStatic) { this.fireTicks = 0; } int i; - if (this.B() && this.a(Material.WATER) && !this.d_()) { + if (this.J() && this.a(Material.WATER) && !this.b_()) { --this.airTicks; if (this.airTicks == -20) { this.airTicks = 0; @@ -168,7 +172,7 @@ public abstract class EntityLiving extends Entity { this.airTicks = this.maxAirTicks; } - this.bg = this.bh; + this.ad = this.ae; if (this.attackTicks > 0) { --this.attackTicks; } @@ -184,8 +188,8 @@ public abstract class EntityLiving extends Entity { if (this.health <= 0) { ++this.deathTicks; if (this.deathTicks > 20) { - this.T(); - this.q(); + this.L(); + this.C(); for (i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; @@ -197,13 +201,13 @@ public abstract class EntityLiving extends Entity { } } - this.aN = this.aM; - this.aJ = this.aI; + this.K = this.J; + this.G = this.F; this.lastYaw = this.yaw; this.lastPitch = this.pitch; } - public void R() { + public void I() { for (int i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; @@ -214,22 +218,22 @@ public abstract class EntityLiving extends Entity { } } - public void D() { - super.D(); - this.aK = this.aL; - this.aL = 0.0F; + public void x() { + super.x(); + this.H = this.I; + this.I = 0.0F; } - public void b_() { - super.b_(); - this.o(); + public void f_() { + super.f_(); + this.q(); double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = MathHelper.a(d0 * d0 + d1 * d1); - float f1 = this.aI; + float f1 = this.F; float f2 = 0.0F; - this.aK = this.aL; + this.H = this.I; float f3 = 0.0F; if (f > 0.05F) { @@ -238,7 +242,7 @@ public abstract class EntityLiving extends Entity { f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit } - if (this.aY > 0.0F) { + if (this.V > 0.0F) { f1 = this.yaw; } @@ -246,11 +250,11 @@ public abstract class EntityLiving extends Entity { f3 = 0.0F; } - this.aL += (f3 - this.aL) * 0.3F; + this.I += (f3 - this.I) * 0.3F; float f4; - for (f4 = f1 - this.aI; f4 < -180.0F; f4 += 360.0F) { + for (f4 = f1 - this.F; f4 < -180.0F; f4 += 360.0F) { ; } @@ -258,11 +262,11 @@ public abstract class EntityLiving extends Entity { f4 -= 360.0F; } - this.aI += f4 * 0.3F; + this.F += f4 * 0.3F; float f5; - for (f5 = this.yaw - this.aI; f5 < -180.0F; f5 += 360.0F) { + for (f5 = this.yaw - this.F; f5 < -180.0F; f5 += 360.0F) { ; } @@ -280,9 +284,9 @@ public abstract class EntityLiving extends Entity { f5 = 75.0F; } - this.aI = this.yaw - f5; + this.F = this.yaw - f5; if (f5 * f5 > 2500.0F) { - this.aI += f5 * 0.2F; + this.F += f5 * 0.2F; } if (flag) { @@ -297,12 +301,12 @@ public abstract class EntityLiving extends Entity { this.lastYaw += 360.0F; } - while (this.aI - this.aJ < -180.0F) { - this.aJ -= 360.0F; + while (this.F - this.G < -180.0F) { + this.G -= 360.0F; } - while (this.aI - this.aJ >= 180.0F) { - this.aJ += 360.0F; + while (this.F - this.G >= 180.0F) { + this.G += 360.0F; } while (this.pitch - this.lastPitch < -180.0F) { @@ -313,14 +317,14 @@ public abstract class EntityLiving extends Entity { this.lastPitch += 360.0F; } - this.aM += f2; + this.J += f2; } protected void a(float f, float f1) { super.a(f, f1); } - public void d(int i) { + public void b(int i) { if (this.health > 0) { this.health += i; if (this.health > 20) { @@ -335,11 +339,11 @@ public abstract class EntityLiving extends Entity { if (this.world.isStatic) { return false; } else { - this.bw = 0; + this.at = 0; if (this.health <= 0) { return false; } else { - this.bm = 1.5F; + this.aj = 1.5F; boolean flag = true; if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { @@ -347,21 +351,21 @@ public abstract class EntityLiving extends Entity { return false; } - this.e(i - this.lastDamage); + this.c(i - this.lastDamage); this.lastDamage = i; flag = false; } else { this.lastDamage = i; - this.ba = this.health; + this.X = this.health; this.noDamageTicks = this.maxNoDamageTicks; - this.e(i); - this.hurtTicks = this.bc = 10; + this.c(i); + this.hurtTicks = this.Z = 10; } - this.bd = 0.0F; + this.aa = 0.0F; if (flag) { this.world.a(this, (byte) 2); - this.y(); + this.R(); if (entity != null) { double d0 = entity.locX - this.locX; @@ -371,10 +375,10 @@ public abstract class EntityLiving extends Entity { d0 = (Math.random() - Math.random()) * 0.01D; } - this.bd = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw; + this.aa = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw; this.a(entity, i, d0, d1); } else { - this.bd = (float) ((int) (Math.random() * 2.0D) * 180); + this.aa = (float) ((int) (Math.random() * 2.0D) * 180); } } @@ -383,7 +387,7 @@ public abstract class EntityLiving extends Entity { this.world.a(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } - this.f(entity); + this.a(entity); } else if (flag) { this.world.a(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } @@ -393,7 +397,7 @@ public abstract class EntityLiving extends Entity { } } - protected void e(int i) { + protected void c(int i) { this.health -= i; } @@ -428,20 +432,20 @@ public abstract class EntityLiving extends Entity { } } - public void f(Entity entity) { - if (this.aU > 0 && entity != null) { - entity.b(this, this.aU); + public void a(Entity entity) { + if (this.R > 0 && entity != null) { + entity.c(this, this.R); } - this.bi = true; + this.af = true; if (!this.world.isStatic) { - this.g_(); + this.o(); } this.world.a(this, (byte) 3); } - protected void g_() { + protected void o() { // Craftbukkit start - whole method List loot = new ArrayList(); int drop = this.h(); @@ -493,10 +497,10 @@ public abstract class EntityLiving extends Entity { } } - public void c(float f, float f1) { + public void b(float f, float f1) { double d0; - if (this.v()) { + if (this.g_()) { d0 = this.locY; this.a(f, f1, 0.02F); this.c(this.motX, this.motY, this.motZ); @@ -504,10 +508,10 @@ public abstract class EntityLiving extends Entity { this.motY *= 0.800000011920929D; this.motZ *= 0.800000011920929D; this.motY -= 0.02D; - if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { + if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } - } else if (this.x()) { + } else if (this.Q()) { d0 = this.locY; this.a(f, f1, 0.02F); this.c(this.motX, this.motY, this.motZ); @@ -515,7 +519,7 @@ public abstract class EntityLiving extends Entity { this.motY *= 0.5D; this.motZ *= 0.5D; this.motY -= 0.02D; - if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { + if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } } else { @@ -551,7 +555,7 @@ public abstract class EntityLiving extends Entity { } this.c(this.motX, this.motY, this.motZ); - if (this.B && this.m()) { + if (this.aV && this.m()) { this.motY = 0.2D; } @@ -561,7 +565,7 @@ public abstract class EntityLiving extends Entity { this.motZ *= (double) f2; } - this.bl = this.bm; + this.ai = this.aj; d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F; @@ -570,8 +574,8 @@ public abstract class EntityLiving extends Entity { f4 = 1.0F; } - this.bm += (f4 - this.bm) * 0.4F; - this.bn += this.bm; + this.aj += (f4 - this.aj) * 0.4F; + this.ak += this.aj; } public boolean m() { @@ -590,33 +594,33 @@ public abstract class EntityLiving extends Entity { } public void b(NBTTagCompound nbttagcompound) { - this.health = nbttagcompound.c("Health"); - if (!nbttagcompound.a("Health")) { + this.health = nbttagcompound.d("Health"); + if (!nbttagcompound.b("Health")) { this.health = 10; } - this.hurtTicks = nbttagcompound.c("HurtTime"); - this.deathTicks = nbttagcompound.c("DeathTime"); - this.attackTicks = nbttagcompound.c("AttackTime"); + this.hurtTicks = nbttagcompound.d("HurtTime"); + this.deathTicks = nbttagcompound.d("DeathTime"); + this.attackTicks = nbttagcompound.d("AttackTime"); } - public boolean B() { + public boolean J() { return !this.dead && this.health > 0; } - public boolean d_() { + public boolean b_() { return false; } - public void o() { - if (this.bo > 0) { - double d0 = this.locX + (this.bp - this.locX) / (double) this.bo; - double d1 = this.locY + (this.bq - this.locY) / (double) this.bo; - double d2 = this.locZ + (this.br - this.locZ) / (double) this.bo; + public void q() { + if (this.al > 0) { + double d0 = this.locX + (this.am - this.locX) / (double) this.al; + double d1 = this.locY + (this.an - this.locY) / (double) this.al; + double d2 = this.locZ + (this.ao - this.locZ) / (double) this.al; double d3; - for (d3 = this.bs - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { + for (d3 = this.ap - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { ; } @@ -624,58 +628,62 @@ public abstract class EntityLiving extends Entity { d3 -= 360.0D; } - this.yaw = (float) ((double) this.yaw + d3 / (double) this.bo); - this.pitch = (float) ((double) this.pitch + (this.bt - (double) this.pitch) / (double) this.bo); - --this.bo; + this.yaw = (float) ((double) this.yaw + d3 / (double) this.al); + this.pitch = (float) ((double) this.pitch + (this.aq - (double) this.pitch) / (double) this.al); + --this.al; this.a(d0, d1, d2); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); } - if (this.health <= 0) { - this.bA = false; - this.bx = 0.0F; - this.by = 0.0F; - this.bz = 0.0F; - } else if (!this.aW) { - this.d(); + if (this.w()) { + this.ax = false; + this.au = 0.0F; + this.av = 0.0F; + this.aw = 0.0F; + } else if (!this.T) { + this.c_(); } - boolean flag = this.v(); - boolean flag1 = this.x(); + boolean flag = this.g_(); + boolean flag1 = this.Q(); - if (this.bA) { + if (this.ax) { if (flag) { this.motY += 0.03999999910593033D; } else if (flag1) { this.motY += 0.03999999910593033D; } else if (this.onGround) { - this.S(); + this.K(); } } - this.bx *= 0.98F; - this.by *= 0.98F; - this.bz *= 0.9F; - this.c(this.bx, this.by); + this.au *= 0.98F; + this.av *= 0.98F; + this.aw *= 0.9F; + this.b(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) { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - if (entity.z()) { - entity.c((Entity) this); + if (entity.e_()) { + entity.h(this); } } } } - protected void S() { + protected boolean w() { + return this.health <= 0; + } + + protected void K() { this.motY = 0.41999998688697815D; } - protected void d() { - ++this.bw; + protected void c_() { + ++this.at; EntityHuman entityhuman = this.world.a(this, -1.0D); if (entityhuman != null) { @@ -685,20 +693,20 @@ public abstract class EntityLiving extends Entity { double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (d3 > 16384.0D) { - this.q(); + this.C(); } - if (this.bw > 600 && this.random.nextInt(800) == 0) { + if (this.at > 600 && this.random.nextInt(800) == 0) { if (d3 < 1024.0D) { - this.bw = 0; + this.at = 0; } else { - this.q(); + this.C(); } } } - this.bx = 0.0F; - this.by = 0.0F; + this.au = 0.0F; + this.av = 0.0F; float f = 8.0F; if (this.random.nextFloat() < 0.02F) { @@ -707,29 +715,29 @@ public abstract class EntityLiving extends Entity { this.b = entityhuman; this.c = 10 + this.random.nextInt(20); } else { - this.bz = (this.random.nextFloat() - 0.5F) * 20.0F; + 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.b((Entity) this) > (double) (f * f)) { + if (this.c-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) { this.b = null; } } else { if (this.random.nextFloat() < 0.05F) { - this.bz = (this.random.nextFloat() - 0.5F) * 20.0F; + this.aw = (this.random.nextFloat() - 0.5F) * 20.0F; } - this.yaw += this.bz; - this.pitch = this.bB; + this.yaw += this.aw; + this.pitch = this.ay; } - boolean flag = this.v(); - boolean flag1 = this.x(); + boolean flag = this.g_(); + boolean flag1 = this.Q(); if (flag || flag1) { - this.bA = this.random.nextFloat() < 0.8F; + this.ax = this.random.nextFloat() < 0.8F; } } @@ -741,9 +749,9 @@ public abstract class EntityLiving extends Entity { if (entity instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) entity; - d2 = entityliving.locY + (double) entityliving.w() - (this.locY + (double) this.w()); + d2 = entityliving.locY + (double) entityliving.p() - (this.locY + (double) this.p()); } else { - d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.w()); + d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.p()); } double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1); @@ -776,21 +784,21 @@ public abstract class EntityLiving extends Entity { return f + f3; } - public void T() {} + public void L() {} 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 t() { + protected void M() { this.a((Entity) null, 4); } - public Vec3D G() { - return this.c(1.0F); + public Vec3D N() { + return this.b(1.0F); } - public Vec3D c(float f) { + public Vec3D b(float f) { float f1; float f2; float f3; @@ -817,4 +825,8 @@ public abstract class EntityLiving extends Entity { public int j() { return 4; } + + public boolean E() { + return false; + } } diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 0f040f109a..6f6188d459 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -13,22 +13,22 @@ import org.bukkit.event.vehicle.*; public class EntityMinecart extends Entity implements IInventory { - private ItemStack[] al; + private ItemStack[] h; public int a; public int b; public int c; - private boolean am; + private boolean i; public int d; public int e; public double f; - public double ak; - private static final int[][][] an = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}}; - private int ao; - private double ap; - private double aq; - private double ar; - private double as; - private double at; + public double g; + private static final int[][][] j = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}}; + private int k; + private double l; + private double m; + private double n; + private double o; + private double p; // CraftBukkit start public boolean slowWhenEmpty = true; @@ -41,21 +41,21 @@ public class EntityMinecart extends Entity implements IInventory { public double maxSpeed = 0.4D; public ItemStack[] getContents() { - return this.al; + return this.h; } // CraftBukkit end public EntityMinecart(World world) { super(world); - this.al = new ItemStack[27]; //Craftbukkit + this.h = new ItemStack[27]; //Craftbukkit this.a = 0; this.b = 0; this.c = 1; - this.am = false; - this.i = true; + this.i = false; + this.aC = true; this.a(0.98F, 0.7F); this.height = this.width / 2.0F; - this.M = false; + this.bg = false; // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); @@ -69,15 +69,15 @@ public class EntityMinecart extends Entity implements IInventory { protected void a() {} - public AxisAlignedBB d(Entity entity) { + public AxisAlignedBB a_(Entity entity) { return entity.boundingBox; } - public AxisAlignedBB u() { + public AxisAlignedBB d() { return null; } - public boolean z() { + public boolean e_() { return true; } @@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory { this.c = -this.c; this.b = 10; - this.y(); + this.R(); this.a += i * 10; if (this.a > 40) { this.a(Item.MINECART.id, 1, 0.0F); @@ -126,7 +126,7 @@ public class EntityMinecart extends Entity implements IInventory { this.a(Block.FURNACE.id, 1, 0.0F); } - this.q(); + this.C(); } return true; @@ -135,13 +135,13 @@ public class EntityMinecart extends Entity implements IInventory { } } - public boolean c_() { + public boolean d_() { return !this.dead; } - public void q() { - for (int i = 0; i < this.h_(); ++i) { - ItemStack itemstack = this.a(i); + public void C() { + for (int i = 0; i < this.m_(); ++i) { + ItemStack itemstack = this.c_(i); if (itemstack != null) { float f = this.random.nextFloat() * 0.8F + 0.1F; @@ -167,10 +167,10 @@ public class EntityMinecart extends Entity implements IInventory { } } - super.q(); + super.C(); } - public void b_() { + public void f_() { // CraftBukkit start double prevX = this.locX; double prevY = this.locY; @@ -189,13 +189,13 @@ public class EntityMinecart extends Entity implements IInventory { double d0; - if (this.world.isStatic && this.ao > 0) { - if (this.ao > 0) { - double d1 = this.locX + (this.ap - this.locX) / (double) this.ao; - double d2 = this.locY + (this.aq - this.locY) / (double) this.ao; - double d3 = this.locZ + (this.ar - this.locZ) / (double) this.ao; + if (this.world.isStatic && this.k > 0) { + if (this.k > 0) { + double d1 = this.locX + (this.l - this.locX) / (double) this.k; + double d2 = this.locY + (this.m - this.locY) / (double) this.k; + double d3 = this.locZ + (this.n - this.locZ) / (double) this.k; - for (d0 = this.as - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) { + for (d0 = this.o - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) { ; } @@ -203,14 +203,14 @@ public class EntityMinecart extends Entity implements IInventory { d0 -= 360.0D; } - this.yaw = (float) ((double) this.yaw + d0 / (double) this.ao); - this.pitch = (float) ((double) this.pitch + (this.at - (double) this.pitch) / (double) this.ao); - --this.ao; + this.yaw = (float) ((double) this.yaw + d0 / (double) this.k); + this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k); + --this.k; this.a(d1, d2, d3); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); } else { this.a(this.locX, this.locY, this.locZ); - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); } } else { this.lastX = this.locX; @@ -254,7 +254,7 @@ public class EntityMinecart extends Entity implements IInventory { this.motZ -= d0; } - int[][] aint = an[l]; + int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit. double d5 = (double) (aint[1][0] - aint[0][0]); double d6 = (double) (aint[1][2] - aint[0][2]); double d7 = Math.sqrt(d5 * d5 + d6 * d6); @@ -333,18 +333,18 @@ public class EntityMinecart extends Entity implements IInventory { this.motZ *= 0.996999979019165D; } else { if (this.d == 2) { - d16 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak); + d16 = (double) MathHelper.a(this.f * this.f + this.g * this.g); if (d16 > 0.01D) { flag = true; this.f /= d16; - this.ak /= d16; + this.g /= d16; double d18 = 0.04D; this.motX *= 0.800000011920929D; this.motY *= 0.0D; this.motZ *= 0.800000011920929D; this.motX += this.f * d18; - this.motZ += this.ak * d18; + this.motZ += this.g * d18; } else { this.motX *= 0.8999999761581421D; this.motY *= 0.0D; @@ -381,17 +381,17 @@ public class EntityMinecart extends Entity implements IInventory { } if (this.d == 2) { - double d20 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak); + double d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g); if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) { this.f /= d20; - this.ak /= d20; - if (this.f * this.motX + this.ak * this.motZ < 0.0D) { + this.g /= d20; + if (this.f * this.motX + this.g * this.motZ < 0.0D) { this.f = 0.0D; - this.ak = 0.0D; + this.g = 0.0D; } else { this.f = this.motX; - this.ak = this.motZ; + this.g = this.motZ; } } } @@ -436,7 +436,7 @@ public class EntityMinecart extends Entity implements IInventory { if (d21 * d21 + d22 * d22 > 0.0010D) { this.yaw = (float) (Math.atan2(d22, d21) * 180.0D / 3.141592653589793D); - if (this.am) { + if (this.i) { this.yaw += 180.0F; } } @@ -453,10 +453,10 @@ public class EntityMinecart extends Entity implements IInventory { if (d23 < -170.0D || d23 >= 170.0D) { this.yaw += 180.0F; - this.am = !this.am; + this.i = !this.i; } - this.b(this.yaw, this.pitch); + this.c(this.yaw, this.pitch); // CraftBukkit start CraftServer server = ((WorldServer) this.world).getServer(); @@ -477,8 +477,8 @@ public class EntityMinecart extends Entity implements IInventory { for (int k1 = 0; k1 < list.size(); ++k1) { Entity entity = (Entity) list.get(k1); - if (entity != this.passenger && entity.z() && entity instanceof EntityMinecart) { - entity.c((Entity) this); + if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) { + entity.h(this); } } } @@ -490,7 +490,7 @@ public class EntityMinecart extends Entity implements IInventory { if (flag && this.random.nextInt(4) == 0) { --this.e; if (this.e < 0) { - this.f = this.ak = 0.0D; + this.f = this.g = 0.0D; } this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D); @@ -515,7 +515,7 @@ public class EntityMinecart extends Entity implements IInventory { d1 = (double) (j + 1); } - int[][] aint = an[l]; + int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit double d3 = 0.0D; double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D; double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D; @@ -562,17 +562,17 @@ public class EntityMinecart extends Entity implements IInventory { nbttagcompound.a("Type", this.d); if (this.d == 2) { nbttagcompound.a("PushX", this.f); - nbttagcompound.a("PushZ", this.ak); + nbttagcompound.a("PushZ", this.g); nbttagcompound.a("Fuel", (short) this.e); } else if (this.d == 1) { NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < this.al.length; ++i) { - if (this.al[i] != null) { + for (int i = 0; i < this.h.length; ++i) { + if (this.h[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.a("Slot", (byte) i); - this.al[i].a(nbttagcompound1); + this.h[i].a(nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1); } } @@ -582,28 +582,28 @@ public class EntityMinecart extends Entity implements IInventory { } protected void b(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.d("Type"); + this.d = nbttagcompound.e("Type"); if (this.d == 2) { - this.f = nbttagcompound.g("PushX"); - this.ak = nbttagcompound.g("PushZ"); - this.e = nbttagcompound.c("Fuel"); + this.f = nbttagcompound.h("PushX"); + this.g = nbttagcompound.h("PushZ"); + this.e = nbttagcompound.d("Fuel"); } else if (this.d == 1) { - NBTTagList nbttaglist = nbttagcompound.k("Items"); + NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.al = new ItemStack[this.h_()]; + this.h = new ItemStack[this.m_()]; - for (int i = 0; i < nbttaglist.b(); ++i) { + for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.b("Slot") & 255; + int j = nbttagcompound1.c("Slot") & 255; - if (j >= 0 && j < this.al.length) { - this.al[j] = new ItemStack(nbttagcompound1); + if (j >= 0 && j < this.h.length) { + this.h[j] = new ItemStack(nbttagcompound1); } } } } - public void c(Entity entity) { + public void h(Entity entity) { if (!this.world.isStatic) { if (entity != this.passenger) { @@ -628,7 +628,7 @@ public class EntityMinecart extends Entity implements IInventory { server.getPluginManager().callEvent(enterEvent); if (!enterEvent.isCancelled()) { - entity.e((Entity) this); + entity.b((Entity) this); } } } @@ -653,8 +653,8 @@ public class EntityMinecart extends Entity implements IInventory { d1 *= d3; d0 *= 0.10000000149011612D; d1 *= 0.10000000149011612D; - d0 *= (double) (1.0F - this.U); - d1 *= (double) (1.0F - this.U); + d0 *= (double) (1.0F - this.bo); + d1 *= (double) (1.0F - this.bo); d0 *= 0.5D; d1 *= 0.5D; if (entity instanceof EntityMinecart) { @@ -692,26 +692,26 @@ public class EntityMinecart extends Entity implements IInventory { } } - public int h_() { + public int m_() { return 27; } - public ItemStack a(int i) { - return this.al[i]; + public ItemStack c_(int i) { + return this.h[i]; } - public ItemStack b(int i, int j) { - if (this.al[i] != null) { + public ItemStack a(int i, int j) { + if (this.h[i] != null) { ItemStack itemstack; - if (this.al[i].count <= j) { - itemstack = this.al[i]; - this.al[i] = null; + if (this.h[i].count <= j) { + itemstack = this.h[i]; + this.h[i] = null; return itemstack; } else { - itemstack = this.al[i].a(j); - if (this.al[i].count == 0) { - this.al[i] = null; + itemstack = this.h[i].a(j); + if (this.h[i].count == 0) { + this.h[i] = null; } return itemstack; @@ -722,21 +722,21 @@ public class EntityMinecart extends Entity implements IInventory { } public void a(int i, ItemStack itemstack) { - this.al[i] = itemstack; - if (itemstack != null && itemstack.count > this.c()) { - itemstack.count = this.c(); + this.h[i] = itemstack; + if (itemstack != null && itemstack.count > this.n_()) { + itemstack.count = this.n_(); } } - public String b() { + public String c() { return "Minecart"; } - public int c() { + public int n_() { return 64; } - public void d() {} + public void h() {} public boolean a(EntityHuman entityhuman) { if (this.d == 0) { @@ -759,14 +759,14 @@ public class EntityMinecart extends Entity implements IInventory { } // CraftBukkit end - entityhuman.e(this); + entityhuman.b((Entity) this); } } else if (this.d == 1) { if (!this.world.isStatic) { entityhuman.a((IInventory) this); } } else if (this.d == 2) { - ItemStack itemstack = entityhuman.inventory.e(); + ItemStack itemstack = entityhuman.inventory.b(); if (itemstack != null && itemstack.id == Item.COAL.id) { if (--itemstack.count == 0) { @@ -777,13 +777,13 @@ public class EntityMinecart extends Entity implements IInventory { } this.f = this.locX - entityhuman.locX; - this.ak = this.locZ - entityhuman.locZ; + this.g = this.locZ - entityhuman.locZ; } return true; } public boolean a_(EntityHuman entityhuman) { - return this.dead ? false : entityhuman.b((Entity) this) <= 64.0D; + return this.dead ? false : entityhuman.g(this) <= 64.0D; } } diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index 8d22b9174e..71e32fb8bb 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -20,27 +20,27 @@ public class EntityMonster extends EntityCreature implements IMonster { this.health = 20; } - public void o() { - float f = this.b(1.0F); + public void q() { + float f = this.c(1.0F); if (f > 0.5F) { - this.bw += 2; + this.at += 2; } - super.o(); + super.q(); } - public void b_() { - super.b_(); - if (this.world.k == 0) { - this.q(); + public void f_() { + super.f_(); + if (this.world.j == 0) { + this.C(); } } protected Entity l() { EntityHuman entityhuman = this.world.a(this, 16.0D); - return entityhuman != null && this.i(entityhuman) ? entityhuman : null; + return entityhuman != null && this.e(entityhuman) ? entityhuman : null; } public boolean a(Entity entity, int i) { @@ -57,9 +57,9 @@ public class EntityMonster extends EntityCreature implements IMonster { server.getPluginManager().callEvent(event); if (!event.isCancelled()) { if (event.getTarget() == null) { - d = null; + this.d = null; } else { - d = ((CraftEntity) event.getTarget()).getHandle(); + this.d = ((CraftEntity) event.getTarget()).getHandle(); } } // CraftBukkit end @@ -75,10 +75,10 @@ public class EntityMonster extends EntityCreature implements IMonster { } protected void a(Entity entity, float f) { - if ((double) f < 2.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { + if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { this.attackTicks = 20; // CraftBukkit start - if(entity instanceof EntityLiving) { + if (entity instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.entity.Entity damager = this.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index e1b17a8ef6..b9a06e0746 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -18,22 +18,22 @@ public class EntityPigZombie extends EntityZombie { public EntityPigZombie(World world) { super(world); this.texture = "/mob/pigzombie.png"; - this.bC = 0.5F; + this.az = 0.5F; this.c = 5; - this.ae = true; + this.by = true; } - public void b_() { - this.bC = this.d != null ? 0.95F : 0.5F; + public void f_() { + this.az = this.d != null ? 0.95F : 0.5F; if (this.b > 0 && --this.b == 0) { this.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F); } - super.b_(); + super.f_(); } public boolean b() { - return this.world.k > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); + return this.world.j > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); } public void a(NBTTagCompound nbttagcompound) { @@ -43,15 +43,15 @@ public class EntityPigZombie extends EntityZombie { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - this.a = nbttagcompound.c("Anger"); + this.a = nbttagcompound.d("Anger"); } protected Entity l() { return this.a == 0 ? null : super.l(); } - public void o() { - super.o(); + public void q() { + super.q(); } 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.g(entity); + entitypigzombie.c(entity); } } - this.g(entity); + this.c(entity); } return super.a(entity, i); } - private void g(Entity entity) { + private void c(Entity entity) { // CraftBukkit start org.bukkit.entity.Entity bukkitTarget = null; if (entity != null) { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index d347de4b30..e39251161d 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -21,21 +21,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double d; public double e; public List f = new LinkedList(); - public Set ak = new HashSet(); - public double al; - private int bD = -99999999; - private int bE = 60; - private ItemStack[] bF = new ItemStack[] { null, null, null, null, null}; - private int bG = 0; - public boolean am; + public Set g = new HashSet(); + private int bE = -99999999; + private int bF = 60; + private ItemStack[] bG = new ItemStack[] { null, null, null, null, null}; + private int bH = 0; + public boolean h; public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { super(world); - int i = world.spawnX; - int j = world.spawnZ; - int k = world.spawnY; + ChunkCoordinates chunkcoordinates = world.l(); + int i = chunkcoordinates.a; + int j = chunkcoordinates.c; + int k = chunkcoordinates.b; - if (!world.q.e) { + if (!world.m.e) { i += this.random.nextInt(20) - 10; k = world.e(i, j); j += this.random.nextInt(20) - 10; @@ -43,7 +43,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); this.b = minecraftserver; - this.S = 0.0F; + this.bm = 0.0F; iteminworldmanager.a = this; this.name = s; this.c = iteminworldmanager; @@ -54,29 +54,38 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.activeContainer.a((ICrafting) this); } - public ItemStack[] I() { - return this.bF; + public ItemStack[] k_() { + return this.bG; } - public void b_() { - --this.bE; + protected void l_() { + this.height = 0.0F; + } + + public float p() { + return 1.62F; + } + + public void f_() { + this.c.a(); + --this.bF; this.activeContainer.a(); for (int i = 0; i < 5; ++i) { - ItemStack itemstack = this.a(i); + ItemStack itemstack = this.b_(i); - if (itemstack != this.bF[i]) { + if (itemstack != this.bG[i]) { this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack)); - this.bF[i] = itemstack; + this.bG[i] = itemstack; } } } - public ItemStack a(int i) { - return i == 0 ? this.inventory.e() : this.inventory.b[i - 1]; + public ItemStack b_(int i) { + return i == 0 ? this.inventory.b() : this.inventory.b[i - 1]; } - public void f(Entity entity) { + public void a(Entity entity) { // Craftbukkit start List loot = new ArrayList(); @@ -105,7 +114,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public boolean a(Entity entity, int i) { - if (this.bE > 0) { + if (this.bF > 0) { return false; } else { if (!this.b.n) { @@ -126,59 +135,46 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void d(int i) { - super.d(i); + public void b(int i) { + super.b(i); } - public void n() { - super.b_(); - ChunkCoordIntPair chunkcoordintpair = null; - double d0 = 0.0D; + public void a(boolean flag) { + super.f_(); + if (flag && !this.f.isEmpty()) { + ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0); - for (int i = 0; i < this.f.size(); ++i) { - ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.f.get(i); - double d1 = chunkcoordintpair1.a(this); + if (chunkcoordintpair != null) { + boolean flag1 = false; - if (i == 0 || d1 < d0) { - chunkcoordintpair = chunkcoordintpair1; - d0 = chunkcoordintpair1.a(this); - } - } + if (this.a.b() < 2) { + flag1 = true; + } - if (chunkcoordintpair != null) { - boolean flag = false; + if (flag1) { + this.f.remove(chunkcoordintpair); - if (d0 < 1024.0D) { - flag = true; - } + // CraftBukkit start + this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.world))); + List list = ((WorldServer) world).d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16); + // CraftBukkit end - if (this.a.b() < 2) { - flag = true; - } - - if (flag) { - this.f.remove(chunkcoordintpair); - - // Craftbukkit start - this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.world))); - List list = ((WorldServer)world).d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16); - // Craftbukkit end - - for (int j = 0; j < list.size(); ++j) { - this.a((TileEntity) list.get(j)); + for (int i = 0; i < list.size(); ++i) { + this.a((TileEntity) list.get(i)); + } } } } - if (this.health != this.bD) { + if (this.health != this.bE) { this.a.b((Packet) (new Packet8UpdateHealth(this.health))); - this.bD = this.health; + this.bE = this.health; } } private void a(TileEntity tileentity) { if (tileentity != null) { - Packet packet = tileentity.g(); + Packet packet = tileentity.e(); if (packet != null) { this.a.b(packet); @@ -186,13 +182,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void o() { - this.motX = this.motY = this.motZ = 0.0D; - this.bA = false; - super.o(); + public void q() { + super.q(); } - public void c(Entity entity, int i) { + public void b(Entity entity, int i) { if (!entity.dead) { if (entity instanceof EntityItem) { this.b.k.a(entity, new Packet22Collect(entity.id, this.id)); @@ -203,29 +197,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - super.c(entity, i); + super.b(entity, i); this.activeContainer.a(); } - public void K() { - if (!this.au) { - this.av = -1; - this.au = true; + public void r() { + if (!this.p) { + this.q = -1; + this.p = true; this.b.k.a(this, new Packet18ArmAnimation(this, 1)); } } - public float w() { - return 1.62F; + public void s() {} + + public boolean a(int i, int j, int k) { + if (super.a(i, j, k)) { + this.b.k.a(this, new Packet17(this, 0, i, j, k)); + return true; + } else { + return false; + } } - public void e(Entity entity) { + public void a(boolean flag, boolean flag1) { + if (this.E()) { + this.b.k.b(this, new Packet18ArmAnimation(this, 3)); + } + + super.a(flag, flag1); + this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + } + + public void b(Entity entity) { // CraftBukkit start setPassengerOf(entity); } public void setPassengerOf(Entity entity) { - // e(null) doesn't really fly for overloaded methods, + // b(null) doesn't really fly for overloaded methods, // so this method is needed super.setPassengerOf(entity); @@ -240,45 +250,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting { super.a(d0, flag); } - private void U() { - this.bG = this.bG % 100 + 1; + private void V() { + this.bH = this.bH % 100 + 1; } - public void a(int i, int j, int k) { - this.U(); - this.a.b((Packet) (new Packet100OpenWindow(this.bG, 1, "Crafting", 9))); + public void b(int i, int j, int k) { + this.V(); + 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.bG; + this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(IInventory iinventory) { - this.U(); - this.a.b((Packet) (new Packet100OpenWindow(this.bG, 0, iinventory.b(), iinventory.h_()))); + this.V(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.m_()))); this.activeContainer = new ContainerChest(this.inventory, iinventory); - this.activeContainer.f = this.bG; + this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(TileEntityFurnace tileentityfurnace) { - this.U(); - this.a.b((Packet) (new Packet100OpenWindow(this.bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))); + this.V(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.m_()))); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); - this.activeContainer.f = this.bG; + this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(TileEntityDispenser tileentitydispenser) { - this.U(); - this.a.b((Packet) (new Packet100OpenWindow(this.bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))); + this.V(); + this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.m_()))); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); - this.activeContainer.f = this.bG; + this.activeContainer.f = this.bH; this.activeContainer.a((ICrafting) this); } public void a(Container container, int i, ItemStack itemstack) { if (!(container.a(i) instanceof SlotResult)) { - if (!this.am) { + if (!this.h) { this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack))); } } @@ -295,19 +305,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(ItemStack itemstack) {} - public void L() { + public void t() { this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f))); - this.N(); + this.v(); } - public void M() { - if (!this.am) { + public void u() { + if (!this.h) { this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i()))); } } - public void N() { + public void v() { this.activeContainer.a((EntityHuman) this); this.activeContainer = this.defaultContainer; } + + public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) { + this.au = f; + this.av = f1; + this.ax = flag; + this.b(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 9baca736f2..998d21a39c 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -33,9 +33,9 @@ public class EntitySkeleton extends EntityMonster { return "mob.skeletonhurt"; } - public void o() { - if (this.world.b()) { - float f = this.b(1.0F); + public void q() { + if (this.world.c()) { + 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) { // CraftBukkit start @@ -51,7 +51,7 @@ public class EntitySkeleton extends EntityMonster { } } - super.o(); + super.q(); } protected void a(Entity entity, float f) { @@ -89,7 +89,7 @@ public class EntitySkeleton extends EntityMonster { return Item.ARROW.id; } - protected void g_() { + protected void o() { // 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 8775996599..fce0b6c798 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -17,9 +17,9 @@ public class EntitySnowball extends Entity { private int e = 0; private boolean f = false; public int a = 0; - private EntityLiving ak; - private int al; - private int am = 0; + private EntityLiving g; + private int h; + private int i = 0; public EntitySnowball(World world) { super(world); @@ -30,9 +30,9 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world, EntityLiving entityliving) { super(world); - this.ak = entityliving; + this.g = entityliving; this.a(0.25F, 0.25F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), 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); @@ -48,7 +48,7 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world, double d0, double d1, double d2) { super(world); - this.al = 0; + this.h = 0; this.a(0.25F, 0.25F); this.a(d0, d1, d2); this.height = 0.0F; @@ -73,14 +73,14 @@ public class EntitySnowball extends Entity { this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); - this.al = 0; + this.h = 0; } - public void b_() { - this.O = this.locX; - this.P = this.locY; - this.Q = this.locZ; - super.b_(); + public void f_() { + this.bi = this.locX; + this.bj = this.locY; + this.bk = this.locZ; + super.f_(); if (this.a > 0) { --this.a; } @@ -89,9 +89,9 @@ public class EntitySnowball extends Entity { int i = this.world.getTypeId(this.b, this.c, this.d); if (i == this.e) { - ++this.al; - if (this.al == 1200) { - this.q(); + ++this.h; + if (this.h == 1200) { + this.C(); } return; @@ -101,10 +101,10 @@ public class EntitySnowball extends Entity { this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.al = 0; - this.am = 0; + this.h = 0; + this.i = 0; } else { - ++this.am; + ++this.i; } Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); @@ -125,7 +125,7 @@ public class EntitySnowball extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) { + if (entity1.d_() && (entity1 != this.g || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -152,7 +152,7 @@ public class EntitySnowball extends Entity { boolean stick; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); - org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity(); + org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity(); DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; @@ -164,13 +164,13 @@ public class EntitySnowball extends Entity { if(!event.isCancelled()) { // this function returns if the snowball should stick or not, i.e. !bounce - stick = movingobjectposition.g.a(this.ak, event.getDamage()); + stick = movingobjectposition.g.a(this.g, event.getDamage()); } else { // event was cancelled, get if the snowball should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.ak, 0); + stick = movingobjectposition.g.a(this.g, 0); } if (stick) { ; @@ -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.q(); + this.C(); } this.locX += this.motX; @@ -213,7 +213,7 @@ public class EntitySnowball extends Entity { float f2 = 0.99F; float f3 = 0.03F; - if (this.v()) { + if (this.g_()) { for (int l = 0; l < 4; ++l) { float f4 = 0.25F; @@ -240,19 +240,19 @@ public class EntitySnowball extends Entity { } public void b(NBTTagCompound nbttagcompound) { - this.b = nbttagcompound.c("xTile"); - this.c = nbttagcompound.c("yTile"); - this.d = nbttagcompound.c("zTile"); - this.e = nbttagcompound.b("inTile") & 255; - this.a = nbttagcompound.b("shake") & 255; - this.f = nbttagcompound.b("inGround") == 1; + this.b = nbttagcompound.d("xTile"); + this.c = nbttagcompound.d("yTile"); + this.d = nbttagcompound.d("zTile"); + this.e = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.f = nbttagcompound.c("inGround") == 1; } public void b(EntityHuman entityhuman) { - if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { + 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.c(this, 1); - this.q(); + entityhuman.b(this, 1); + this.C(); } } } diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index 5576985702..586c68ae2e 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -13,7 +13,7 @@ public class EntitySpider extends EntityMonster { super(world); this.texture = "/mob/spider.png"; this.a(1.4F, 0.9F); - this.bC = 0.8F; + this.az = 0.8F; } public double k() { @@ -21,7 +21,7 @@ public class EntitySpider extends EntityMonster { } protected Entity l() { - float f = this.b(1.0F); + float f = this.c(1.0F); if (f < 0.5F) { double d0 = 16.0D; @@ -45,7 +45,7 @@ public class EntitySpider extends EntityMonster { } protected void a(Entity entity, float f) { - float f1 = this.b(1.0F); + float f1 = this.c(1.0F); if (f1 > 0.5F && this.random.nextInt(100) == 0) { // CraftBukkit start @@ -91,6 +91,6 @@ public class EntitySpider extends EntityMonster { } public boolean m() { - return this.B; + return this.aV; } } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index 814833b7a7..8b78381298 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -13,7 +13,7 @@ public class EntityTNTPrimed extends Entity { public EntityTNTPrimed(World world) { super(world); this.a = 0; - this.i = true; + this.aC = true; this.a(0.98F, 0.98F); this.height = this.width / 2.0F; } @@ -26,7 +26,7 @@ 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.M = false; + this.bg = false; this.a = 80; this.lastX = d0; this.lastY = d1; @@ -35,11 +35,11 @@ public class EntityTNTPrimed extends Entity { protected void a() {} - public boolean c_() { + public boolean d_() { return !this.dead; } - public void b_() { + public void f_() { this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; @@ -57,21 +57,23 @@ 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.d(); - this.q(); + this.h(); + this.C(); // Craftbukkit end } else { this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); } } - private void d() { + private void h() { + float f = 4.0F; + // Craftbukkit start CraftServer server = ((WorldServer) this.world).getServer(); org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; - ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 4.0F, false); + ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false); server.getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if (!event.isCancelled()) { this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); } // Craftbukkit end @@ -82,6 +84,6 @@ public class EntityTNTPrimed extends Entity { } protected void b(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.b("Fuse"); + this.a = nbttagcompound.c("Fuse"); } } diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index 94f63d5b7a..d89e1a09e5 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -64,12 +64,12 @@ public class EntityTrackerEntry { int k = MathHelper.b(this.a.locZ * 32.0D); int l = MathHelper.d(this.a.yaw * 256.0F / 360.0F); int i1 = MathHelper.d(this.a.pitch * 256.0F / 360.0F); - boolean flag = i != this.d || j != this.e || k != this.f; - boolean flag1 = l != this.g || i1 != this.h; int j1 = i - this.d; int k1 = j - this.e; int l1 = k - this.f; Object object = null; + boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8; + boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8; if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) { if (flag && flag1) { @@ -78,8 +78,6 @@ public class EntityTrackerEntry { object = new Packet31RelEntityMove(this.a.id, (byte) j1, (byte) k1, (byte) l1); } else if (flag1) { object = new Packet32EntityLook(this.a.id, (byte) l, (byte) i1); - } else { - object = new Packet30Entity(this.a.id); } } else { object = new Packet34EntityTeleport(this.a.id, i, j, k, (byte) l, (byte) i1); @@ -104,22 +102,27 @@ public class EntityTrackerEntry { this.a((Packet) object); } - DataWatcher datawatcher = this.a.p(); + DataWatcher datawatcher = this.a.O(); if (datawatcher.a()) { this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher))); } - this.d = i; - this.e = j; - this.f = k; - this.g = l; - this.h = i1; + if (flag) { + this.d = i; + this.e = j; + this.f = k; + } + + if (flag1) { + this.g = l; + this.h = i1; + } } - if (this.a.E) { + if (this.a.aY) { this.b((Packet) (new Packet28EntityVelocity(this.a))); - this.a.E = false; + this.a.aY = false; } } @@ -163,7 +166,7 @@ public class EntityTrackerEntry { entityplayer.a.b((Packet) (new Packet28EntityVelocity(this.a.id, this.a.motX, this.a.motY, this.a.motZ))); } - ItemStack[] aitemstack = this.a.I(); + ItemStack[] aitemstack = this.a.k_(); if (aitemstack != null) { for (int i = 0; i < aitemstack.length; ++i) { diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 0cf3b67559..e14121e6e0 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -11,13 +11,13 @@ public class EntityZombie extends EntityMonster { public EntityZombie(World world) { super(world); this.texture = "/mob/zombie.png"; - this.bC = 0.5F; + this.az = 0.5F; this.c = 5; } - public void o() { - if (this.world.b()) { - float f = this.b(1.0F); + public void q() { + if (this.world.c()) { + 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) { // CraftBukkit start @@ -31,7 +31,7 @@ public class EntityZombie extends EntityMonster { } } - super.o(); + super.q(); } protected String e() { diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index e5734447b3..a399af928e 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -64,7 +64,7 @@ public class Explosion { d3 /= d6; d4 /= d6; d5 /= d6; - float f1 = this.f * (0.7F + this.i.l.nextFloat() * 0.6F); + float f1 = this.f * (0.7F + this.i.k.nextFloat() * 0.6F); d0 = this.b; d1 = this.c; @@ -179,7 +179,7 @@ public class Explosion { } public void b() { - this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.l.nextFloat() - this.i.l.nextFloat()) * 0.2F) * 0.7F); + this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.k.nextFloat() - this.i.k.nextFloat()) * 0.2F) * 0.7F); ArrayList arraylist = new ArrayList(); arraylist.addAll(this.g); @@ -217,9 +217,9 @@ public class Explosion { int i1 = this.i.getTypeId(j, k, l); for (int j1 = 0; j1 < 1; ++j1) { - double d0 = (double) ((float) j + this.i.l.nextFloat()); - double d1 = (double) ((float) k + this.i.l.nextFloat()); - double d2 = (double) ((float) l + this.i.l.nextFloat()); + double d0 = (double) ((float) j + this.i.k.nextFloat()); + double d1 = (double) ((float) k + this.i.k.nextFloat()); + double d2 = (double) ((float) l + this.i.k.nextFloat()); double d3 = d0 - this.b; double d4 = d1 - this.c; double d5 = d2 - this.d; @@ -230,7 +230,7 @@ public class Explosion { d5 /= d6; double d7 = 0.5D / (d6 / (double) this.f + 0.1D); - d7 *= (double) (this.i.l.nextFloat() * this.i.l.nextFloat() + 0.3F); + d7 *= (double) (this.i.k.nextFloat() * this.i.k.nextFloat() + 0.3F); d3 *= d7; d4 *= d7; d5 *= d7; @@ -241,7 +241,7 @@ public class Explosion { if (i1 > 0) { Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit this.i.e(j, k, l, 0); - Block.byId[i1].a_(this.i, j, k, l); + Block.byId[i1].c(this.i, j, k, l); } } } diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java index 27d44762fe..5b3d861805 100644 --- a/src/main/java/net/minecraft/server/IInventory.java +++ b/src/main/java/net/minecraft/server/IInventory.java @@ -2,19 +2,19 @@ package net.minecraft.server; public interface IInventory { - int h_(); + int m_(); - ItemStack a(int i); + ItemStack c_(int i); - ItemStack b(int i, int j); + ItemStack a(int i, int j); void a(int i, ItemStack itemstack); - String b(); + String c(); - int c(); + int n_(); - void d(); + void h(); 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 d8a5d3debb..0c12956d66 100644 --- a/src/main/java/net/minecraft/server/InventoryCraftResult.java +++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java @@ -12,19 +12,19 @@ public class InventoryCraftResult implements IInventory { public InventoryCraftResult() {} - public int h_() { - return this.a.length; //Craftbukkit + public int m_() { + return 1; } - public ItemStack a(int i) { + public ItemStack c_(int i) { return this.a[i]; } - public String b() { + public String c() { return "Result"; } - public ItemStack b(int i, int j) { + public ItemStack a(int i, int j) { if (this.a[i] != null) { ItemStack itemstack = this.a[i]; @@ -39,11 +39,11 @@ public class InventoryCraftResult implements IInventory { this.a[i] = itemstack; } - public int c() { + public int n_() { return 64; } - public void d() {} + public void h() {} 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 31a58c4981..67dd7ffcba 100644 --- a/src/main/java/net/minecraft/server/InventoryCrafting.java +++ b/src/main/java/net/minecraft/server/InventoryCrafting.java @@ -20,29 +20,29 @@ public class InventoryCrafting implements IInventory { this.b = i; } - public int h_() { + public int m_() { return this.a.length; } - public ItemStack a(int i) { - return i >= this.h_() ? null : this.a[i]; + public ItemStack c_(int i) { + return i >= this.m_() ? null : this.a[i]; } - public ItemStack a(int i, int j) { + public ItemStack b(int i, int j) { if (i >= 0 && i < this.b) { int k = i + j * this.b; - return this.a(k); + return this.c_(k); } else { return null; } } - public String b() { + public String c() { return "Crafting"; } - public ItemStack b(int i, int j) { + public ItemStack a(int i, int j) { if (this.a[i] != null) { ItemStack itemstack; @@ -70,11 +70,11 @@ public class InventoryCrafting implements IInventory { this.c.a((IInventory) this); } - public int c() { + public int n_() { return 64; } - public void d() {} + public void h() {} 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 bf2ba36516..51e4cdff5f 100644 --- a/src/main/java/net/minecraft/server/InventoryLargeChest.java +++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java @@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory { // CraftBukkit start public ItemStack[] getContents() { - ItemStack[] result = new ItemStack[h_()]; + ItemStack[] result = new ItemStack[m_()]; for (int i = 0; i < result.length; i++) { - result[i] = a(i); + result[i] = c_(i); } return result; } @@ -22,37 +22,37 @@ public class InventoryLargeChest implements IInventory { this.c = iinventory1; } - public int h_() { - return this.b.h_() + this.c.h_(); + public int m_() { + return this.b.m_() + this.c.m_(); } - public String b() { + public String c() { return this.a; } - public ItemStack a(int i) { - return i >= this.b.h_() ? this.c.a(i - this.b.h_()) : this.b.a(i); + public ItemStack c_(int i) { + return i >= this.b.m_() ? this.c.c_(i - this.b.m_()) : this.b.c_(i); } - public ItemStack b(int i, int j) { - return i >= this.b.h_() ? this.c.b(i - this.b.h_(), j) : this.b.b(i, j); + 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); } public void a(int i, ItemStack itemstack) { - if (i >= this.b.h_()) { - this.c.a(i - this.b.h_(), itemstack); + if (i >= this.b.m_()) { + this.c.a(i - this.b.m_(), itemstack); } else { this.b.a(i, itemstack); } } - public int c() { - return this.b.c(); + public int n_() { + return this.b.n_(); } - public void d() { - this.b.d(); - this.c.d(); + public void h() { + this.b.h(); + this.c.h(); } 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 ddc74fa62d..251ea0bfe1 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -23,7 +23,7 @@ public class InventoryPlayer implements IInventory { this.e = entityhuman; } - public ItemStack e() { + public ItemStack b() { return this.a[this.c]; } @@ -39,7 +39,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.c() && (!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.n_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) { return i; } } @@ -79,8 +79,8 @@ public class InventoryPlayer implements IInventory { l = this.a[k].b() - this.a[k].count; } - if (l > this.c() - this.a[k].count) { - l = this.c() - this.a[k].count; + if (l > this.n_() - this.a[k].count) { + l = this.n_() - this.a[k].count; } if (l == 0) { @@ -94,7 +94,7 @@ public class InventoryPlayer implements IInventory { } } - public void f() { + public void e() { for (int i = 0; i < this.a.length; ++i) { if (this.a[i] != null && this.a[i].b > 0) { --this.a[i].b; @@ -135,7 +135,7 @@ public class InventoryPlayer implements IInventory { } } - public ItemStack b(int i, int j) { + public ItemStack a(int i, int j) { ItemStack[] aitemstack = this.a; if (i >= this.a.length) { @@ -213,9 +213,9 @@ public class InventoryPlayer implements IInventory { this.a = new ItemStack[36]; this.b = new ItemStack[4]; - for (int i = 0; i < nbttaglist.b(); ++i) { + for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound.b("Slot") & 255; + int j = nbttagcompound.c("Slot") & 255; ItemStack itemstack = new ItemStack(nbttagcompound); if (itemstack.a() != null) { @@ -230,11 +230,11 @@ public class InventoryPlayer implements IInventory { } } - public int h_() { - return this.a.length + this.b.length; //Craftbukkit + public int m_() { + return this.a.length + 4; } - public ItemStack a(int i) { + public ItemStack c_(int i) { ItemStack[] aitemstack = this.a; if (i >= aitemstack.length) { @@ -245,16 +245,16 @@ public class InventoryPlayer implements IInventory { return aitemstack[i]; } - public String b() { + public String c() { return "Inventory"; } - public int c() { + public int n_() { return 64; } public int a(Entity entity) { - ItemStack itemstack = this.a(this.c); + ItemStack itemstack = this.c_(this.c); return itemstack != null ? itemstack.a(entity) : 1; } @@ -263,13 +263,13 @@ public class InventoryPlayer implements IInventory { if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) { return true; } else { - ItemStack itemstack = this.a(this.c); + ItemStack itemstack = this.c_(this.c); return itemstack != null ? itemstack.b(block) : false; } } - public int g() { + public int f() { int i = 0; int j = 0; int k = 0; @@ -282,7 +282,7 @@ public class InventoryPlayer implements IInventory { j += k1; k += i1; - int l1 = ((ItemArmor) this.b[l].a()).bh; + int l1 = ((ItemArmor) this.b[l].a()).bj; i += l1; } @@ -307,7 +307,7 @@ public class InventoryPlayer implements IInventory { } } - public void h() { + public void g() { int i; for (i = 0; i < this.a.length; ++i) { @@ -325,7 +325,7 @@ public class InventoryPlayer implements IInventory { } } - public void d() { + public void h() { this.d = true; } @@ -339,6 +339,6 @@ public class InventoryPlayer implements IInventory { } public boolean a_(EntityHuman entityhuman) { - return this.e.dead ? false : entityhuman.b((Entity) this.e) <= 64.0D; + return this.e.dead ? false : entityhuman.g(this.e) <= 64.0D; } } diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 7c182e907d..d16e14542d 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -67,12 +67,12 @@ public class ItemBlock extends Item { /* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself, * rather than the block touching the face we clicked on. */ - int typeId = blockClicked.getTypeId(); + int typeId = blockClicked.getTypeId(); org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked); if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP)) replacedBlock = blockClicked; - + final BlockState replacedBlockState = new CraftBlockState(replacedBlock); // CraftBukkit end @@ -95,9 +95,13 @@ public class ItemBlock extends Item { org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack); Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity(); - int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ)); + ChunkCoordinates chunkcoordinates = world.l(); + int spawnX = chunkcoordinates.a; + int spawnZ = chunkcoordinates.c; - boolean canBuild = distanceFromSpawn > ((WorldServer) world).D.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start + int distanceFromSpawn = (int) Math.max(Math.abs(i - spawnX), Math.abs(k - spawnZ)); + + boolean canBuild = distanceFromSpawn > ((WorldServer) world).x.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild); server.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java index 8aee3d1697..0c3b0ce3a5 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -121,8 +121,8 @@ public class ItemBucket extends Item { } if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) { - if (world.q.d && this.a == Block.WATER.id) { - world.a(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F); + if (world.m.d && this.a == Block.WATER.id) { + world.a(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F); for (int l = 0; l < 8; ++l) { world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java index 0b4849d4ca..341d14855e 100644 --- a/src/main/java/net/minecraft/server/ItemHoe.java +++ b/src/main/java/net/minecraft/server/ItemHoe.java @@ -52,14 +52,14 @@ public class ItemHoe extends Item { world.e(i, j, k, block.id); itemstack.b(1); - if (world.l.nextInt(8) == 0 && i1 == Block.GRASS.id) { + if (world.k.nextInt(8) == 0 && i1 == Block.GRASS.id) { byte b0 = 1; for (int j1 = 0; j1 < b0; ++j1) { float f = 0.7F; - float f1 = world.l.nextFloat() * f + (1.0F - f) * 0.5F; + float f1 = world.k.nextFloat() * f + (1.0F - f) * 0.5F; float f2 = 1.2F; - float f3 = world.l.nextFloat() * f + (1.0F - f) * 0.5F; + float f3 = world.k.nextFloat() * f + (1.0F - f) * 0.5F; EntityItem entityitem = new EntityItem(world, (double) ((float) i + f1), (double) ((float) j + f2), (double) ((float) k + f3), new ItemStack(Item.SEEDS)); entityitem.c = 10; diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 5ca0dca130..df38c5bc36 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -9,82 +9,100 @@ public class ItemInWorldManager { private World b; public EntityHuman a; - private float c; - public float d = 0.0F; // CraftBukkit private -> public + public float c = 0.0F; // CraftBukkit private -> public + private int d; private int e = 0; private float f = 0.0F; private int g; private int h; private int i; + private int j; + private boolean k; + private int l; + private int m; + private int n; + private int o; public ItemInWorldManager(World world) { this.b = world; } - public void a(int i, int j, int k) { - int l = this.b.getTypeId(i, j, k); - - if (l > 0 && this.d == 0.0F) { - Block.byId[l].b(this.b, i, j, k, this.a); - } - - if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) { - this.c(i, j, k); - } - } - public void a() { - this.d = 0.0F; - this.e = 0; - } + ++this.j; + if (this.k) { + int i = this.j - this.o; + int j = this.b.getTypeId(this.l, this.m, this.n); - public void a(int i, int j, int k, int l) { - if (this.e > 0) { - --this.e; - } else { - if (i == this.g && j == this.h && k == this.i) { - int i1 = this.b.getTypeId(i, j, k); + if (j != 0) { + Block block = Block.byId[j]; + float f = block.a(this.a) * (float) (i + 1); - if (i1 == 0) { - return; - } - - Block block = Block.byId[i1]; - - this.d += block.a(this.a); - ++this.f; - if (this.d >= 1.0F) { - this.c(i, j, k); - this.d = 0.0F; - this.c = 0.0F; - this.f = 0.0F; - this.e = 5; + if (f >= 1.0F) { + this.k = false; + this.d(this.l, this.m, this.n); } } else { - this.d = 0.0F; - this.c = 0.0F; - this.f = 0.0F; - this.g = i; - this.h = j; - this.i = k; + this.k = false; } } } - public boolean b(int i, int j, int k) { + public void a(int i, int j, int k) { + this.d = this.j; + int l = this.b.getTypeId(i, j, k); + + if (l > 0) { + Block.byId[l].b(this.b, i, j, k, this.a); + } + + if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) { + this.d(i, j, k); + } else { + this.g = i; + this.h = j; + this.i = 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; + int i1 = this.b.getTypeId(i, j, k); + + if (i1 != 0) { + Block block = Block.byId[i1]; + float f = block.a(this.a) * (float) (l + 1); + + 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; + } + } + } + + this.c = 0.0F; + this.e = 0; + } + + public boolean c(int i, int j, int k) { Block block = Block.byId[this.b.getTypeId(i, j, k)]; int l = this.b.getData(i, j, k); boolean flag = this.b.e(i, j, k, 0); if (block != null && flag) { - block.a(this.b, i, j, k, l); + block.b(this.b, i, j, k, l); } return flag; } - public boolean c(int i, int j, int k) { - //CraftBukkit start + public boolean d(int i, int j, int k) { + // CraftBukkit start if (this.a instanceof EntityPlayer){ CraftServer server = ((WorldServer) this.b).getServer(); org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k); @@ -97,23 +115,24 @@ public class ItemInWorldManager { return true; } } - //CraftBukkit end + // CraftBukkit end int l = this.b.getTypeId(i, j, k); int i1 = this.b.getData(i, j, k); - boolean flag = this.b(i, j, k); - ItemStack itemstack = this.a.P(); + boolean flag = this.c(i, j, k); + ItemStack itemstack = this.a.z(); if (itemstack != null) { itemstack.a(l, i, j, k); if (itemstack.count == 0) { itemstack.a(this.a); - this.a.Q(); + this.a.A(); } } if (flag && this.a.b(Block.byId[l])) { - Block.byId[l].g(this.b, i, j, k, i1); + Block.byId[l].a_(this.b, i, j, k, i1); + ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b))); } return flag; diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 58f0c37ef5..365b5fc484 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -72,9 +72,9 @@ public final class ItemStack { } public void b(NBTTagCompound nbttagcompound) { - this.id = nbttagcompound.c("id"); - this.count = nbttagcompound.b("Count"); - this.damage = nbttagcompound.c("Damage"); + this.id = nbttagcompound.d("id"); + this.count = nbttagcompound.c("Count"); + this.damage = nbttagcompound.d("Damage"); } public int b() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index bcb9ebc24e..79911fe8e5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -24,7 +24,7 @@ import org.bukkit.event.Event; import org.bukkit.event.world.WorldEvent; //CraftBukkit end -public class MinecraftServer implements ICommandListener, Runnable { +public class MinecraftServer implements Runnable, ICommandListener { public static Logger a = Logger.getLogger("Minecraft"); public static HashMap b = new HashMap(); @@ -32,13 +32,14 @@ public class MinecraftServer implements ICommandListener, Runnable { public PropertyManager d; //public WorldServer e; // Craftbukkit - removed public ServerConfigurationManager f; - private boolean o = true; + private ConsoleCommandHandler o; + private boolean p = true; public boolean g = false; int h = 0; public String i; public int j; - private List p = new ArrayList(); - private List q = Collections.synchronizedList(new ArrayList()); + private List q = new ArrayList(); + private List r = Collections.synchronizedList(new ArrayList()); public EntityTracker k; public boolean l; public boolean m; @@ -58,6 +59,7 @@ public class MinecraftServer implements ICommandListener, Runnable { } private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException + this.o = new ConsoleCommandHandler(this); ThreadCommandReader threadcommandreader = new ThreadCommandReader(this); threadcommandreader.setDaemon(true); @@ -69,7 +71,7 @@ public class MinecraftServer implements ICommandListener, Runnable { System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true)); // Craftbukkit end - a.info("Starting minecraft server version Beta 1.2_01"); + a.info("Starting minecraft server version Beta 1.3"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { a.warning("**** NOT ENOUGH RAM!"); a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); @@ -111,21 +113,27 @@ public class MinecraftServer implements ICommandListener, Runnable { this.f = new ServerConfigurationManager(this); this.k = new EntityTracker(this); + long j = System.nanoTime(); String s1 = this.d.a("level-name", "world"); a.info("Preparing level \"" + s1 + "\""); - this.c(s1); - a.info("Done! For help, type \"help\" or \"?\""); + this.a((Convertable) (new WorldLoaderServer(new File("."))), s1); + a.info("Done (" + (System.nanoTime() - j) + "ns)! For help, type \"help\" or \"?\""); return true; } - private void c(String s) { + private void a(Convertable convertable, String s) { + if (convertable.a(s)) { + a.info("Converting map!"); + convertable.a(s, new ConvertProgressUpdater(this)); + } + a.info("Preparing start region"); // Craftbukkit start - WorldServer world = new WorldServer(this, new File("."), 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); world.a(new WorldManager(this, world)); - world.k = this.d.a("spawn-monsters", true) ? 1 : 0; + world.j = this.d.a("spawn-monsters", true) ? 1 : 0; world.a(this.d.a("spawn-monsters", true), this.m); this.f.a(world); worlds.add(world); @@ -133,9 +141,10 @@ public class MinecraftServer implements ICommandListener, Runnable { short short1 = 196; long i = System.currentTimeMillis(); + ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // Craftbukkit - for (int j = -short1; j <= short1 && this.o; j += 16) { - for (int k = -short1; k <= short1 && this.o; k += 16) { + for (int j = -short1; j <= short1 && this.p; j += 16) { + for (int k = -short1; k <= short1 && this.p; k += 16) { long l = System.currentTimeMillis(); if (l < i) { @@ -152,9 +161,9 @@ public class MinecraftServer implements ICommandListener, Runnable { // Craftbukkit start for (WorldServer worldserver : worlds) { - world.A.d(world.spawnX + j >> 4, world.spawnZ + k >> 4); + world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); - while (world.d() && this.o) { + while (world.e() && this.p) { ; } } @@ -184,6 +193,7 @@ public class MinecraftServer implements ICommandListener, Runnable { // Craftbukkit start for (WorldServer world : worlds) { world.a(true, (IProgressUpdate) null); + world.r(); Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() ); server.getPluginManager().callEvent( worldSaved ); @@ -209,16 +219,15 @@ public class MinecraftServer implements ICommandListener, Runnable { } public void a() { - this.o = false; + this.p = false; } public void run() { try { if (this.d()) { long i = System.currentTimeMillis(); - long j = 0L; - while (this.o) { + for (long j = 0L; this.p; Thread.sleep(1L)) { long k = System.currentTimeMillis(); long l = k - i; @@ -234,16 +243,18 @@ public class MinecraftServer implements ICommandListener, Runnable { j += l; i = k; - - while (j > 50L) { - j -= 50L; + if (this.worlds.size() > 0 && this.worlds.get(0).q()) { // Craftbukkit - TODO - Replace with loop? this.h(); + j = 0L; + } else { + while (j > 50L) { + j -= 50L; + this.h(); + } } - - Thread.sleep(1L); } } else { - while (this.o) { + while (this.p) { this.b(); try { @@ -253,11 +264,11 @@ public class MinecraftServer implements ICommandListener, Runnable { } } } - } catch (Exception exception) { - exception.printStackTrace(); - a.log(Level.SEVERE, "Unexpected exception", exception); + } catch (Throwable throwable) { + throwable.printStackTrace(); + a.log(Level.SEVERE, "Unexpected exception", throwable); - while (this.o) { + while (this.p) { this.b(); try { @@ -270,6 +281,8 @@ public class MinecraftServer implements ICommandListener, Runnable { try { this.g(); this.g = true; + } catch (Throwable throwable1) { + throwable1.printStackTrace(); } finally { System.exit(0); } @@ -305,20 +318,20 @@ public class MinecraftServer implements ICommandListener, Runnable { 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.e))); + entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.k()))); } } ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h); for (WorldServer world : worlds) { - world.f(); + world.g(); - while (world.d()) { + while (world.e()) { ; } - world.c(); + world.d(); } // Craftbukkit end @@ -326,8 +339,8 @@ public class MinecraftServer implements ICommandListener, Runnable { this.f.b(); this.k.a(); - for (j = 0; j < this.p.size(); ++j) { - ((IUpdatePlayerListBox) this.p.get(j)).a(); + for (j = 0; j < this.q.size(); ++j) { + ((IUpdatePlayerListBox) this.q.get(j)).a(); } try { @@ -338,236 +351,25 @@ public class MinecraftServer implements ICommandListener, Runnable { } public void a(String s, ICommandListener icommandlistener) { - this.q.add(new ServerCommand(s, icommandlistener)); + this.r.add(new ServerCommand(s, icommandlistener)); } public void b() { - while (this.q.size() > 0) { - ServerCommand servercommand = (ServerCommand) this.q.remove(0); - String s = servercommand.a; - ICommandListener icommandlistener = servercommand.b; - String s1 = icommandlistener.c(); + while (this.r.size() > 0) { + ServerCommand servercommand = (ServerCommand) this.r.remove(0); // Craftbukkit start - if (server.dispatchCommand(console, s)) { + if (server.dispatchCommand(console, servercommand.a)) { continue; } // Craftbukkit end - - if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) { - if (s.toLowerCase().startsWith("list")) { - icommandlistener.b("Connected players: " + this.f.c()); - } else if (s.toLowerCase().startsWith("stop")) { - this.a(s1, "Stopping the server.."); - this.o = false; - } else if (s.toLowerCase().startsWith("save-all")) { - this.a(s1, "Forcing save.."); - - // Craftbukkit start - for (WorldServer world : worlds) { - world.a(true, (IProgressUpdate) null); - - Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() ); - server.getPluginManager().callEvent( worldSaved ); - } - - this.f.d(); - // Craftbukkit end - - this.a(s1, "Save complete."); - } else if (s.toLowerCase().startsWith("save-off")) { - this.a(s1, "Disabling level saving.."); - - // Craftbukkit start - for (WorldServer world : worlds) { - world.C = true; - } - // Craftbukkit end - } else if (s.toLowerCase().startsWith("save-on")) { - this.a(s1, "Enabling level saving.."); - - // Craftbukkit start - for (WorldServer world : worlds) { - world.C = false; - } - // Craftbukkit end - } else { - String s2; - - if (s.toLowerCase().startsWith("op ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.e(s2); - this.a(s1, "Opping " + s2); - this.f.a(s2, "\u00A7eYou are now op!"); - } else if (s.toLowerCase().startsWith("deop ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.f(s2); - this.f.a(s2, "\u00A7eYou are no longer op!"); - this.a(s1, "De-opping " + s2); - } else if (s.toLowerCase().startsWith("ban-ip ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.c(s2); - this.a(s1, "Banning ip " + s2); - } else if (s.toLowerCase().startsWith("pardon-ip ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.d(s2); - this.a(s1, "Pardoning ip " + s2); - } else { - EntityPlayer entityplayer; - - if (s.toLowerCase().startsWith("ban ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.a(s2); - this.a(s1, "Banning " + s2); - entityplayer = this.f.h(s2); - if (entityplayer != null) { - entityplayer.a.a("Banned by admin"); - } - } else if (s.toLowerCase().startsWith("pardon ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - this.f.b(s2); - this.a(s1, "Pardoning " + s2); - } else if (s.toLowerCase().startsWith("kick ")) { - s2 = s.substring(s.indexOf(" ")).trim(); - entityplayer = null; - - for (int i = 0; i < this.f.b.size(); ++i) { - EntityPlayer entityplayer1 = (EntityPlayer) this.f.b.get(i); - - if (entityplayer1.name.equalsIgnoreCase(s2)) { - entityplayer = entityplayer1; - } - } - - if (entityplayer != null) { - entityplayer.a.a("Kicked by admin"); - this.a(s1, "Kicking " + entityplayer.name); - } else { - icommandlistener.b("Can\'t find user " + s2 + ". No kick."); - } - } else { - String[] astring; - EntityPlayer entityplayer2; - - if (s.toLowerCase().startsWith("tp ")) { - astring = s.split(" "); - if (astring.length == 3) { - entityplayer = this.f.h(astring[1]); - entityplayer2 = this.f.h(astring[2]); - if (entityplayer == null) { - icommandlistener.b("Can\'t find user " + astring[1] + ". No tp."); - } else if (entityplayer2 == null) { - icommandlistener.b("Can\'t find user " + astring[2] + ". No tp."); - } else { - entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch); - this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + "."); - } - } else { - icommandlistener.b("Syntax error, please provice a source and a target."); - } - } else if (s.toLowerCase().startsWith("give ")) { - astring = s.split(" "); - if (astring.length != 3 && astring.length != 4) { - return; - } - - String s3 = astring[1]; - - entityplayer2 = this.f.h(s3); - if (entityplayer2 != null) { - try { - int j = Integer.parseInt(astring[2]); - - if (Item.byId[j] != null) { - this.a(s1, "Giving " + entityplayer2.name + " some " + j); - int k = 1; - - if (astring.length > 3) { - k = this.b(astring[3], 1); - } - - if (k < 1) { - k = 1; - } - - if (k > 64) { - k = 64; - } - - entityplayer2.b(new ItemStack(j, k, 0)); - } else { - icommandlistener.b("There\'s no item with id " + j); - } - } catch (NumberFormatException numberformatexception) { - icommandlistener.b("There\'s no item with id " + astring[2]); - } - } else { - icommandlistener.b("Can\'t find user " + s3); - } - } else if (s.toLowerCase().startsWith("say ")) { - s = s.substring(s.indexOf(" ")).trim(); - a.info("[" + s1 + "] " + s); - this.f.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s))); - } else if (s.toLowerCase().startsWith("tell ")) { - astring = s.split(" "); - if (astring.length >= 3) { - s = s.substring(s.indexOf(" ")).trim(); - s = s.substring(s.indexOf(" ")).trim(); - a.info("[" + s1 + "->" + astring[1] + "] " + s); - s = "\u00A77" + s1 + " whispers " + s; - a.info(s); - if (!this.f.a(astring[1], (Packet) (new Packet3Chat(s)))) { - icommandlistener.b("There\'s no player by that name online."); - } - } - } else { - a.info("Unknown console command. Type \"help\" for help."); - } - } - } - } - } else { - icommandlistener.b("To run the server without a gui, start it like this:"); - icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui"); - icommandlistener.b("Console commands:"); - icommandlistener.b(" help or ? shows this message"); - icommandlistener.b(" kick removes a player from the server"); - icommandlistener.b(" ban bans a player from the server"); - icommandlistener.b(" pardon pardons a banned player so that they can connect again"); - icommandlistener.b(" ban-ip bans an IP address from the server"); - icommandlistener.b(" pardon-ip pardons a banned IP address so that they can connect again"); - icommandlistener.b(" op turns a player into an op"); - icommandlistener.b(" deop removes op status from a player"); - icommandlistener.b(" tp moves one player to the same location as another player"); - icommandlistener.b(" give [num] gives a player a resource"); - icommandlistener.b(" tell sends a private message to a player"); - icommandlistener.b(" stop gracefully stops the server"); - icommandlistener.b(" save-all forces a server-wide level save"); - icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)"); - icommandlistener.b(" save-on re-enables terrain saving"); - icommandlistener.b(" list lists all currently connected players"); - icommandlistener.b(" say broadcasts a message to all players"); - } - } - } - - private void a(String s, String s1) { - String s2 = s + ": " + s1; - - this.f.i("\u00A77(" + s2 + ")"); - a.info(s2); - } - - private int b(String s, int i) { - try { - return Integer.parseInt(s); - } catch (NumberFormatException numberformatexception) { - return i; + + this.o.a(servercommand); } } public void a(IUpdatePlayerListBox iupdateplayerlistbox) { - this.p.add(iupdateplayerlistbox); + this.q.add(iupdateplayerlistbox); } public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[]) @@ -595,6 +397,6 @@ public class MinecraftServer implements ICommandListener, Runnable { } public static boolean a(MinecraftServer minecraftserver) { - return minecraftserver.o; + return minecraftserver.p; } } diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 0714d8ce1a..de7f937928 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 != 8) { - if (packet1login.a > 8) { + if (packet1login.a != 9) { + if (packet1login.a > 9) { this.a("Outdated server!"); } else { this.a("Outdated client!"); @@ -80,13 +80,14 @@ public class NetLoginHandler extends NetHandler { NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer); // Craftbukkit start - netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.u, (byte) entityplayer.world.q.g))); - netserverhandler.b((Packet) (new Packet6SpawnPosition(entityplayer.world.spawnX, entityplayer.world.spawnY, entityplayer.world.spawnZ))); + ChunkCoordinates chunkcoordinates = entityplayer.world.l(); + netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (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."))); 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.e))); + netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k()))); // Craftbukkit end entityplayer.l(); diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index ec8cabb48b..408b980a48 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -30,12 +30,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public boolean c = false; private MinecraftServer d; public EntityPlayer e; // Craftbukkit - public - private int f = 0; - private double g; - private double h; + private int f; + private int g; + private boolean h; private double i; - private boolean j = true; - private Map k = new HashMap(); + private double j; + private double k; + private boolean l = true; + private Map m = new HashMap(); public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.d = minecraftserver; @@ -64,9 +66,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit end public void a() { + this.h = false; this.b.a(); - if (this.f++ % 20 == 0) { - this.b.a((Packet) (new Packet0KeepAlive())); + if (this.f - this.g > 20) { + this.b((Packet) (new Packet0KeepAlive())); } } @@ -80,28 +83,32 @@ public class NetServerHandler extends NetHandler implements ICommandListener { return; } // Send the possibly modified leave message - this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() ))); - this.d.f.c(this.e); this.b.a((Packet) (new Packet255KickDisconnect( kickEvent.getReason() ))); - // CraftBukkit end - this.b.c(); + this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() ))); + // CraftBukkit end + this.d.f.c(this.e); this.c = true; } + public void a(Packet27 packet27) { + this.e.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f()); + } + public void a(Packet10Flying packet10flying) { + this.h = true; double d0; - if (!this.j) { - d0 = packet10flying.b - this.h; - if (packet10flying.a == this.g && d0 * d0 < 0.01D && packet10flying.c == this.i) { - this.j = true; + if (!this.l) { + d0 = packet10flying.b - this.j; + if (packet10flying.a == this.i && d0 * d0 < 0.01D && packet10flying.c == this.k) { + this.l = true; } } // CraftBukkit start Player player = getPlayer(); - Location from = new Location(player.getWorld(), g, h, i, this.e.yaw, this.e.pitch); + Location from = new Location(player.getWorld(), i, j, k, this.e.yaw, this.e.pitch); Location to = player.getLocation(); if (!from.equals(to)) { PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to); @@ -118,7 +125,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } // CraftBukkit end - if (this.j) { + if (this.l) { double d1; double d2; double d3; @@ -128,7 +135,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { float f = this.e.yaw; float f1 = this.e.pitch; - this.e.vehicle.E(); + this.e.vehicle.h_(); d1 = this.e.locX; d2 = this.e.locY; d3 = this.e.locZ; @@ -146,7 +153,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } this.e.onGround = packet10flying.g; - this.e.n(); + this.e.a(true); this.e.c(d5, 0.0D, d4); this.e.b(d1, d2, d3, f, f1); this.e.motX = d5; @@ -156,21 +163,21 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } if (this.e.vehicle != null) { - this.e.vehicle.E(); + this.e.vehicle.h_(); } this.d.f.b(this.e); - this.g = this.e.locX; - this.h = this.e.locY; - this.i = this.e.locZ; - this.e.world.f(this.e); + this.i = this.e.locX; + this.j = this.e.locY; + this.k = this.e.locZ; + this.e.world.f(this.e); // Craftbukkit return; } d0 = this.e.locY; - this.g = this.e.locX; - this.h = this.e.locY; - this.i = this.e.locZ; + this.i = this.e.locX; + this.j = this.e.locY; + this.k = this.e.locZ; d1 = this.e.locX; d2 = this.e.locY; d3 = this.e.locZ; @@ -190,8 +197,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.a("Illegal stance"); a.warning(this.e.name + " had an illegal stance: " + d4); } - - this.e.al = packet10flying.d; } if (packet10flying.i) { @@ -199,9 +204,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { f3 = packet10flying.f; } - this.e.n(); - this.e.R = 0.0F; - this.e.b(this.g, this.h, this.i, f2, f3); + this.e.a(true); + this.e.bl = 0.0F; + this.e.b(this.i, this.j, this.k, f2, f3); d4 = d1 - this.e.locX; double d6 = d2 - this.e.locY; double d7 = d3 - this.e.locZ; @@ -219,7 +224,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { double d8 = d4 * d4 + d6 * d6 + d7 * d7; boolean flag1 = false; - if (d8 > 0.0625D) { + if (d8 > 0.0625D && !this.e.E()) { flag1 = true; a.warning(this.e.name + " moved wrongly!"); System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); @@ -229,8 +234,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.e.b(d1, d2, d3, f2, f3); boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit - if (flag && (flag1 || !flag2)) { - this.a(this.g, this.h, this.i, f2, f3); + if (flag && (flag1 || !flag2) && !this.e.E()) { + this.a(this.i, this.j, this.k, f2, f3); return; } @@ -258,26 +263,26 @@ public class NetServerHandler extends NetHandler implements ICommandListener { f1 = to.getPitch(); // CraftBukkit end - this.j = false; - this.g = d0; - this.h = d1; - this.i = d2; + this.l = false; + this.i = d0; + this.j = d1; + this.k = d2; this.e.b(d0, d1, d2, f, f1); this.e.a.b((Packet) (new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false))); } public void a(Packet14BlockDig packet14blockdig) { if (packet14blockdig.e == 4) { - this.e.O(); + this.e.y(); } else { - boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit + boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit boolean flag1 = false; if (packet14blockdig.e == 0) { flag1 = true; } - if (packet14blockdig.e == 1) { + if (packet14blockdig.e == 2) { flag1 = true; } @@ -294,19 +299,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (d3 > 36.0D) { return; } - - double d4 = this.e.locY; - - this.e.locY = this.e.al; - this.e.locY = d4; } - int l = packet14blockdig.d; - int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit - int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit + ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit + int l = (int) MathHelper.e((float) (i - chunkcoordinates.a)); + int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); - if (i1 > j1) { - j1 = i1; + if (l > i1) { + i1 = l; } // CraftBukkit start @@ -321,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (packet14blockdig.e == 0) { // CraftBukkit start - if (j1 > this.d.spawnProtection || flag) { + if (i1 > this.d.spawnProtection || flag) { if (blockId > 0) { BlockDamageEvent event; // If the amount of damage that the player is going to do to the block @@ -351,16 +351,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener { BlockDamageEvent event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { - this.e.c.a(); + this.e.c.b(i, j, k); } // CraftBukkit end } else if (packet14blockdig.e == 1) { // CraftBukkit start - if (j1 > this.d.spawnProtection || flag) { + if (i1 > this.d.spawnProtection || flag) { BlockDamageEvent event; // If the amount of damage going to the block plus the current amount // of damage is greater than 1, the block is going to break. - if (e.c.d + damage >= 1.0F) { + if (e.c.c + damage >= 1.0F) { // if we are destroying either a redstone wire with a current greater than 0 or // a redstone torch that is on, then we should notify plugins that this block has // returned to a current value of 0 (since it will once the redstone is destroyed) @@ -372,37 +372,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener { event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player); } server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - this.e.c.a(i, j, k, l); - } else { - e.c.d = 0; // Reset the amount of damage if stopping break. + if (event.isCancelled()) { + e.c.c = 0; // Reset the amount of damage if stopping break. } } - // CraftBukkit end } else if (packet14blockdig.e == 3) { - double d5 = this.e.locX - ((double) i + 0.5D); - double d6 = this.e.locY - ((double) j + 0.5D); - double d7 = this.e.locZ - ((double) k + 0.5D); - double d8 = d5 * d5 + d6 * d6 + d7 * d7; + double d4 = this.e.locX - ((double) i + 0.5D); + double d5 = this.e.locY - ((double) j + 0.5D); + double d6 = this.e.locZ - ((double) k + 0.5D); + double d7 = d4 * d4 + d5 * d5 + d6 * d6; - if (d8 < 256.0D) { - this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); // Craftbukkit + if (d7 < 256.0D) { + this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); } } - // CraftBukkit start lastX = i; lastY = j; lastZ = k; - // CraftBukkit end - ((WorldServer)this.e.world).B = false; // Craftbukkit + ((WorldServer)this.e.world).v = false; + // CraftBukkit end } } public void a(Packet15Place packet15place) { - ItemStack itemstack = this.e.inventory.e(); - boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit + ItemStack itemstack = this.e.inventory.b(); + boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit // CraftBukkit start CraftBlock blockClicked = null; @@ -475,8 +471,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { int j = packet15place.b; int k = packet15place.c; int l = packet15place.d; - int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit - int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit + ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit + int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a)); + int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); if (i1 > j1) { j1 = i1; @@ -523,18 +520,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.e.inventory.a[this.e.inventory.c] = null; } - this.e.am = true; + this.e.h = true; this.e.inventory.a[this.e.inventory.c] = ItemStack.b(this.e.inventory.a[this.e.inventory.c]); Slot slot = this.e.activeContainer.a(this.e.inventory, this.e.inventory.c); this.e.activeContainer.a(); - this.e.am = false; + this.e.h = false; - if (!ItemStack.a(this.e.inventory.e(), packet15place.e) || always) { // CraftBukkit - this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.c, this.e.inventory.e()))); + if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) { // CraftBukkit + this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.a, this.e.inventory.b()))); } - ((WorldServer)this.e.world).B = false; // Craftbukkit + ((WorldServer)this.e.world).v = false; // Craftbukkit } public void a(String s, Object[] aobject) { @@ -551,6 +548,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void b(Packet packet) { this.b.a(packet); + this.g = this.f; } public void a(Packet16BlockItemSwitch packet16blockitemswitch) { @@ -664,7 +662,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } else { String s1; - if (this.d.f.g(this.e.name)) { + 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); @@ -683,7 +681,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { server.getPluginManager().callEvent(event); // CraftBukkit end - this.e.K(); + this.e.r(); } } @@ -703,6 +701,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.e.b(true); } else if (packet19entityaction.b == 2) { this.e.b(false); + } else if (packet19entityaction.b == 3) { + this.e.a(false, true); + this.l = false; } } @@ -725,11 +726,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(Packet7UseEntity packet7useentity) { Entity entity = ((WorldServer)this.e.world).a(packet7useentity.b); // Craftbukkit - if (entity != null && this.e.i(entity)) { + if (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) { if (packet7useentity.c == 0) { - this.e.g(entity); + this.e.c(entity); } else if (packet7useentity.c == 1) { - this.e.h(entity); + this.e.d(entity); } } } @@ -746,7 +747,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet101CloseWindow packet101closewindow) { - this.e.N(); + this.e.v(); } public void a(Packet102WindowClick packet102windowclick) { @@ -755,18 +756,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (ItemStack.a(packet102windowclick.e, itemstack)) { this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true))); - this.e.am = true; + this.e.h = true; this.e.activeContainer.a(); - this.e.M(); - this.e.am = false; + this.e.u(); + this.e.h = false; } else { - this.k.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d)); + this.m.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d)); this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false))); this.e.activeContainer.a(this.e, false); ArrayList arraylist = new ArrayList(); for (int i = 0; i < this.e.activeContainer.e.size(); ++i) { - arraylist.add(((Slot) this.e.activeContainer.e.get(i)).c()); + arraylist.add(((Slot) this.e.activeContainer.e.get(i)).b()); } this.e.a(this.e.activeContainer, arraylist); @@ -775,7 +776,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet106Transaction packet106transaction) { - Short oshort = (Short) this.k.get(Integer.valueOf(this.e.activeContainer.f)); + Short oshort = (Short) this.m.get(Integer.valueOf(this.e.activeContainer.f)); if (oshort != null && packet106transaction.b == oshort.shortValue() && this.e.activeContainer.f == packet106transaction.a && !this.e.activeContainer.c(this.e)) { this.e.activeContainer.a(this.e, true); @@ -828,10 +829,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit end for (int l = 0; l < 4; ++l) { - tileentitysign.e[l] = modifyEvent.getLine(l); // CraftBukkit + tileentitysign.a[l] = modifyEvent.getLine(l); // CraftBukkit } - tileentitysign.d(); + tileentitysign.h(); this.e.world.g(i, k, j); // Craftbukkit } } diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java index 95b8467c70..7e326b0aba 100644 --- a/src/main/java/net/minecraft/server/PlayerInstance.java +++ b/src/main/java/net/minecraft/server/PlayerInstance.java @@ -29,14 +29,14 @@ class PlayerInstance { this.d = j; this.e = new ChunkCoordIntPair(i, j); - playermanager.world.A.d(i, j); // Craftbukkit + playermanager.world.u.d(i, j); // Craftbukkit } public void a(EntityPlayer entityplayer) { if (this.b.contains(entityplayer)) { throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.c + ", " + this.d); } else { - entityplayer.ak.add(this.e); + entityplayer.g.add(this.e); entityplayer.a.b((Packet) (new Packet50PreChunk(this.e.a, this.e.b, true))); this.b.add(entityplayer); entityplayer.f.add(this.e); @@ -56,11 +56,11 @@ class PlayerInstance { PlayerManager.c(this.a).remove(this); } - ((WorldServer)entityplayer.world).A.c(this.c, this.d); // Craftbukkit + ((WorldServer)entityplayer.world).u.c(this.c, this.d); // Craftbukkit } entityplayer.f.remove(this.e); - if (entityplayer.ak.contains(this.e)) { + if (entityplayer.g.contains(this.e)) { entityplayer.a.b((Packet) (new Packet50PreChunk(this.c, this.d, false))); } } @@ -115,7 +115,7 @@ class PlayerInstance { for (int i = 0; i < this.b.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); - if (entityplayer.ak.contains(this.e)) { + if (entityplayer.g.contains(this.e)) { entityplayer.a.b(packet); } } @@ -178,7 +178,7 @@ class PlayerInstance { private void a(TileEntity tileentity) { if (tileentity != null) { - Packet packet = tileentity.g(); + Packet packet = tileentity.e(); if (packet != null) { this.a(packet); diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index ca71a459c5..0693928f28 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -9,6 +9,7 @@ public class PlayerManager { private PlayerList b = new PlayerList(); private List c = new ArrayList(); private MinecraftServer d; + private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}}; public WorldServer world; // Craftbukkit // Craftbukkit - change of method signature @@ -26,8 +27,7 @@ public class PlayerManager { this.c.clear(); } - // Craftbukkit - method signature changed! - private PlayerInstance a(int i, int j, boolean flag, WorldServer world) { + private PlayerInstance a(int i, int j, boolean flag) { long k = (long) i + 2147483647L | (long) j + 2147483647L << 32; PlayerInstance playerinstance = (PlayerInstance) this.b.a(k); @@ -39,63 +39,50 @@ public class PlayerManager { return playerinstance; } - // Craftbukkit - method signature changed! - public void a(int i, int j, int k, WorldServer world) { + public void a(int i, int j, int k) { int l = i >> 4; int i1 = k >> 4; - PlayerInstance playerinstance = this.a(l, i1, false, world); + PlayerInstance playerinstance = this.a(l, i1, false); if (playerinstance != null) { playerinstance.a(i & 15, j, k & 15); } } - // CraftBukkit start - private final int[][] direction = new int[][] { - { 1, 0 }, - { 0, 1 }, - { -1, 0 }, - { 0, -1 }, - }; - // CraftBukkit end - public void a(EntityPlayer entityplayer) { int i = (int) entityplayer.locX >> 4; int j = (int) entityplayer.locZ >> 4; entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; + int k = 0; + byte b0 = 10; + int l = 0; + int i1 = 0; - // CraftBukkit start - int facing = 0; - int size = 10; - int dx = 0; - int dz = 0; + this.a(i, j, true).a(entityplayer); - // Origin - this.a(i, j, true, ((WorldServer)entityplayer.world)).a(entityplayer); + int j1; - // All but the last leg - for (int legSize = 1; legSize <= size * 2; legSize++) { - for (int leg = 0; leg < 2; leg++) { - int[] dir = direction[ facing++ % 4 ]; + for (j1 = 1; j1 <= b0 * 2; ++j1) { + for (int k1 = 0; k1 < 2; ++k1) { + int[] aint = this.e[k++ % 4]; - for (int k = 0; k < legSize; k++ ) { - dx += dir[0]; - dz += dir[1]; - this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit + for (int l1 = 0; l1 < j1; ++l1) { + l += aint[0]; + i1 += aint[1]; + this.a(i + l, j + i1, true).a(entityplayer); } } } - // Final leg - facing %= 4; - for (int k = 0; k < size * 2; k++) { - dx += direction[facing][0]; - dz += direction[facing][1]; - this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); + k %= 4; + + for (j1 = 0; j1 < b0 * 2; ++j1) { + l += this.e[k][0]; + i1 += this.e[k][1]; + this.a(i + l, j + i1, true).a(entityplayer); } - // CraftBukkit end this.a.add(entityplayer); } @@ -106,7 +93,7 @@ public class PlayerManager { for (int k = i - 10; k <= i + 10; ++k) { for (int l = j - 10; l <= j + 10; ++l) { - PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world)); // Craftbukkit + PlayerInstance playerinstance = this.a(k, l, false); if (playerinstance != null) { playerinstance.b(entityplayer); @@ -141,11 +128,11 @@ public class PlayerManager { for (int k1 = i - 10; k1 <= i + 10; ++k1) { for (int l1 = j - 10; l1 <= j + 10; ++l1) { if (!this.a(k1, l1, k, l)) { - this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit + this.a(k1, l1, true).a(entityplayer); } if (!this.a(k1 - i1, l1 - j1, i, j)) { - PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world)); // Craftbukkit + PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false); if (playerinstance != null) { playerinstance.b(entityplayer); diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java index 4c7415373e..ef7569d284 100644 --- a/src/main/java/net/minecraft/server/PropertyManager.java +++ b/src/main/java/net/minecraft/server/PropertyManager.java @@ -90,4 +90,10 @@ public class PropertyManager { return flag; } } + + public void b(String s, boolean flag) { + flag = getOverride(s, flag); // CraftBukkit + this.b.setProperty(s, "" + flag); + this.b(); + } } diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 1de040ef71..273d1803ac 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -34,10 +34,13 @@ public class ServerConfigurationManager { private Set f = new HashSet(); private Set g = new HashSet(); private Set h = new HashSet(); - private File i; + private Set i = new HashSet(); private File j; private File k; - private PlayerNBTManager l; + private File l; + private File m; + private PlayerFileData n; + private boolean o; // CraftBukkit start private CraftServer server; @@ -48,23 +51,27 @@ public class ServerConfigurationManager { // CraftBukkit end this.c = minecraftserver; - this.i = minecraftserver.a("banned-players.txt"); - this.j = minecraftserver.a("banned-ips.txt"); - this.k = minecraftserver.a("ops.txt"); + this.j = minecraftserver.a("banned-players.txt"); + this.k = minecraftserver.a("banned-ips.txt"); + this.l = minecraftserver.a("ops.txt"); + this.m = minecraftserver.a("white-list.txt"); // this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed! this.e = minecraftserver.d.a("max-players", 20); - this.e(); + this.o = minecraftserver.d.a("white-list", false); this.g(); this.i(); - this.f(); + this.k(); + this.m(); this.h(); this.j(); + this.l(); + this.n(); } public void a(WorldServer worldserver) { // Craftbukkit start - if (this.l == null) { - this.l = new PlayerNBTManager(new File(worldserver.t, "players")); + if (this.n == null) { + this.n = worldserver.m().d(); } // Craftbukkit end } @@ -75,10 +82,10 @@ public class ServerConfigurationManager { public void a(EntityPlayer entityplayer) { this.b.add(entityplayer); - this.l.b(entityplayer); + this.n.b(entityplayer); // Craftbukkit start - ((WorldServer)entityplayer.world).A.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); + ((WorldServer)entityplayer.world).u.d((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); @@ -97,7 +104,7 @@ public class ServerConfigurationManager { } public void c(EntityPlayer entityplayer) { - this.l.a(entityplayer); + this.n.a(entityplayer); entityplayer.world.d(entityplayer); // Craftbukkit this.b.remove(entityplayer); @@ -123,6 +130,8 @@ public class ServerConfigurationManager { if (this.f.contains(s.trim().toLowerCase())) { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!"); + } else if (!this.g(s)) { + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are not white-listed on this server!"); } else if (this.g.contains(s2)) { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!"); } else if (this.b.size() >= this.e) { @@ -158,7 +167,7 @@ public class ServerConfigurationManager { entityplayer1.id = entityplayer.id; entityplayer1.a = entityplayer.a; - ((WorldServer)entityplayer.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); + ((WorldServer)entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) { entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); @@ -177,7 +186,7 @@ public class ServerConfigurationManager { entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch(); entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle()); entityplayer1.c.a = entityplayer1; - ((WorldServer)entityplayer1.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); + ((WorldServer)entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); // CraftBukkit end entityplayer1.a.b((Packet) (new Packet9Respawn())); @@ -186,6 +195,7 @@ public class ServerConfigurationManager { entityplayer.world.a(entityplayer1); this.b.add(entityplayer1); entityplayer1.l(); + entityplayer1.s(); return entityplayer1; // Craftbukkit end } @@ -200,7 +210,7 @@ public class ServerConfigurationManager { // Craftbukkit - changed signature public void a(int i, int j, int k, WorldServer world) { - world.manager.a(i, j, k, world); // Craftbukkit + world.manager.a(i, j, k); } public void a(Packet packet) { @@ -227,18 +237,18 @@ public class ServerConfigurationManager { public void a(String s) { this.f.add(s.toLowerCase()); - this.f(); + this.h(); } public void b(String s) { this.f.remove(s.toLowerCase()); - this.f(); + this.h(); } - private void e() { + private void g() { try { this.f.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(this.i)); + BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j)); String s = ""; while ((s = bufferedreader.readLine()) != null) { @@ -251,9 +261,9 @@ public class ServerConfigurationManager { } } - private void f() { + private void h() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.i, false)); + PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false)); Iterator iterator = this.f.iterator(); while (iterator.hasNext()) { @@ -270,18 +280,18 @@ public class ServerConfigurationManager { public void c(String s) { this.g.add(s.toLowerCase()); - this.h(); + this.j(); } public void d(String s) { this.g.remove(s.toLowerCase()); - this.h(); + this.j(); } - private void g() { + private void i() { try { this.g.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j)); + BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k)); String s = ""; while ((s = bufferedreader.readLine()) != null) { @@ -294,9 +304,9 @@ public class ServerConfigurationManager { } } - private void h() { + private void j() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false)); + PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false)); Iterator iterator = this.g.iterator(); while (iterator.hasNext()) { @@ -313,18 +323,18 @@ public class ServerConfigurationManager { public void e(String s) { this.h.add(s.toLowerCase()); - this.j(); + this.l(); } public void f(String s) { this.h.remove(s.toLowerCase()); - this.j(); + this.l(); } - private void i() { + private void k() { try { this.h.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k)); + BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l)); String s = ""; while ((s = bufferedreader.readLine()) != null) { @@ -337,9 +347,9 @@ public class ServerConfigurationManager { } } - private void j() { + private void l() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false)); + PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false)); Iterator iterator = this.h.iterator(); while (iterator.hasNext()) { @@ -354,11 +364,49 @@ public class ServerConfigurationManager { } } + private void m() { + try { + this.i.clear(); + BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m)); + String s = ""; + + while ((s = bufferedreader.readLine()) != null) { + this.i.add(s.trim().toLowerCase()); + } + + bufferedreader.close(); + } catch (Exception exception) { + a.warning("Failed to load white-list: " + exception); + } + } + + private void n() { + try { + PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false)); + Iterator iterator = this.i.iterator(); + + while (iterator.hasNext()) { + String s = (String) iterator.next(); + + printwriter.println(s); + } + + printwriter.close(); + } catch (Exception exception) { + a.warning("Failed to save white-list: " + exception); + } + } + public boolean g(String s) { + s = s.trim().toLowerCase(); + return !this.o || this.h.contains(s) || this.i.contains(s); + } + + public boolean h(String s) { return this.h.contains(s.trim().toLowerCase()); } - public EntityPlayer h(String s) { + public EntityPlayer i(String s) { for (int i = 0; i < this.b.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); @@ -371,7 +419,7 @@ public class ServerConfigurationManager { } public void a(String s, String s1) { - EntityPlayer entityplayer = this.h(s); + EntityPlayer entityplayer = this.i(s); if (entityplayer != null) { entityplayer.a.b((Packet) (new Packet3Chat(s1))); @@ -391,20 +439,20 @@ public class ServerConfigurationManager { } } - public void i(String s) { + public void j(String s) { Packet3Chat packet3chat = new Packet3Chat(s); for (int i = 0; i < this.b.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); - if (this.g(entityplayer.name)) { + if (this.h(entityplayer.name)) { entityplayer.a.b((Packet) packet3chat); } } } public boolean a(String s, Packet packet) { - EntityPlayer entityplayer = this.h(s); + EntityPlayer entityplayer = this.i(s); if (entityplayer != null) { entityplayer.a.b(packet); @@ -416,9 +464,27 @@ public class ServerConfigurationManager { public void d() { for (int i = 0; i < this.b.size(); ++i) { - this.l.a((EntityPlayer) this.b.get(i)); + this.n.a((EntityHuman) this.b.get(i)); } } public void a(int i, int j, int k, TileEntity tileentity) {} -} + + public void k(String s) { + this.i.add(s); + this.n(); + } + + public void l(String s) { + this.i.remove(s); + this.n(); + } + + public Set e() { + return this.i; + } + + public void f() { + this.m(); + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java index abec2db355..1708ec028c 100644 --- a/src/main/java/net/minecraft/server/Slot.java +++ b/src/main/java/net/minecraft/server/Slot.java @@ -2,49 +2,49 @@ package net.minecraft.server; public class Slot { - public final int a; // CraftBukkit: private -> public - public final IInventory b; // CraftBukkit: private -> public + public final int d; // CraftBukkit: private -> public + public final IInventory e; // CraftBukkit: private -> public + public int a; + public int b; public int c; - public int d; - public int e; public Slot(IInventory iinventory, int i, int j, int k) { - this.b = iinventory; - this.a = i; - this.d = j; - this.e = k; + this.e = iinventory; + this.d = i; + this.b = j; + this.c = k; } - public void b() { - this.d(); + public void a() { + this.c(); } public boolean a(ItemStack itemstack) { return true; } - public ItemStack c() { - return this.b.a(this.a); + public ItemStack b() { + return this.e.c_(this.d); } public void b(ItemStack itemstack) { - this.b.a(this.a, itemstack); - this.d(); + this.e.a(this.d, itemstack); + this.c(); } - public void d() { - this.b.d(); + public void c() { + this.e.h(); } - public int a() { - return this.b.c(); + public int d() { + return this.e.n_(); } public ItemStack a(int i) { - return this.b.b(this.a, i); + return this.e.a(this.d, i); } public boolean a(IInventory iinventory, int i) { - return iinventory == this.b && i == this.a; + return iinventory == this.e && i == this.d; } } diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index 5ce1f87e61..f5d992496b 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -2,40 +2,40 @@ package net.minecraft.server; public class TileEntityChest extends TileEntity implements IInventory { - private ItemStack[] e = new ItemStack[27]; //Craftbukkit + private ItemStack[] a = new ItemStack[27]; //Craftbukkit // CraftBukkit start public ItemStack[] getContents() { - return e; + return a; } // CraftBukkit end public TileEntityChest() {} - public int h_() { - return this.e.length; // Craftbukkit + public int m_() { + return 27; } - public ItemStack a(int i) { - return this.e[i]; + public ItemStack c_(int i) { + return this.a[i]; } - public ItemStack b(int i, int j) { - if (this.e[i] != null) { + public ItemStack a(int i, int j) { + if (this.a[i] != null) { ItemStack itemstack; - if (this.e[i].count <= j) { - itemstack = this.e[i]; - this.e[i] = null; - this.d(); + if (this.a[i].count <= j) { + itemstack = this.a[i]; + this.a[i] = null; + this.h(); return itemstack; } else { - itemstack = this.e[i].a(j); - if (this.e[i].count == 0) { - this.e[i] = null; + itemstack = this.a[i].a(j); + if (this.a[i].count == 0) { + this.a[i] = null; } - this.d(); + this.h(); return itemstack; } } else { @@ -44,30 +44,30 @@ public class TileEntityChest extends TileEntity implements IInventory { } public void a(int i, ItemStack itemstack) { - this.e[i] = itemstack; - if (itemstack != null && itemstack.count > this.c()) { - itemstack.count = this.c(); + this.a[i] = itemstack; + if (itemstack != null && itemstack.count > this.n_()) { + itemstack.count = this.n_(); } - this.d(); + this.h(); } - public String b() { + public String c() { return "Chest"; } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.k("Items"); + NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.e = new ItemStack[this.h_()]; + this.a = new ItemStack[this.m_()]; - for (int i = 0; i < nbttaglist.b(); ++i) { + for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.b("Slot") & 255; + int j = nbttagcompound1.c("Slot") & 255; - if (j >= 0 && j < this.e.length) { - this.e[j] = new ItemStack(nbttagcompound1); + if (j >= 0 && j < this.a.length) { + this.a[j] = new ItemStack(nbttagcompound1); } } } @@ -76,12 +76,12 @@ public class TileEntityChest extends TileEntity implements IInventory { super.b(nbttagcompound); NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < this.e.length; ++i) { - if (this.e[i] != null) { + for (int i = 0; i < this.a.length; ++i) { + if (this.a[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.a("Slot", (byte) i); - this.e[i].a(nbttagcompound1); + this.a[i].a(nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1); } } @@ -89,11 +89,11 @@ public class TileEntityChest extends TileEntity implements IInventory { nbttagcompound.a("Items", (NBTBase) nbttaglist); } - public int c() { + public int n_() { return 64; } public boolean a_(EntityHuman entityhuman) { - return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; + return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D; } } diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java index 251afb5ebd..41a4ab8157 100644 --- a/src/main/java/net/minecraft/server/TileEntityDispenser.java +++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java @@ -1,120 +1,120 @@ -package net.minecraft.server; - -import java.util.Random; - -public class TileEntityDispenser extends TileEntity implements IInventory { - - private ItemStack[] e = new ItemStack[9]; - private Random f = new Random(); - - // CraftBukkit start - public ItemStack[] getContents() { - return e; - } - // CraftBukkit end - - public TileEntityDispenser() {} - - public int h_() { - return this.e.length; //Craftbukkit - } - - public ItemStack a(int i) { - return this.e[i]; - } - - public ItemStack b(int i, int j) { - if (this.e[i] != null) { - ItemStack itemstack; - - if (this.e[i].count <= j) { - itemstack = this.e[i]; - this.e[i] = null; - this.d(); - return itemstack; - } else { - itemstack = this.e[i].a(j); - if (this.e[i].count == 0) { - this.e[i] = null; - } - - this.d(); - return itemstack; - } - } else { - return null; - } - } - - public ItemStack e() { - int i = -1; - int j = 1; - - for (int k = 0; k < this.e.length; ++k) { - if (this.e[k] != null && this.f.nextInt(j) == 0) { - i = k; - ++j; - } - } - - if (i >= 0) { - return this.b(i, 1); - } else { - return null; - } - } - - public void a(int i, ItemStack itemstack) { - this.e[i] = itemstack; - if (itemstack != null && itemstack.count > this.c()) { - itemstack.count = this.c(); - } - - this.d(); - } - - public String b() { - return "Trap"; - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.k("Items"); - - this.e = new ItemStack[this.h_()]; - - for (int i = 0; i < nbttaglist.b(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.b("Slot") & 255; - - if (j >= 0 && j < this.e.length) { - this.e[j] = new ItemStack(nbttagcompound1); - } - } - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.e.length; ++i) { - if (this.e[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - - nbttagcompound1.a("Slot", (byte) i); - this.e[i].a(nbttagcompound1); - nbttaglist.a((NBTBase) nbttagcompound1); - } - } - - nbttagcompound.a("Items", (NBTBase) nbttaglist); - } - - public int c() { - return 64; - } - - public boolean a_(EntityHuman entityhuman) { - return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; - } -} \ No newline at end of file +package net.minecraft.server; + +import java.util.Random; + +public class TileEntityDispenser extends TileEntity implements IInventory { + + private ItemStack[] a = new ItemStack[9]; + private Random b = new Random(); + + // CraftBukkit start + public ItemStack[] getContents() { + return a; + } + // CraftBukkit end + + public TileEntityDispenser() {} + + public int m_() { + return 9; + } + + public ItemStack c_(int i) { + return this.a[i]; + } + + public ItemStack a(int i, int j) { + if (this.a[i] != null) { + ItemStack itemstack; + + if (this.a[i].count <= j) { + itemstack = this.a[i]; + this.a[i] = null; + this.h(); + return itemstack; + } else { + itemstack = this.a[i].a(j); + if (this.a[i].count == 0) { + this.a[i] = null; + } + + this.h(); + return itemstack; + } + } else { + return null; + } + } + + public ItemStack b() { + int i = -1; + int j = 1; + + for (int k = 0; k < this.a.length; ++k) { + if (this.a[k] != null && this.b.nextInt(j) == 0) { + i = k; + ++j; + } + } + + if (i >= 0) { + return this.a(i, 1); + } else { + return null; + } + } + + public void a(int i, ItemStack itemstack) { + this.a[i] = itemstack; + if (itemstack != null && itemstack.count > this.n_()) { + itemstack.count = this.n_(); + } + + this.h(); + } + + public String c() { + return "Trap"; + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + NBTTagList nbttaglist = nbttagcompound.l("Items"); + + this.a = new ItemStack[this.m_()]; + + for (int i = 0; i < nbttaglist.c(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); + int j = nbttagcompound1.c("Slot") & 255; + + if (j >= 0 && j < this.a.length) { + this.a[j] = new ItemStack(nbttagcompound1); + } + } + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.a.length; ++i) { + if (this.a[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + + nbttagcompound1.a("Slot", (byte) i); + this.a[i].a(nbttagcompound1); + nbttaglist.a((NBTBase) nbttagcompound1); + } + } + + nbttagcompound.a("Items", (NBTBase) nbttaglist); + } + + public int n_() { + return 64; + } + + public boolean a_(EntityHuman entityhuman) { + return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D; + } +} diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 4111ae6f21..f500d8bb20 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -3,9 +3,9 @@ package net.minecraft.server; public class TileEntityFurnace extends TileEntity implements IInventory { private ItemStack[] h = new ItemStack[3]; - public int e = 0; - public int f = 0; - public int g = 0; + public int a = 0; + public int b = 0; + public int c = 0; // CraftBukkit start public ItemStack[] getContents() { @@ -15,15 +15,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory { public TileEntityFurnace() {} - public int h_() { + public int m_() { return this.h.length; } - public ItemStack a(int i) { + public ItemStack c_(int i) { return this.h[i]; } - public ItemStack b(int i, int j) { + public ItemStack a(int i, int j) { if (this.h[i] != null) { ItemStack itemstack; @@ -46,39 +46,39 @@ public class TileEntityFurnace extends TileEntity implements IInventory { public void a(int i, ItemStack itemstack) { this.h[i] = itemstack; - if (itemstack != null && itemstack.count > this.c()) { - itemstack.count = this.c(); + if (itemstack != null && itemstack.count > this.n_()) { + itemstack.count = this.n_(); } } - public String b() { + public String c() { return "Furnace"; } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.k("Items"); + NBTTagList nbttaglist = nbttagcompound.l("Items"); - this.h = new ItemStack[this.h_()]; + this.h = new ItemStack[this.m_()]; - for (int i = 0; i < nbttaglist.b(); ++i) { + for (int i = 0; i < nbttaglist.c(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - byte b0 = nbttagcompound1.b("Slot"); + byte b0 = nbttagcompound1.c("Slot"); if (b0 >= 0 && b0 < this.h.length) { this.h[b0] = new ItemStack(nbttagcompound1); } } - this.e = nbttagcompound.c("BurnTime"); - this.g = nbttagcompound.c("CookTime"); - this.f = this.a(this.h[1]); + this.a = nbttagcompound.d("BurnTime"); + this.c = nbttagcompound.d("CookTime"); + this.b = this.a(this.h[1]); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("BurnTime", (short) this.e); - nbttagcompound.a("CookTime", (short) this.g); + nbttagcompound.a("BurnTime", (short) this.a); + nbttagcompound.a("CookTime", (short) this.c); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.h.length; ++i) { @@ -94,26 +94,26 @@ public class TileEntityFurnace extends TileEntity implements IInventory { nbttagcompound.a("Items", (NBTBase) nbttaglist); } - public int c() { + public int n_() { return 64; } - public boolean e() { - return this.e > 0; + public boolean f() { + return this.a > 0; } - public void f() { - boolean flag = this.e > 0; + public void i_() { + boolean flag = this.a > 0; boolean flag1 = false; - if (this.e > 0) { - --this.e; + if (this.a > 0) { + --this.a; } - if (!this.a.isStatic) { - if (this.e == 0 && this.i()) { - this.f = this.e = this.a(this.h[1]); - if (this.e > 0) { + if (!this.d.isStatic) { + if (this.a == 0 && this.i()) { + this.b = this.a = this.a(this.h[1]); + if (this.a > 0) { flag1 = true; if (this.h[1] != null) { --this.h[1].count; @@ -124,25 +124,25 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } } - if (this.e() && this.i()) { - ++this.g; - if (this.g == 200) { - this.g = 0; - this.h(); + if (this.f() && this.i()) { + ++this.c; + if (this.c == 200) { + this.c = 0; + this.g(); flag1 = true; } } else { - this.g = 0; + this.c = 0; } - if (flag != this.e > 0) { + if (flag != this.a > 0) { flag1 = true; - BlockFurnace.a(this.e > 0, this.a, this.b, this.c, this.d); + BlockFurnace.a(this.a > 0, this.d, this.e, this.f, this.g); } } if (flag1) { - this.d(); + this.h(); } } @@ -152,11 +152,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } 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.c() && 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.n_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b()))); } } - public void h() { + public void g() { if (this.i()) { ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); @@ -184,6 +184,6 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } public boolean a_(EntityHuman entityhuman) { - return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; + return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D; } } diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index a52e8aa3b4..5566ad280b 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -2,13 +2,13 @@ package net.minecraft.server; public class TileEntityMobSpawner extends TileEntity { - public int e = -1; + public int a = -1; public String h = "Pig"; // CraftBukkit private -> public - public double f; - public double g = 0.0D; + public double b; + public double c = 0.0D; public TileEntityMobSpawner() { - this.e = 20; + this.a = 20; } public void a(String s) { @@ -16,34 +16,34 @@ public class TileEntityMobSpawner extends TileEntity { } public boolean a() { - return this.a.a((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D, 16.0D) != null; + return this.d.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null; } - public void f() { - this.g = this.f; + public void i_() { + this.c = this.b; if (this.a()) { - double d0 = (double) ((float) this.b + this.a.l.nextFloat()); - double d1 = (double) ((float) this.c + this.a.l.nextFloat()); - double d2 = (double) ((float) this.d + this.a.l.nextFloat()); + double d0 = (double) ((float) this.e + this.d.k.nextFloat()); + double d1 = (double) ((float) this.f + this.d.k.nextFloat()); + double d2 = (double) ((float) this.g + this.d.k.nextFloat()); - this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); - this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); + this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); - for (this.f += (double) (1000.0F / ((float) this.e + 200.0F)); this.f > 360.0D; this.g -= 360.0D) { - this.f -= 360.0D; + for (this.b += (double) (1000.0F / ((float) this.a + 200.0F)); this.b > 360.0D; this.c -= 360.0D) { + this.b -= 360.0D; } - if (this.e == -1) { - this.b(); + if (this.a == -1) { + this.c(); } - if (this.e > 0) { - --this.e; + if (this.a > 0) { + --this.a; } else { byte b0 = 4; for (int i = 0; i < b0; ++i) { - EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.a)); + EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.d)); if (entityliving == null) { return; @@ -51,59 +51,59 @@ public class TileEntityMobSpawner extends TileEntity { // CraftBukkit start - The world we're spawning in accepts this creature boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal; - if ((isAnimal && !this.a.L) || (!isAnimal && !this.a.K)) { + if ((isAnimal && !this.d.E) || (!isAnimal && !this.d.D)) { return; } // CraftBukkit end - int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size(); + int j = this.d.a(entityliving.getClass(), AxisAlignedBB.b((double) this.e, (double) this.f, (double) this.g, (double) (this.e + 1), (double) (this.f + 1), (double) (this.g + 1)).b(8.0D, 4.0D, 8.0D)).size(); if (j >= 6) { - this.b(); + this.c(); return; } if (entityliving != null) { - double d3 = (double) this.b + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D; - double d4 = (double) (this.c + this.a.l.nextInt(3) - 1); - double d5 = (double) this.d + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D; + double d3 = (double) this.e + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D; + double d4 = (double) (this.f + this.d.k.nextInt(3) - 1); + double d5 = (double) this.g + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D; - entityliving.c(d3, d4, d5, this.a.l.nextFloat() * 360.0F, 0.0F); + entityliving.c(d3, d4, d5, this.d.k.nextFloat() * 360.0F, 0.0F); if (entityliving.b()) { - this.a.a((Entity) entityliving); + this.d.a((Entity) entityliving); for (int k = 0; k < 20; ++k) { - d0 = (double) this.b + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; - d1 = (double) this.c + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; - d2 = (double) this.d + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; - this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); - this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); + d0 = (double) this.e + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D; + d1 = (double) this.f + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D; + d2 = (double) this.g + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D; + this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); } - entityliving.R(); - this.b(); + entityliving.I(); + this.c(); } } } - super.f(); + super.i_(); } } } - private void b() { - this.e = 200 + this.a.l.nextInt(600); + private void c() { + this.a = 200 + this.d.k.nextInt(600); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.h = nbttagcompound.h("EntityId"); - this.e = nbttagcompound.c("Delay"); + this.h = nbttagcompound.i("EntityId"); + this.a = nbttagcompound.d("Delay"); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.a("EntityId", this.h); - nbttagcompound.a("Delay", (short) this.e); + nbttagcompound.a("Delay", (short) this.a); } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 9844892cd0..76e7d146bf 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,13 +1,5 @@ package net.minecraft.server; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -31,134 +23,92 @@ import org.bukkit.entity.MobType; public class World implements IBlockAccess { public boolean a = false; - private List A = new ArrayList(); + private List u = new ArrayList(); public List b = new ArrayList(); - private List B = new ArrayList(); - private TreeSet C = new TreeSet(); - private Set D = new HashSet(); + private List v = new ArrayList(); + private TreeSet w = new TreeSet(); + private Set x = new HashSet(); public List c = new ArrayList(); public List d = new ArrayList(); - public long e = 0L; - private long E = 16777215L; - public int f = 0; - protected int g = (new Random()).nextInt(); - protected int h = 1013904223; - public boolean i = false; - private long F = System.currentTimeMillis(); - protected int j = 40; - public int k; - public Random l = new Random(); - public int spawnX; - public int spawnY; - public int spawnZ; - public boolean p = false; - public final WorldProvider q; - protected List r = new ArrayList(); - private IChunkProvider G; - public File s; - public File t; - public long u = 0L; - private NBTTagCompound H; - public long v = 0L; - public final String w; - public boolean x; - private ArrayList I = new ArrayList(); - private int J = 0; - public boolean K = true; // CraftBukkit private->public - public boolean L = true; // CraftBukkit private->public - static int y = 0; - private Set M = new HashSet(); - private int N; - private List O; + private long y = 16777215L; + public int e = 0; + protected int f = (new Random()).nextInt(); + protected int g = 1013904223; + public boolean h = false; + private long z = System.currentTimeMillis(); + protected int i = 40; + public int j; + public Random k = new Random(); + public boolean l = false; + public final WorldProvider m; + protected List n = new ArrayList(); + protected IChunkProvider o; + protected final IDataManager p; + public WorldData q; // CraftBukkit protected->public + public boolean r; + private boolean A; + private ArrayList B = new ArrayList(); + private int C = 0; + public boolean D = true; // CraftBukkit private->public + public boolean E = true; // CraftBukkit private->public + static int s = 0; + private Set F = new HashSet(); + private int G; + private List H; public boolean isStatic; public WorldChunkManager a() { - return this.q.b; + return this.m.b; } - public World(File file1, String s, long i, WorldProvider worldprovider) { - this.N = this.l.nextInt(12000); - this.O = new ArrayList(); + public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider) { + this.G = this.k.nextInt(12000); + this.H = new ArrayList(); this.isStatic = false; - this.s = file1; - this.w = s; - file1.mkdirs(); - this.t = new File(file1, s); - this.t.mkdirs(); - - try { - File file2 = new File(this.t, "session.lock"); - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file2)); - - try { - dataoutputstream.writeLong(this.F); - } finally { - dataoutputstream.close(); - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); - throw new RuntimeException("Failed to check session lock, aborting"); - } - - Object object = new WorldProvider(); - File file3 = new File(this.t, "level.dat"); - - this.p = !file3.exists(); - if (file3.exists()) { - try { - NBTTagCompound nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file3))); - NBTTagCompound nbttagcompound1 = nbttagcompound.j("Data"); - - this.u = nbttagcompound1.e("RandomSeed"); - this.spawnX = nbttagcompound1.d("SpawnX"); - this.spawnY = nbttagcompound1.d("SpawnY"); - this.spawnZ = nbttagcompound1.d("SpawnZ"); - this.e = nbttagcompound1.e("Time"); - this.v = nbttagcompound1.e("SizeOnDisk"); - if (nbttagcompound1.a("Player")) { - this.H = nbttagcompound1.j("Player"); - int j = this.H.d("Dimension"); - - if (j == -1) { - object = new WorldProviderHell(); - } - } - } catch (Exception exception) { - exception.printStackTrace(); - } - } - + this.p = idatamanager; + this.q = idatamanager.c(); + this.l = this.q == null; if (worldprovider != null) { - object = worldprovider; + this.m = worldprovider; + } else if (this.q != null && this.q.h() == -1) { + this.m = new WorldProviderHell(); + } else { + this.m = new WorldProvider(); } boolean flag = false; - if (this.u == 0L) { - this.u = i; + if (this.q == null) { + this.q = new WorldData(i, s); flag = true; + } else { + this.q.a(s); } - this.q = (WorldProvider) object; - this.q.a(this); - this.G = this.a(this.t); + this.m.a(this); + this.o = this.b(); if (flag) { - this.x = true; - this.spawnX = 0; - this.spawnY = 64; + this.r = true; + int j = 0; + byte b0 = 64; - for (this.spawnZ = 0; !this.q.a(this.spawnX, this.spawnZ); this.spawnZ += this.l.nextInt(64) - this.l.nextInt(64)) { - this.spawnX += this.l.nextInt(64) - this.l.nextInt(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.x = false; + this.q.a(j, b0, k); + this.r = false; } - this.e(); + this.f(); } - protected IChunkProvider a(File file1) { - return new ChunkProviderLoadOrGenerate(this, this.q.a(file1), this.q.c()); + protected IChunkProvider b() { + IChunkLoader ichunkloader = this.p.a(this.m); + + return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.m.c()); } public int a(int i, int j) { @@ -172,70 +122,23 @@ public class World implements IBlockAccess { } public void a(boolean flag, IProgressUpdate iprogressupdate) { - if (this.G.b()) { + if (this.o.b()) { if (iprogressupdate != null) { iprogressupdate.a("Saving level"); } - this.i(); + this.r(); if (iprogressupdate != null) { iprogressupdate.b("Saving chunks"); } - this.G.a(flag, iprogressupdate); + this.o.a(flag, iprogressupdate); } } - private void i() { - this.h(); - NBTTagCompound nbttagcompound = new NBTTagCompound(); - - nbttagcompound.a("RandomSeed", this.u); - nbttagcompound.a("SpawnX", this.spawnX); - nbttagcompound.a("SpawnY", this.spawnY); - nbttagcompound.a("SpawnZ", this.spawnZ); - nbttagcompound.a("Time", this.e); - nbttagcompound.a("SizeOnDisk", this.v); - nbttagcompound.a("LastPlayed", System.currentTimeMillis()); - EntityHuman entityhuman = null; - - if (this.d.size() > 0) { - entityhuman = (EntityHuman) this.d.get(0); - } - - NBTTagCompound nbttagcompound1; - - if (entityhuman != null) { - nbttagcompound1 = new NBTTagCompound(); - entityhuman.d(nbttagcompound1); - nbttagcompound.a("Player", nbttagcompound1); - } - - nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Data", (NBTBase) nbttagcompound); - - try { - File file1 = new File(this.t, "level.dat_new"); - File file2 = new File(this.t, "level.dat_old"); - File file3 = new File(this.t, "level.dat"); - - CompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); - if (file2.exists()) { - file2.delete(); - } - - file3.renameTo(file2); - if (file3.exists()) { - file3.delete(); - } - - file1.renameTo(file3); - if (file1.exists()) { - file1.delete(); - } - } catch (Exception exception) { - exception.printStackTrace(); - } + private void r() { + this.i(); + this.p.a(this.q, this.d); } public int getTypeId(int i, int j, int k) { @@ -278,7 +181,7 @@ public class World implements IBlockAccess { } private boolean f(int i, int j) { - return this.G.a(i, j); + return this.o.a(i, j); } public Chunk b(int i, int j) { @@ -296,7 +199,7 @@ public class World implements IBlockAccess { if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) { lastXAccessed = i; lastZAccessed = j; - lastChunkAccessed = this.G.b(i, j); + lastChunkAccessed = this.o.b(i, j); } result = lastChunkAccessed; } @@ -404,8 +307,8 @@ public class World implements IBlockAccess { } public void g(int i, int j, int k) { - for (int l = 0; l < this.r.size(); ++l) { - ((IWorldAccess) this.r.get(l)).a(i, j, k); + for (int l = 0; l < this.n.size(); ++l) { + ((IWorldAccess) this.n.get(l)).a(i, j, k); } } @@ -426,28 +329,28 @@ public class World implements IBlockAccess { } public void h(int i, int j, int k) { - for (int l = 0; l < this.r.size(); ++l) { - ((IWorldAccess) this.r.get(l)).a(i, j, k, i, j, k); + for (int l = 0; l < this.n.size(); ++l) { + ((IWorldAccess) this.n.get(l)).a(i, j, k, i, j, k); } } public void b(int i, int j, int k, int l, int i1, int j1) { - for (int k1 = 0; k1 < this.r.size(); ++k1) { - ((IWorldAccess) this.r.get(k1)).a(i, j, k, l, i1, j1); + for (int k1 = 0; k1 < this.n.size(); ++k1) { + ((IWorldAccess) this.n.get(k1)).a(i, j, k, l, i1, j1); } } public void h(int i, int j, int k, int l) { - this.l(i - 1, j, k, l); - this.l(i + 1, j, k, l); - this.l(i, j - 1, k, l); - this.l(i, j + 1, k, l); - this.l(i, j, k - 1, l); - this.l(i, j, k + 1, l); + this.k(i - 1, j, k, l); + this.k(i + 1, j, k, l); + this.k(i, j - 1, k, l); + this.k(i, j + 1, k, l); + this.k(i, j, k - 1, l); + this.k(i, j, k + 1, l); } - private void l(int i, int j, int k, int l) { - if (!this.i && !this.isStatic) { + private void k(int i, int j, int k, int l) { + if (!this.h && !this.isStatic) { Block block = Block.byId[this.getTypeId(i, j, k)]; if (block != null) { @@ -462,7 +365,7 @@ public class World implements IBlockAccess { } // CraftBukkit stop - block.b(this, i, j, k, l); + block.a(this, i, j, k, l); } } } @@ -511,7 +414,7 @@ public class World implements IBlockAccess { if (j < 0) { return 0; } else if (j >= 128) { - l = 15 - this.f; + l = 15 - this.e; if (l < 0) { l = 0; } @@ -522,7 +425,7 @@ public class World implements IBlockAccess { i &= 15; k &= 15; - return chunk.c(i, j, k, this.f); + return chunk.c(i, j, k, this.e); } } else { return 15; @@ -564,7 +467,7 @@ public class World implements IBlockAccess { } public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) { - if (!this.q.e || enumskyblock != EnumSkyBlock.SKY) { + if (!this.m.e || enumskyblock != EnumSkyBlock.SKY) { if (this.f(i, j, k)) { if (enumskyblock == EnumSkyBlock.SKY) { if (this.k(i, j, k)) { @@ -611,8 +514,8 @@ public class World implements IBlockAccess { chunk.a(enumskyblock, i & 15, j, k & 15, l); - for (int i1 = 0; i1 < this.r.size(); ++i1) { - ((IWorldAccess) this.r.get(i1)).a(i, j, k); + for (int i1 = 0; i1 < this.n.size(); ++i1) { + ((IWorldAccess) this.n.get(i1)).a(i, j, k); } } } @@ -621,11 +524,11 @@ public class World implements IBlockAccess { } public float l(int i, int j, int k) { - return this.q.f[this.j(i, j, k)]; + return this.m.f[this.j(i, j, k)]; } - public boolean b() { - return this.f < 4; + public boolean c() { + return this.e < 4; } public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) { @@ -777,26 +680,26 @@ public class World implements IBlockAccess { } public void a(Entity entity, String s, float f, float f1) { - for (int i = 0; i < this.r.size(); ++i) { - ((IWorldAccess) this.r.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); + for (int i = 0; i < this.n.size(); ++i) { + ((IWorldAccess) this.n.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); } } public void a(double d0, double d1, double d2, String s, float f, float f1) { - for (int i = 0; i < this.r.size(); ++i) { - ((IWorldAccess) this.r.get(i)).a(s, d0, d1, d2, f, f1); + for (int i = 0; i < this.n.size(); ++i) { + ((IWorldAccess) this.n.get(i)).a(s, d0, d1, d2, f, f1); } } public void a(String s, int i, int j, int k) { - for (int l = 0; l < this.r.size(); ++l) { - ((IWorldAccess) this.r.get(l)).a(s, i, j, k); + for (int l = 0; l < this.n.size(); ++l) { + ((IWorldAccess) this.n.get(l)).a(s, i, j, k); } } public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) { - for (int i = 0; i < this.r.size(); ++i) { - ((IWorldAccess) this.r.get(i)).a(s, d0, d1, d2, d3, d4, d5); + for (int i = 0; i < this.n.size(); ++i) { + ((IWorldAccess) this.n.get(i)).a(s, d0, d1, d2, d3, d4, d5); } } @@ -840,7 +743,7 @@ public class World implements IBlockAccess { if (type != null) { CraftServer server = ((WorldServer)this).getServer(); - Location loc = new Location(((WorldServer)this).getWorld(), entity.O, entity.P, entity.Q); + Location loc = new Location(((WorldServer) this).getWorld(), entity.bi, entity.bj, entity.bk); CreatureSpawnEvent cse; cse = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc); @@ -851,7 +754,7 @@ public class World implements IBlockAccess { } } } - //CraftBukkit end + // CraftBukkit end if (!flag && !this.f(i, j)) { return false; @@ -860,7 +763,7 @@ public class World implements IBlockAccess { EntityHuman entityhuman = (EntityHuman) entity; this.d.add(entityhuman); - System.out.println("Player count: " + this.d.size()); + this.o(); } this.c(i, j).a(entity); @@ -871,42 +774,44 @@ public class World implements IBlockAccess { } protected void b(Entity entity) { - for (int i = 0; i < this.r.size(); ++i) { - ((IWorldAccess) this.r.get(i)).a(entity); + for (int i = 0; i < this.n.size(); ++i) { + ((IWorldAccess) this.n.get(i)).a(entity); } } protected void c(Entity entity) { - for (int i = 0; i < this.r.size(); ++i) { - ((IWorldAccess) this.r.get(i)).b(entity); + for (int i = 0; i < this.n.size(); ++i) { + ((IWorldAccess) this.n.get(i)).b(entity); } } public void d(Entity entity) { if (entity.passenger != null) { - entity.passenger.e((Entity) null); + entity.passenger.b((Entity) null); } if (entity.vehicle != null) { - entity.e((Entity) null); + entity.b((Entity) null); } - entity.q(); + entity.C(); if (entity instanceof EntityHuman) { this.d.remove((EntityHuman) entity); + this.o(); } } public void e(Entity entity) { - entity.q(); + entity.C(); if (entity instanceof EntityHuman) { this.d.remove((EntityHuman) entity); + this.o(); } int i = entity.chunkX; int j = entity.chunkZ; - if (entity.ag && this.f(i, j)) { + if (entity.bA && this.f(i, j)) { this.c(i, j).b(entity); } @@ -915,11 +820,11 @@ public class World implements IBlockAccess { } public void a(IWorldAccess iworldaccess) { - this.r.add(iworldaccess); + this.n.add(iworldaccess); } public List a(Entity entity, AxisAlignedBB axisalignedbb) { - this.I.clear(); + this.B.clear(); int i = MathHelper.b(axisalignedbb.a); int j = MathHelper.b(axisalignedbb.d + 1.0D); int k = MathHelper.b(axisalignedbb.b); @@ -934,7 +839,7 @@ public class World implements IBlockAccess { Block block = Block.byId[this.getTypeId(k1, i2, l1)]; if (block != null) { - block.a(this, k1, i2, l1, axisalignedbb, this.I); + block.a(this, k1, i2, l1, axisalignedbb, this.B); } } } @@ -945,19 +850,19 @@ public class World implements IBlockAccess { List list = this.b(entity, axisalignedbb.b(d0, d0, d0)); for (int j2 = 0; j2 < list.size(); ++j2) { - AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).u(); + AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).d(); if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) { - this.I.add(axisalignedbb1); + this.B.add(axisalignedbb1); } - axisalignedbb1 = entity.d((Entity) list.get(j2)); + axisalignedbb1 = entity.a_((Entity) list.get(j2)); if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) { - this.I.add(axisalignedbb1); + this.B.add(axisalignedbb1); } } - return this.I; + return this.B; } public int a(float f) { @@ -976,7 +881,7 @@ public class World implements IBlockAccess { } public float b(float f) { - return this.q.a(this.e, f); + return this.m.a(this.q.f(), f); } public int e(int i, int j) { @@ -1001,54 +906,54 @@ public class World implements IBlockAccess { return -1; } - public void i(int i, int j, int k, int l) { + public void c(int i, int j, int k, int l, int i1) { NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l); byte b0 = 8; if (this.a) { if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) { - int i1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c); + int j1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c); - if (i1 == nextticklistentry.d && i1 > 0) { - Block.byId[i1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.l); + if (j1 == nextticklistentry.d && j1 > 0) { + Block.byId[j1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.k); } } } else { if (this.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { if (l > 0) { - nextticklistentry.a((long) Block.byId[l].b() + this.e); + nextticklistentry.a((long) i1 + this.q.f()); } - if (!this.D.contains(nextticklistentry)) { - this.D.add(nextticklistentry); - this.C.add(nextticklistentry); + if (!this.x.contains(nextticklistentry)) { + this.x.add(nextticklistentry); + this.w.add(nextticklistentry); } } } } - public void c() { - this.b.removeAll(this.B); + public void d() { + this.b.removeAll(this.v); int i; Entity entity; int j; int k; - for (i = 0; i < this.B.size(); ++i) { - entity = (Entity) this.B.get(i); + for (i = 0; i < this.v.size(); ++i) { + entity = (Entity) this.v.get(i); j = entity.chunkX; k = entity.chunkZ; - if (entity.ag && this.f(j, k)) { + if (entity.bA && this.f(j, k)) { this.c(j, k).b(entity); } } - for (i = 0; i < this.B.size(); ++i) { - this.c((Entity) this.B.get(i)); + for (i = 0; i < this.v.size(); ++i) { + this.c((Entity) this.v.get(i)); } - this.B.clear(); + this.v.clear(); for (i = 0; i < this.b.size(); ++i) { entity = (Entity) this.b.get(i); @@ -1068,7 +973,7 @@ public class World implements IBlockAccess { if (entity.dead) { j = entity.chunkX; k = entity.chunkZ; - if (entity.ag && this.f(j, k)) { + if (entity.bA && this.f(j, k)) { this.c(j, k).b(entity); } @@ -1080,7 +985,7 @@ public class World implements IBlockAccess { for (i = 0; i < this.c.size(); ++i) { TileEntity tileentity = (TileEntity) this.c.get(i); - tileentity.f(); + tileentity.i_(); } } @@ -1094,29 +999,29 @@ public class World implements IBlockAccess { byte b0 = 32; if (!flag || this.a(i - b0, 0, j - b0, i + b0, 128, j + b0)) { - entity.O = entity.locX; - entity.P = entity.locY; - entity.Q = entity.locZ; + entity.bi = entity.locX; + entity.bj = entity.locY; + entity.bk = entity.locZ; entity.lastYaw = entity.yaw; entity.lastPitch = entity.pitch; - if (flag && entity.ag) { + if (flag && entity.bA) { if (entity.vehicle != null) { - entity.D(); + entity.x(); } else { - entity.b_(); + entity.f_(); } } if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) { - entity.locX = entity.O; + entity.locX = entity.bi; } if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) { - entity.locY = entity.P; + entity.locY = entity.bj; } if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) { - entity.locZ = entity.Q; + entity.locZ = entity.bk; } if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) { @@ -1131,20 +1036,20 @@ public class World implements IBlockAccess { int l = MathHelper.b(entity.locY / 16.0D); int i1 = MathHelper.b(entity.locZ / 16.0D); - if (!entity.ag || entity.chunkX != k || entity.ai != l || entity.chunkZ != i1) { - if (entity.ag && this.f(entity.chunkX, entity.chunkZ)) { - this.c(entity.chunkX, entity.chunkZ).a(entity, entity.ai); + if (!entity.bA || entity.chunkX != k || entity.bC != l || entity.chunkZ != i1) { + if (entity.bA && this.f(entity.chunkX, entity.chunkZ)) { + this.c(entity.chunkX, entity.chunkZ).a(entity, entity.bC); } if (this.f(k, i1)) { - entity.ag = true; + entity.bA = true; this.c(k, i1).a(entity); } else { - entity.ag = false; + entity.bA = false; } } - if (flag && entity.ag && entity.passenger != null) { + if (flag && entity.bA && entity.passenger != null) { if (!entity.passenger.dead && entity.passenger.vehicle == entity) { this.f(entity.passenger); } else { @@ -1161,7 +1066,7 @@ public class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - if (!entity.dead && entity.i) { + if (!entity.dead && entity.aC) { return false; } } @@ -1395,31 +1300,31 @@ public class World implements IBlockAccess { return block == null ? false : block.a(); } - public boolean d() { - if (this.J >= 50) { + public boolean e() { + if (this.C >= 50) { return false; } else { - ++this.J; + ++this.C; try { int i = 500; boolean flag; - while (this.A.size() > 0) { + while (this.u.size() > 0) { --i; if (i <= 0) { flag = true; return flag; } - ((MetadataChunkBlock) this.A.remove(this.A.size() - 1)).a(this); + ((MetadataChunkBlock) this.u.remove(this.u.size() - 1)).a(this); } flag = false; return flag; } finally { - --this.J; + --this.C; } } } @@ -1429,18 +1334,18 @@ public class World implements IBlockAccess { } public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l, int i1, int j1, boolean flag) { - if (!this.q.e || enumskyblock != EnumSkyBlock.SKY) { - ++y; - if (y == 50) { - --y; + if (!this.m.e || enumskyblock != EnumSkyBlock.SKY) { + ++s; + if (s == 50) { + --s; } else { int k1 = (l + i) / 2; int l1 = (j1 + k) / 2; if (!this.f(k1, 64, l1)) { - --y; + --s; } else if (!this.b(k1, l1).g()) { - int i2 = this.A.size(); + int i2 = this.u.size(); int j2; if (flag) { @@ -1450,69 +1355,86 @@ public class World implements IBlockAccess { } for (int k2 = 0; k2 < j2; ++k2) { - MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.A.get(this.A.size() - k2 - 1); + MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.u.get(this.u.size() - k2 - 1); if (metadatachunkblock.a == enumskyblock && metadatachunkblock.a(i, j, k, l, i1, j1)) { - --y; + --s; return; } } } - this.A.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1)); + this.u.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1)); j2 = 1000000; - if (this.A.size() > 1000000) { + if (this.u.size() > 1000000) { System.out.println("More than " + j2 + " updates, aborting lighting updates"); - this.A.clear(); + this.u.clear(); } - --y; + --s; } } } } - public void e() { + public void f() { int i = this.a(1.0F); - if (i != this.f) { - this.f = i; + if (i != this.e) { + this.e = i; } } public void a(boolean flag, boolean flag1) { - this.K = flag; - this.L = flag1; + this.D = flag; + this.E = flag1; } - public void f() { - // CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals - if ((this.K || this.L) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0)) - SpawnerCreature.a(this, this.K, this.L); - // CraftBukkit end + public void g() { + long i; - this.G.a(); - int i = this.a(1.0F); + if (this.q()) { + boolean flag = false; - if (i != this.f) { - this.f = i; + if (this.D && this.j >= 1) { + flag = SpawnerCreature.a(this, this.d); + } - for (int j = 0; j < this.r.size(); ++j) { - ((IWorldAccess) this.r.get(j)).a(); + if (!flag) { + i = this.q.f() + 24000L; + this.q.a(i - i % 24000L); + this.p(); } } - ++this.e; - if (this.e % (long) this.j == 0L) { + // CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals + if ((this.D || this.E) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0)) + SpawnerCreature.a(this, this.D, this.E); + // CraftBukkit end + + this.o.a(); + int j = this.a(1.0F); + + if (j != this.e) { + this.e = j; + + for (int k = 0; k < this.n.size(); ++k) { + ((IWorldAccess) this.n.get(k)).a(); + } + } + + i = this.q.f() + 1L; + if (i % (long) this.i == 0L) { this.a(false, (IProgressUpdate) null); } + this.q.a(i); this.a(false); - this.g(); + this.h(); } - protected void g() { - this.M.clear(); + protected void h() { + this.F.clear(); int i; int j; @@ -1528,16 +1450,16 @@ public class World implements IBlockAccess { for (k = -b0; k <= b0; ++k) { for (l = -b0; l <= b0; ++l) { - this.M.add(new ChunkCoordIntPair(k + i, l + j)); + this.F.add(new ChunkCoordIntPair(k + i, l + j)); } } } - if (this.N > 0) { - --this.N; + if (this.G > 0) { + --this.G; } - Iterator iterator = this.M.iterator(); + Iterator iterator = this.F.iterator(); while (iterator.hasNext()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); @@ -1549,44 +1471,44 @@ public class World implements IBlockAccess { int k1; int l1; - if (this.N == 0) { - this.g = this.g * 3 + this.h; - k = this.g >> 2; + if (this.G == 0) { + this.f = this.f * 3 + this.g; + k = this.f >> 2; l = k & 15; j1 = k >> 8 & 15; k1 = k >> 16 & 127; l1 = chunk.a(l, k1, j1); l += i; j1 += j; - if (l1 == 0 && this.j(l, k1, j1) <= this.l.nextInt(8) && this.a(EnumSkyBlock.SKY, l, k1, j1) <= 0) { + if (l1 == 0 && this.j(l, k1, j1) <= this.k.nextInt(8) && this.a(EnumSkyBlock.SKY, l, k1, j1) <= 0) { EntityHuman entityhuman1 = this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, 8.0D); if (entityhuman1 != null && entityhuman1.d((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D) > 4.0D) { - this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.l.nextFloat() * 0.2F); - this.N = this.l.nextInt(12000) + 6000; + this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.k.nextFloat() * 0.2F); + this.G = this.k.nextInt(12000) + 6000; } } } for (k = 0; k < 80; ++k) { - this.g = this.g * 3 + this.h; - l = this.g >> 2; + this.f = this.f * 3 + this.g; + l = this.f >> 2; j1 = l & 15; k1 = l >> 8 & 15; l1 = l >> 16 & 127; byte b1 = chunk.b[j1 << 11 | k1 << 7 | l1]; if (Block.n[b1]) { - Block.byId[b1].a(this, j1 + i, l1, k1 + j, this.l); + Block.byId[b1].a(this, j1 + i, l1, k1 + j, this.k); } } } } public boolean a(boolean flag) { - int i = this.C.size(); + int i = this.w.size(); - if (i != this.D.size()) { + if (i != this.x.size()) { throw new IllegalStateException("TickNextTick list out of synch"); } else { if (i > 1000) { @@ -1594,31 +1516,31 @@ public class World implements IBlockAccess { } for (int j = 0; j < i; ++j) { - NextTickListEntry nextticklistentry = (NextTickListEntry) this.C.first(); + NextTickListEntry nextticklistentry = (NextTickListEntry) this.w.first(); - if (!flag && nextticklistentry.e > this.e) { + if (!flag && nextticklistentry.e > this.q.f()) { break; } - this.C.remove(nextticklistentry); - this.D.remove(nextticklistentry); + this.w.remove(nextticklistentry); + this.x.remove(nextticklistentry); byte b0 = 8; if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) { int k = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c); if (k == nextticklistentry.d && k > 0) { - Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.l); + Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.k); } } } - return this.C.size() != 0; + return this.w.size() != 0; } } public List b(Entity entity, AxisAlignedBB axisalignedbb) { - this.O.clear(); + this.H.clear(); int i = MathHelper.b((axisalignedbb.a - 2.0D) / 16.0D); int j = MathHelper.b((axisalignedbb.d + 2.0D) / 16.0D); int k = MathHelper.b((axisalignedbb.c - 2.0D) / 16.0D); @@ -1627,12 +1549,12 @@ public class World implements IBlockAccess { for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.f(i1, j1)) { - this.c(i1, j1).a(entity, axisalignedbb, this.O); + this.c(i1, j1).a(entity, axisalignedbb, this.H); } } } - return this.O; + return this.H; } public List a(Class oclass, AxisAlignedBB axisalignedbb) { @@ -1658,8 +1580,8 @@ public class World implements IBlockAccess { this.b(i, k).f(); } - for (int l = 0; l < this.r.size(); ++l) { - ((IWorldAccess) this.r.get(l)).a(i, j, k, tileentity); + for (int l = 0; l < this.n.size(); ++l) { + ((IWorldAccess) this.n.get(l)).a(i, j, k, tileentity); } } @@ -1686,7 +1608,7 @@ public class World implements IBlockAccess { } public void b(List list) { - this.B.addAll(list); + this.v.addAll(list); } public boolean a(int i, int j, int k, int l, boolean flag) { @@ -1745,17 +1667,17 @@ public class World implements IBlockAccess { return (new Pathfinder(chunkcache)).a(entity, i, j, k, f); } - public boolean j(int i, int j, int k, int l) { + public boolean i(int i, int j, int k, int l) { int i1 = this.getTypeId(i, j, k); - return i1 == 0 ? false : Block.byId[i1].d(this, i, j, k, l); + return i1 == 0 ? false : Block.byId[i1].c(this, i, j, k, l); } public boolean o(int i, int j, int k) { - return this.j(i, j - 1, k, 0) ? true : (this.j(i, j + 1, k, 1) ? true : (this.j(i, j, k - 1, 2) ? true : (this.j(i, j, k + 1, 3) ? true : (this.j(i - 1, j, k, 4) ? true : this.j(i + 1, j, k, 5))))); + return this.i(i, j - 1, k, 0) ? true : (this.i(i, j + 1, k, 1) ? true : (this.i(i, j, k - 1, 2) ? true : (this.i(i, j, k + 1, 3) ? true : (this.i(i - 1, j, k, 4) ? true : this.i(i + 1, j, k, 5))))); } - public boolean k(int i, int j, int k, int l) { + public boolean j(int i, int j, int k, int l) { if (this.d(i, j, k)) { return this.o(i, j, k); } else { @@ -1766,7 +1688,7 @@ public class World implements IBlockAccess { } public boolean p(int i, int j, int k) { - return this.k(i, j - 1, k, 0) ? true : (this.k(i, j + 1, k, 1) ? true : (this.k(i, j, k - 1, 2) ? true : (this.k(i, j, k + 1, 3) ? true : (this.k(i - 1, j, k, 4) ? true : this.k(i + 1, j, k, 5))))); + return this.j(i, j - 1, k, 0) ? true : (this.j(i, j + 1, k, 1) ? true : (this.j(i, j, k - 1, 2) ? true : (this.j(i, j, k + 1, 3) ? true : (this.j(i - 1, j, k, 4) ? true : this.j(i + 1, j, k, 5))))); } public EntityHuman a(Entity entity, double d0) { @@ -1839,21 +1761,24 @@ public class World implements IBlockAccess { return abyte; } - public void h() { - try { - File file1 = new File(this.t, "session.lock"); - DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); + public void i() { + this.p.b(); + } - try { - if (datainputstream.readLong() != this.F) { - throw new MinecraftException("The save is being accessed from another location, aborting"); - } - } finally { - datainputstream.close(); - } - } catch (IOException ioexception) { - throw new MinecraftException("Failed to check session lock, aborting"); - } + public void a(long i) { + this.q.a(i); + } + + public long j() { + return this.q.b(); + } + + public long k() { + return this.q.f(); + } + + public ChunkCoordinates l() { + return new ChunkCoordinates(this.q.c(), this.q.d(), this.q.e()); } public boolean a(EntityHuman entityhuman, int i, int j, int k) { @@ -1862,11 +1787,66 @@ public class World implements IBlockAccess { public void a(Entity entity, byte b0) {} - public void c(int i, int j, int k, int l, int i1) { + public void d(int i, int j, int k, int l, int i1) { int j1 = this.getTypeId(i, j, k); if (j1 > 0) { Block.byId[j1].a(this, i, j, k, l, i1); } } + + public IDataManager m() { + return this.p; + } + + public WorldData n() { + return this.q; + } + + public void o() { + this.A = !this.d.isEmpty(); + Iterator iterator = this.d.iterator(); + + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + + if (!entityhuman.E()) { + this.A = false; + break; + } + } + } + + protected void p() { + this.A = false; + Iterator iterator = this.d.iterator(); + + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + + if (entityhuman.E()) { + entityhuman.a(false, false); + } + } + } + + public boolean q() { + if (this.A && !this.isStatic) { + Iterator iterator = this.d.iterator(); + + EntityHuman entityhuman; + + do { + if (!iterator.hasNext()) { + return true; + } + + entityhuman = (EntityHuman) iterator.next(); + } while (entityhuman.F()); + + return false; + } else { + return false; + } + } } diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java new file mode 100644 index 0000000000..c63bb1948c --- /dev/null +++ b/src/main/java/net/minecraft/server/WorldData.java @@ -0,0 +1,147 @@ +package net.minecraft.server; + +import java.util.List; + +public class WorldData { + + private long a; + private int b; + private int c; + private int d; + private long e; + private long f; + private long g; + private NBTTagCompound h; + private int i; + public String j; // CraftBukkit private->public + private int k; + + public WorldData(NBTTagCompound nbttagcompound) { + this.a = nbttagcompound.f("RandomSeed"); + this.b = nbttagcompound.e("SpawnX"); + this.c = nbttagcompound.e("SpawnY"); + this.d = nbttagcompound.e("SpawnZ"); + this.e = nbttagcompound.f("Time"); + this.f = nbttagcompound.f("LastPlayed"); + this.g = nbttagcompound.f("SizeOnDisk"); + this.j = nbttagcompound.i("LevelName"); + this.k = nbttagcompound.e("version"); + if (nbttagcompound.b("Player")) { + this.h = nbttagcompound.k("Player"); + this.i = this.h.e("Dimension"); + } + } + + public WorldData(long i, String s) { + this.a = i; + this.j = s; + } + + public WorldData(WorldData worlddata) { + this.a = worlddata.a; + this.b = worlddata.b; + this.c = worlddata.c; + this.d = worlddata.d; + this.e = worlddata.e; + this.f = worlddata.f; + this.g = worlddata.g; + this.h = worlddata.h; + this.i = worlddata.i; + this.j = worlddata.j; + this.k = worlddata.k; + } + + public NBTTagCompound a() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + this.a(nbttagcompound, this.h); + return nbttagcompound; + } + + public NBTTagCompound a(List list) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + EntityHuman entityhuman = null; + NBTTagCompound nbttagcompound1 = null; + + if (list.size() > 0) { + entityhuman = (EntityHuman) list.get(0); + } + + if (entityhuman != null) { + nbttagcompound1 = new NBTTagCompound(); + entityhuman.d(nbttagcompound1); + } + + this.a(nbttagcompound, nbttagcompound1); + return nbttagcompound; + } + + private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { + nbttagcompound.a("RandomSeed", this.a); + nbttagcompound.a("SpawnX", this.b); + nbttagcompound.a("SpawnY", this.c); + nbttagcompound.a("SpawnZ", this.d); + nbttagcompound.a("Time", this.e); + nbttagcompound.a("SizeOnDisk", this.g); + nbttagcompound.a("LastPlayed", System.currentTimeMillis()); + nbttagcompound.a("LevelName", this.j); + nbttagcompound.a("version", this.k); + if (nbttagcompound1 != null) { + nbttagcompound.a("Player", nbttagcompound1); + } + } + + public long b() { + return this.a; + } + + public int c() { + return this.b; + } + + public int d() { + return this.c; + } + + public int e() { + return this.d; + } + + public long f() { + return this.e; + } + + public long g() { + return this.g; + } + + public int h() { + return this.i; + } + + public void a(long i) { + this.e = i; + } + + public void b(long i) { + this.g = i; + } + + public void a(int i, int j, int k) { + this.b = i; + this.c = j; + this.d = k; + } + + public void a(String s) { + this.j = s; + } + + public int i() { + return this.k; + } + + public void a(int i) { + this.k = i; + } +} diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java index a6057e3bc2..22f6d41627 100644 --- a/src/main/java/net/minecraft/server/WorldGenTrees.java +++ b/src/main/java/net/minecraft/server/WorldGenTrees.java @@ -1,100 +1,100 @@ -package net.minecraft.server; - -import java.util.Random; - -// CraftBukkit start -import org.bukkit.BlockChangeDelegate; -// CraftBukkit end - -public class WorldGenTrees extends WorldGenerator { - - public WorldGenTrees() {} - - public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - // sk: The idea is to have (our) WorldServer implement - // BlockChangeDelegate and then we can implicitly cast World to - // WorldServer (a safe cast, AFAIK) and no code will be broken. This - // then allows plugins to catch manually-invoked generation events - return generate((BlockChangeDelegate)world, random, i, j, k); - } - - public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) { - // CraftBukkit end - int l = random.nextInt(3) + 4; - boolean flag = true; - - if (j >= 1 && j + l + 1 <= 128) { - int i1; - int j1; - int k1; - int l1; - - for (i1 = j; i1 <= j + 1 + l; ++i1) { - byte b0 = 1; - - if (i1 == j) { - b0 = 0; - } - - if (i1 >= j + 1 + l - 2) { - b0 = 2; - } - - for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) { - for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) { - if (i1 >= 0 && i1 < 128) { - l1 = world.getTypeId(j1, i1, k1); - if (l1 != 0 && l1 != Block.LEAVES.id) { - flag = false; - } - } else { - flag = false; - } - } - } - } - - if (!flag) { - return false; - } else { - i1 = world.getTypeId(i, j - 1, k); - if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) { - world.setTypeId(i, j - 1, k, Block.DIRT.id); - - int i2; - - for (i2 = j - 3 + l; i2 <= j + l; ++i2) { - j1 = i2 - (j + l); - k1 = 1 - j1 / 2; - - for (l1 = i - k1; l1 <= i + k1; ++l1) { - int j2 = l1 - i; - - for (int k2 = k - k1; k2 <= k + k1; ++k2) { - int l2 = k2 - k; - - if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) { - world.setTypeId(l1, i2, k2, Block.LEAVES.id); - } - } - } - } - - for (i2 = 0; i2 < l; ++i2) { - j1 = world.getTypeId(i, j + i2, k); - if (j1 == 0 || j1 == Block.LEAVES.id) { - world.setTypeId(i, j + i2, k, Block.LOG.id); - } - } - - return true; - } else { - return false; - } - } - } else { - return false; - } - } -} +package net.minecraft.server; + +import java.util.Random; + +// CraftBukkit start +import org.bukkit.BlockChangeDelegate; +// CraftBukkit end + +public class WorldGenTrees extends WorldGenerator { + + public WorldGenTrees() {} + + public boolean a(World world, Random random, int i, int j, int k) { + // CraftBukkit start + // sk: The idea is to have (our) WorldServer implement + // BlockChangeDelegate and then we can implicitly cast World to + // WorldServer (a safe cast, AFAIK) and no code will be broken. This + // then allows plugins to catch manually-invoked generation events + return generate((BlockChangeDelegate)world, random, i, j, k); + } + + public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) { + // CraftBukkit end + int l = random.nextInt(3) + 4; + boolean flag = true; + + if (j >= 1 && j + l + 1 <= 128) { + int i1; + int j1; + int k1; + int l1; + + for (i1 = j; i1 <= j + 1 + l; ++i1) { + byte b0 = 1; + + if (i1 == j) { + b0 = 0; + } + + if (i1 >= j + 1 + l - 2) { + b0 = 2; + } + + for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) { + for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) { + if (i1 >= 0 && i1 < 128) { + l1 = world.getTypeId(j1, i1, k1); + if (l1 != 0 && l1 != Block.LEAVES.id) { + flag = false; + } + } else { + flag = false; + } + } + } + } + + if (!flag) { + return false; + } else { + i1 = world.getTypeId(i, j - 1, k); + if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) { + world.setTypeId(i, j - 1, k, Block.DIRT.id); + + int i2; + + for (i2 = j - 3 + l; i2 <= j + l; ++i2) { + j1 = i2 - (j + l); + k1 = 1 - j1 / 2; + + for (l1 = i - k1; l1 <= i + k1; ++l1) { + int j2 = l1 - i; + + for (int k2 = k - k1; k2 <= k + k1; ++k2) { + int l2 = k2 - k; + + if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) { + world.setTypeId(l1, i2, k2, Block.LEAVES.id); + } + } + } + } + + for (i2 = 0; i2 < l; ++i2) { + j1 = world.getTypeId(i, j + i2, k); + if (j1 == 0 || j1 == Block.LEAVES.id) { + world.setTypeId(i, j + i2, k, Block.LOG.id); + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 7b9da45a02..8177e7e707 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -13,16 +13,16 @@ import org.bukkit.craftbukkit.CraftWorld; public class WorldServer extends World implements BlockChangeDelegate { // CraftBukkit end - public ChunkProviderServer A; - public boolean B = false; - public boolean C; - public final MinecraftServer D; // Craftbukkit - private EntityList E = new EntityList(); + public ChunkProviderServer u; + public boolean v = false; + public boolean w; + public final MinecraftServer x; // Craftbukkit - private -> public final + private EntityList y = new EntityList(); public PlayerManager manager; // Craftbukkit - public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) { - super(file1, s, (new Random()).nextLong(), WorldProvider.a(i)); - this.D = minecraftserver; + public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) { + super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i)); + this.x = minecraftserver; // CraftBukkit start this.server = minecraftserver.server; @@ -42,14 +42,10 @@ public class WorldServer extends World implements BlockChangeDelegate { } // CraftBukkit end - public void f() { - super.f(); - } - public void a(Entity entity, boolean flag) { - // CraftBukkit start -- We prevent spawning in general, so this butching is not needed - //if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { - // entity.q(); + // 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(); //} // CraftBukkit end @@ -62,9 +58,11 @@ public class WorldServer extends World implements BlockChangeDelegate { super.a(entity, flag); } - protected IChunkProvider a(File file1) { - this.A = new ChunkProviderServer(this, this.q.a(file1), this.q.c()); - return this.A; + protected IChunkProvider b() { + IChunkLoader ichunkloader = this.p.a(this.m); + + this.u = new ChunkProviderServer(this, ichunkloader, this.m.c()); + return this.u; } public List d(int i, int j, int k, int l, int i1, int j1) { @@ -73,7 +71,7 @@ public class WorldServer extends World implements BlockChangeDelegate { for (int k1 = 0; k1 < this.c.size(); ++k1) { TileEntity tileentity = (TileEntity) this.c.get(k1); - if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) { + if (tileentity.e >= i && tileentity.f >= j && tileentity.g >= k && tileentity.e < l && tileentity.f < i1 && tileentity.g < j1) { arraylist.add(tileentity); } } @@ -82,34 +80,34 @@ public class WorldServer extends World implements BlockChangeDelegate { } public boolean a(EntityHuman entityhuman, int i, int j, int k) { - int l = (int) MathHelper.e((float) (i - this.spawnX)); - int i1 = (int) MathHelper.e((float) (k - this.spawnZ)); + int l = (int) MathHelper.e((float) (i - this.q.c())); + int i1 = (int) MathHelper.e((float) (k - this.q.e())); if (l > i1) { i1 = l; } - return i1 > this.D.spawnProtection || this.D.f.g(entityhuman.name); // CraftBukkit Configurable spawn protection start + return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name); // CraftBukkit Configurable spawn protection start } protected void b(Entity entity) { super.b(entity); - this.E.a(entity.id, entity); + this.y.a(entity.id, entity); } protected void c(Entity entity) { super.c(entity); - this.E.d(entity.id); + this.y.d(entity.id); } public Entity a(int i) { - return (Entity) this.E.a(i); + return (Entity) this.y.a(i); } public void a(Entity entity, byte b0) { Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0); - this.D.k.b(entity, packet38entitystatus); + this.x.k.b(entity, packet38entitystatus); } public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) { @@ -121,12 +119,16 @@ public class WorldServer extends World implements BlockChangeDelegate { } // Craftbukkit end - this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g)); + this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g)); return explosion; } - public void c(int i, int j, int k, int l, int i1) { - super.c(i, j, k, l, i1); - this.D.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1)); + public void d(int i, int j, int k, int l, int i1) { + super.d(i, j, k, l, i1); + this.x.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1)); + } + + public void r() { + this.p.e(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 6365b382d2..1d9ee88488 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -9,10 +9,12 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import net.minecraft.server.ChunkCoordinates; import net.minecraft.server.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.server.PropertyManager; import net.minecraft.server.ServerConfigurationManager; +import net.minecraft.server.ServerNBTManager; import net.minecraft.server.WorldManager; import net.minecraft.server.WorldServer; import org.bukkit.*; @@ -177,14 +179,14 @@ public final class CraftServer implements Server { console.d = config; boolean animals = config.a("spawn-monsters", console.m); - boolean monsters = config.a("spawn-monsters", console.worlds.get(0).k > 0); + boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0); console.l = config.a("online-mode", console.l); console.m = config.a("spawn-animals", console.m); console.n = config.a("pvp", console.n); for (WorldServer world : console.worlds) { - world.k = monsters ? 1 : 0; + world.j = monsters ? 1 : 0; world.a(monsters, animals); } @@ -210,10 +212,10 @@ public final class CraftServer implements Server { throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); } - WorldServer internal = new WorldServer(console, new File("."), name, environment == World.Environment.NETHER ? -1 : 0); + WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0); internal.a(new WorldManager(console, internal)); - internal.k = 1; + internal.j = 1; internal.a(true, true); console.f.a(internal); console.worlds.add(internal); @@ -236,9 +238,10 @@ public final class CraftServer implements Server { i = l; } - internal.A.d(internal.spawnX + j >> 4, internal.spawnZ + k >> 4); + ChunkCoordinates chunkcoordinates = internal.l(); + internal.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); - while (internal.d()) { + while (internal.e()) { ; } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 53bfed9c34..9058a580aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -33,9 +33,9 @@ public class CraftWorld implements World { public CraftWorld(WorldServer world) { this.world = world; this.server = world.getServer(); - this.provider = world.A; + this.provider = world.u; - if (world.q instanceof WorldProviderHell) { + if (world.m instanceof WorldProviderHell) { environment = Environment.NETHER; } else { environment = Environment.NORMAL; @@ -65,7 +65,8 @@ public class CraftWorld implements World { } public Location getSpawnLocation() { - return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ); + ChunkCoordinates spawn = world.l(); + return new Location(this, spawn.a, world.e(spawn.a, spawn.c), spawn.c); } public Chunk getChunkAt(int x, int z) { @@ -225,9 +226,9 @@ public class CraftWorld implements World { } public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { - double xs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; - double ys = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; - double zs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; + double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; + double ys = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; + double zs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; loc = loc.clone(); loc.setX(loc.getX() + xs); loc.setY(loc.getY() + ys); @@ -324,11 +325,11 @@ public class CraftWorld implements World { } public String getName() { - return world.w; + return world.q.j; } public long getId() { - return world.u; + return world.q.b(); } @Override @@ -349,11 +350,11 @@ public class CraftWorld implements World { } public long getFullTime() { - return world.e; + return world.k(); } public void setFullTime(long time) { - world.e = time; + world.a(time); } public Environment getEnvironment() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 0b9fc7aa50..638d7ef003 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -1,4 +1,3 @@ - package org.bukkit.craftbukkit.block; import org.bukkit.block.BlockFace; @@ -349,7 +348,7 @@ public class CraftBlock implements Block { } public boolean isBlockFacePowered(BlockFace face) { - return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face)); + return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face)); } public boolean isBlockFaceIndirectlyPowered(BlockFace face) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java old mode 100644 new mode 100755 index e16c4181f3..b5fab374c1 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -1,40 +1,40 @@ -package org.bukkit.craftbukkit.block; - -import net.minecraft.server.TileEntityChest; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.craftbukkit.inventory.CraftInventory; -import org.bukkit.inventory.Inventory; - -/** - * Represents a chest. - * - * @author sk89q - */ -public class CraftChest extends CraftBlockState implements Chest { - private final CraftWorld world; - private final TileEntityChest chest; - - public CraftChest(final Block block) { - super(block); - - world = (CraftWorld)block.getWorld(); - chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ()); - } - - public Inventory getInventory() { - return new CraftInventory(chest); - } - - @Override - public boolean update(boolean force) { - boolean result = super.update(force); - - if (result) { - chest.d(); - } - - return result; - } -} +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityChest; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.inventory.Inventory; + +/** + * Represents a chest. + * + * @author sk89q + */ +public class CraftChest extends CraftBlockState implements Chest { + private final CraftWorld world; + private final TileEntityChest chest; + + public CraftChest(final Block block) { + super(block); + + world = (CraftWorld)block.getWorld(); + chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ()); + } + + public Inventory getInventory() { + return new CraftInventory(chest); + } + + @Override + public boolean update(boolean force) { + boolean result = super.update(force); + + if (result) { + chest.h(); + } + + return result; + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index 44c0bf6c1a..74c1b587b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -1,84 +1,84 @@ -package org.bukkit.craftbukkit.block; - -import net.minecraft.server.TileEntityMobSpawner; -import org.bukkit.block.Block; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.block.MobSpawner; -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.entity.CreatureType; -import org.bukkit.entity.MobType; - -public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner { - private final CraftWorld world; - private final TileEntityMobSpawner spawner; - - public CraftCreatureSpawner(final Block block) { - super(block); - - world = (CraftWorld)block.getWorld(); - spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ()); - } - - public CreatureType getCreatureType() { - return CreatureType.fromName(spawner.h); - } - - public void setCreatureType(CreatureType creatureType) { - spawner.h = creatureType.getName(); - } - - public String getCreatureTypeId() { - return spawner.h; - } - - public void setCreatureTypeId(String creatureType) { - // Verify input - CreatureType type = CreatureType.fromName(creatureType); - if (type == null) { - return; - } - spawner.h = type.getName(); - } - - public int getDelay() { - return spawner.e; - } - - public void setDelay(int delay) { - spawner.e = delay; - } - - /** - * @deprecated Use getCreatureType() instead. - */ - public MobType getMobType() { - return MobType.fromName(spawner.h); - } - - /** - * @deprecated Use setCreatureType() instead. - */ - public void setMobType(MobType mobType) { - spawner.h = mobType.getName(); - - } - - /** - * @deprecated Use getCreatureTypeId() instead. - */ - public String getMobTypeId() { - return spawner.h; - } - - /** - * @deprecated Use setCreatureTypeId() instead. - */ - public void setMobTypeId(String mobType) { - // Verify input - MobType type = MobType.fromName(mobType); - if (type == null) { - return; - } - spawner.h = type.getName(); - } -} +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityMobSpawner; +import org.bukkit.block.Block; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.block.MobSpawner; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.entity.CreatureType; +import org.bukkit.entity.MobType; + +public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner { + private final CraftWorld world; + private final TileEntityMobSpawner spawner; + + public CraftCreatureSpawner(final Block block) { + super(block); + + world = (CraftWorld)block.getWorld(); + spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ()); + } + + public CreatureType getCreatureType() { + return CreatureType.fromName(spawner.h); + } + + public void setCreatureType(CreatureType creatureType) { + spawner.h = creatureType.getName(); + } + + public String getCreatureTypeId() { + return spawner.h; + } + + public void setCreatureTypeId(String creatureType) { + // Verify input + CreatureType type = CreatureType.fromName(creatureType); + if (type == null) { + return; + } + spawner.h = type.getName(); + } + + public int getDelay() { + return spawner.a; + } + + public void setDelay(int delay) { + spawner.a = delay; + } + + /** + * @deprecated Use getCreatureType() instead. + */ + public MobType getMobType() { + return MobType.fromName(spawner.h); + } + + /** + * @deprecated Use setCreatureType() instead. + */ + public void setMobType(MobType mobType) { + spawner.h = mobType.getName(); + + } + + /** + * @deprecated Use getCreatureTypeId() instead. + */ + public String getMobTypeId() { + return spawner.h; + } + + /** + * @deprecated Use setCreatureTypeId() instead. + */ + public void setMobTypeId(String mobType) { + // Verify input + MobType type = MobType.fromName(mobType); + if (type == null) { + return; + } + spawner.h = type.getName(); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java old mode 100644 new mode 100755 index 602feb5e63..9b519fc20d --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { boolean result = super.update(force); if (result) { - dispenser.d(); + dispenser.h(); } return result; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java old mode 100644 new mode 100755 index fd6e927bff..30ffa6be02 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -1,56 +1,56 @@ -package org.bukkit.craftbukkit.block; - -import net.minecraft.server.TileEntityFurnace; -import org.bukkit.block.Block; -import org.bukkit.block.Furnace; -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.craftbukkit.inventory.CraftInventory; -import org.bukkit.inventory.Inventory; - -/** - * Represents a furnace. - * - * @author sk89q - */ -public class CraftFurnace extends CraftBlockState implements Furnace { - private final CraftWorld world; - private final TileEntityFurnace furnace; - - public CraftFurnace(final Block block) { - super(block); - - world = (CraftWorld)block.getWorld(); - furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ()); - } - - public Inventory getInventory() { - return new CraftInventory(furnace); - } - - @Override - public boolean update(boolean force) { - boolean result = super.update(force); - - if (result) { - furnace.d(); - } - - return result; - } - - public short getBurnTime() { - return (short)furnace.e; - } - - public void setBurnTime(short burnTime) { - furnace.e = burnTime; - } - - public short getCookTime() { - return (short)furnace.g; - } - - public void setCookTime(short cookTime) { - furnace.g = cookTime; - } -} +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityFurnace; +import org.bukkit.block.Block; +import org.bukkit.block.Furnace; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.inventory.Inventory; + +/** + * Represents a furnace. + * + * @author sk89q + */ +public class CraftFurnace extends CraftBlockState implements Furnace { + private final CraftWorld world; + private final TileEntityFurnace furnace; + + public CraftFurnace(final Block block) { + super(block); + + world = (CraftWorld)block.getWorld(); + furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ()); + } + + public Inventory getInventory() { + return new CraftInventory(furnace); + } + + @Override + public boolean update(boolean force) { + boolean result = super.update(force); + + if (result) { + furnace.h(); + } + + return result; + } + + public short getBurnTime() { + return (short)furnace.a; + } + + public void setBurnTime(short burnTime) { + furnace.a = burnTime; + } + + public short getCookTime() { + return (short)furnace.c; + } + + public void setCookTime(short cookTime) { + furnace.c = cookTime; + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index d4116e93ab..ec49c9f930 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { } public byte getNote() { - return note.e; + return note.a; } public void setNote(byte n) { - note.e = n; + note.a = n; } public boolean play() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java old mode 100644 new mode 100755 index 3a275d8add..3b33c0cf47 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -1,4 +1,3 @@ - package org.bukkit.craftbukkit.block; import net.minecraft.server.TileEntitySign; @@ -18,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign { } public String[] getLines() { - return sign.e; + return sign.a; } public String getLine(int index) throws IndexOutOfBoundsException { - return sign.e[index]; + return sign.a[index]; } public void setLine(int index, String line) throws IndexOutOfBoundsException { - sign.e[index] = line; + sign.a[index] = line; } @Override @@ -34,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign { boolean result = super.update(force); if (result) { - sign.d(); + sign.h(); } return result; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index d017bbd079..591bd0da57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -160,7 +160,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { newEntity.inventory.e = newEntity; newEntity.activeContainer = entity.activeContainer; newEntity.defaultContainer = entity.defaultContainer; - newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4); + newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4); newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); newWorld.manager.a(newEntity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java old mode 100644 new mode 100755 index 2135c9c526..c8be38d60f --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -19,12 +19,12 @@ public class CraftSheep extends CraftAnimals implements Sheep { public DyeColor getColor() { EntitySheep entity = (EntitySheep) getHandle(); - return DyeColor.getByData((byte) entity.e_()); + return DyeColor.getByData((byte) entity.n()); } public void setColor(DyeColor color) { EntitySheep entity = (EntitySheep) getHandle(); - entity.a(color.getData()); + entity.a_(color.getData()); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index a723e1480c..57f9a9e9b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -19,15 +19,15 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } public int getSize() { - return getInventory().h_(); + return getInventory().m_(); } public String getName() { - return getInventory().b(); + return getInventory().c(); } public CraftItemStack getItem(int index) { - return new CraftItemStack(getInventory().a(index)); + return new CraftItemStack(getInventory().c_(index)); } public CraftItemStack[] getContents() { @@ -290,7 +290,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } private int getMaxItemStack() { - return getInventory().c(); + return getInventory().n_(); } public void remove(int materialId) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java old mode 100644 new mode 100755 index 4f715bfd41..2f2be14676 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent } public CraftItemStack getItemInHand() { - return new CraftItemStack( getInventory().e() ); + return new CraftItemStack( getInventory().b() ); } public void setItemInHand(ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java index aaa7426ee7..f065836473 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java @@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot { } public Inventory getInventory() { - return new CraftInventory( slot.b ); + return new CraftInventory( slot.e ); } public int getIndex() { - return slot.a; + return slot.d; } public ItemStack getItem() { - return new CraftItemStack( slot.c() ); + return new CraftItemStack( slot.b() ); } }