diff options
Diffstat (limited to 'src/main/java/net/minecraft')
42 files changed, 769 insertions, 816 deletions
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index cc4462d6..f29662bd 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -1,13 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockButton extends Block { @@ -136,15 +136,16 @@ public class BlockButton extends Block { } public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { - // Craftbukkit start - Interact Button + // CraftBukkit start - Interact Button CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + if (bie.isCancelled()) return true; - + // CraftBukkit end + if (world.z) { return true; } @@ -255,4 +256,3 @@ public class BlockButton extends Block { world.b(i, j, k, i, j, k); } } - diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index 9a4d7b5b..cd158e34 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -1,5 +1,6 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.LivingEntity; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftEntity; @@ -7,6 +8,7 @@ import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.entity.EntityDamagedByBlockEvent; import org.bukkit.event.entity.EntityDamagedEvent; +// CraftBukkit end import java.util.Random; @@ -93,23 +95,22 @@ public class BlockCactus extends Block { } public void a(World world, int i, int j, int k, Entity entity) { - // Craftbukkit: ENTITY_DAMAGEBY_BLOCK event + // CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event CraftEntity toPassIn = null; - if(entity instanceof EntityPlayerMP) - { - toPassIn = new CraftPlayer(((WorldServer)world).getServer(), (EntityPlayerMP)entity); - } else if(entity instanceof EntityLiving) - { - toPassIn = new CraftLivingEntity(((WorldServer)world).getServer(), (EntityLiving)entity); + if (entity instanceof EntityPlayerMP) { + toPassIn = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity); + } else if (entity instanceof EntityLiving) { + toPassIn = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity); } - if(toPassIn != null) - { - EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer)world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1); - ((WorldServer)world).getServer().getPluginManager().callEvent(edbbe); - if(edbbe.isCancelled()) return; + + if(toPassIn != null) { + EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1); + ((WorldServer) world).getServer().getPluginManager().callEvent(edbbe); + + if (edbbe.isCancelled()) + return; } - // Craftbukkit TODO: Other entities (when their respective classes are added) hitting a Cactus - entity.a(null, 1); + // CraftBukkit end TODO: Other entities (when their respective classes are added) hitting a Cactus + entity.a(((Entity) (null)), 1); } } - diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java index 90e41e33..9c3ad14b 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java @@ -1,13 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockChest extends BlockContainer { @@ -83,8 +83,8 @@ public class BlockChest extends BlockContainer { TileEntityChest tileentitychest = (TileEntityChest) world.l(i, j, k); label0: - for (int l = 0; l < tileentitychest.a(); l++) { - ItemStack itemstack = tileentitychest.a(l); + for (int l = 0; l < ((IInventory) (tileentitychest)).a(); l++) { + ItemStack itemstack = ((IInventory) (tileentitychest)).a(l); if (itemstack == null) { continue; @@ -109,7 +109,7 @@ public class BlockChest extends BlockContainer { entityitem.s = (float) a.nextGaussian() * f3; entityitem.t = (float) a.nextGaussian() * f3 + 0.2F; entityitem.u = (float) a.nextGaussian() * f3; - world.a(entityitem); + world.a(((Entity) (entityitem))); } while (true); } @@ -117,7 +117,7 @@ public class BlockChest extends BlockContainer { } public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { - Object obj = (TileEntityChest) world.l(i, j, k); + Object obj = (((TileEntityChest) world.l(i, j, k))); if (world.d(i, j + 1, k)) { return true; @@ -135,35 +135,36 @@ public class BlockChest extends BlockContainer { return true; } if (world.a(i - 1, j, k) == bh) { - obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.l(i - 1, j, k), ((IInventory) (obj))); + obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.l(i - 1, j, k))), ((IInventory) (obj))))); } if (world.a(i + 1, j, k) == bh) { - obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)), (TileEntityChest) world.l(i + 1, j, k)); + obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.l(i + 1, j, k)))))); } if (world.a(i, j, k - 1) == bh) { - obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.l(i, j, k - 1), ((IInventory) (obj))); + obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.l(i, j, k - 1))), ((IInventory) (obj))))); } if (world.a(i, j, k + 1) == bh) { - obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)), (TileEntityChest) world.l(i, j, k + 1)); + obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.l(i, j, k + 1)))))); } if (world.z) { return true; } else { - // Craftbukkit start - Interact Chest + // CraftBukkit start - Interact Chest CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - - if (!bie.isCancelled()) entityplayer.a(((IInventory) (obj))); - + + if (bie.isCancelled()) return true; + // CraftBukkit end + + entityplayer.a(((IInventory) (obj))); return true; } } protected TileEntity a_() { - return new TileEntityChest(); + return ((TileEntity) (new TileEntityChest())); } } - diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index f051feba..f06c9f69 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -1,13 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockDoor extends Block { @@ -28,8 +28,7 @@ public class BlockDoor extends Block { } public AxisAlignedBB d(World world, int i, int j, int k) { - // Craftbukkit - Downcast necessary for doors to work - a((IBlockAccess) world, i, j, k); + a(((IBlockAccess) (world)), i, j, k); return super.d(world, i, j, k); } @@ -71,14 +70,14 @@ public class BlockDoor extends Block { } return true; } - - // Craftbukkit start - Interact Door + + // CraftBukkit start - Interact Door CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + // Craftbukkit the client updates the doors before the server does it's thing. // Forcibly send correct data. if (bie.isCancelled()) { @@ -86,7 +85,8 @@ public class BlockDoor extends Block { ((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j + 1, k, (WorldServer) world)); return true; } - + // CraftBukkit end + if (world.a(i, j + 1, k) == bh) { world.b(i, j + 1, k, (l ^ 4) + 8); } @@ -192,4 +192,3 @@ public class BlockDoor extends Block { } } } - diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index cc1dd943..58a7a417 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -1,12 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.BlockFace; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockFromToEvent; +// CraftBukkit end public class BlockFlowing extends BlockFluids { @@ -86,8 +87,8 @@ public class BlockFlowing extends BlockFluids { } else { i(world, i1, j1, k1); } - - // Craftbukkit start + + // CraftBukkit start CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i1, j1, k1); if (l(world, i1, j1 - 1, k1)) { // Craftbucket send "down" to the server @@ -101,6 +102,7 @@ public class BlockFlowing extends BlockFluids { world.b(i1, j1 - 1, k1, bh, l1 + 8); } } + // CraftBukkit end } else if (l1 >= 0 && (l1 == 0 || k(world, i1, j1 - 1, k1))) { boolean aflag[] = j(world, i1, j1, k1); int k2 = l1 + byte0; @@ -111,10 +113,10 @@ public class BlockFlowing extends BlockFluids { if (k2 >= 8) { return; } - // Craftbukkit all four cardinal directions. Do not change the order! + // CraftBukkit start - all four cardinal directions. Do not change the order! BlockFace[] faces = new BlockFace[]{ BlockFace.North, BlockFace.South, BlockFace.East, BlockFace.West }; int index = 0; - for (BlockFace currentFace : faces) { + for (BlockFace currentFace: faces) { if (aflag[index]) { BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace); ((WorldServer) world).getServer().getPluginManager().callEvent(event); @@ -124,8 +126,8 @@ public class BlockFlowing extends BlockFluids { } index++; } + // CraftBukkit end } - // Craftbukkit stop } private void f(World world, int i1, int j1, int k1, int l1) { @@ -278,4 +280,3 @@ public class BlockFlowing extends BlockFluids { } } } - diff --git a/src/main/java/net/minecraft/server/BlockFurnace.java b/src/main/java/net/minecraft/server/BlockFurnace.java index 64df942c..77c7e0dc 100644 --- a/src/main/java/net/minecraft/server/BlockFurnace.java +++ b/src/main/java/net/minecraft/server/BlockFurnace.java @@ -1,13 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockFurnace extends BlockContainer { @@ -47,7 +47,7 @@ public class BlockFurnace extends BlockContainer { if (Block.o[k1] && !Block.o[j1]) { byte0 = 4; } - world.b(i, j, k, byte0); + world.b(i, j, k, ((int) (byte0))); } public int a(int i) { @@ -68,15 +68,16 @@ public class BlockFurnace extends BlockContainer { if (world.z) { return true; } else { - // Craftbukkit start - Interact Furnace + // CraftBukkit start - Interact Furnace CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + if (bie.isCancelled()) return true; - + // CraftBukkit end + TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.l(i, j, k); entityplayer.a(tileentityfurnace); @@ -98,7 +99,7 @@ public class BlockFurnace extends BlockContainer { } protected TileEntity a_() { - return new TileEntityFurnace(); + return ((TileEntity) (new TileEntityFurnace())); } public void a(World world, int i, int j, int k, EntityLiving entityliving) { @@ -118,4 +119,3 @@ public class BlockFurnace extends BlockContainer { } } } - diff --git a/src/main/java/net/minecraft/server/BlockJukeBox.java b/src/main/java/net/minecraft/server/BlockJukeBox.java index 8c7e61ad..eafdcc55 100644 --- a/src/main/java/net/minecraft/server/BlockJukeBox.java +++ b/src/main/java/net/minecraft/server/BlockJukeBox.java @@ -1,11 +1,11 @@ package net.minecraft.server; - +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockJukeBox extends Block { @@ -21,15 +21,16 @@ public class BlockJukeBox extends Block { int l = world.b(i, j, k); if (l > 0) { - // Craftbukkit start - Interact Jukebox + // CraftBukkit start - Interact Jukebox CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + if (bie.isCancelled()) return true; - + // CraftBukkit end + f(world, i, j, k, l); return true; } else { @@ -38,7 +39,7 @@ public class BlockJukeBox extends Block { } public void f(World world, int i, int j, int k, int l) { - world.a((String) null, i, j, k); + world.a(((String) (null)), i, j, k); world.b(i, j, k, 0); int i1 = (Item.aU.aW + l) - 1; float f1 = 0.7F; @@ -48,7 +49,7 @@ public class BlockJukeBox extends Block { EntityItem entityitem = new EntityItem(world, (double) i + d, (double) j + d1, (double) k + d2, new ItemStack(i1)); entityitem.c = 10; - world.a(entityitem); + world.a(((Entity) (entityitem))); } public void a(World world, int i, int j, int k, int l, float f1) { @@ -61,4 +62,3 @@ public class BlockJukeBox extends Block { super.a(world, i, j, k, l, f1); } } - diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index 24d64514..efbf2a10 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -1,12 +1,13 @@ package net.minecraft.server; - import java.util.Random; + +// CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.Event.Type; import org.bukkit.event.block.LeavesDecayEvent; - +// CraftBukkit end public class BlockLeaves extends BlockLeavesBase { @@ -33,11 +34,8 @@ public class BlockLeaves extends BlockLeavesBase { world.c(i + j1, j + k1, k + l1, 7); } } - } - } - } } @@ -71,9 +69,7 @@ public class BlockLeaves extends BlockLeavesBase { b[(k1 + j1) * i1 + (j2 + j1) * byte1 + (l2 + j1)] = -1; } } - } - } for (int l1 = 1; l1 <= 4; l1++) { @@ -102,13 +98,9 @@ public class BlockLeaves extends BlockLeavesBase { b[(k2 + j1) * i1 + (i3 + j1) * byte1 + (k3 + j1 + 1)] = l1; } } - } - } - } - } int i2 = b[j1 * i1 + j1 * byte1 + j1]; @@ -121,16 +113,14 @@ public class BlockLeaves extends BlockLeavesBase { } private void g(World world, int i, int j, int k) { - // Craftbukkit start - CraftServer server = ((WorldServer)world).getServer(); - CraftWorld cworld = ((WorldServer)world).getWorld(); + // CraftBukkit start + CraftServer server = ((WorldServer) world).getServer(); + CraftWorld cworld = ((WorldServer) world).getWorld(); LeavesDecayEvent event = new LeavesDecayEvent(Type.LEAVES_DECAY, cworld.getBlockAt(i, j, k)); server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - // Craftbukkit end + + if (event.isCancelled()) return; + // CraftBukkit end a_(world, i, j, k, world.b(i, j, k)); world.d(i, j, k, 0); @@ -152,4 +142,3 @@ public class BlockLeaves extends BlockLeavesBase { super.b(world, i, j, k, entity); } } - diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java index b8204e16..796c0757 100644 --- a/src/main/java/net/minecraft/server/BlockLever.java +++ b/src/main/java/net/minecraft/server/BlockLever.java @@ -1,10 +1,11 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockLever extends Block { @@ -138,21 +139,22 @@ public class BlockLever extends Block { if (world.z) { return true; } - - // Craftbukkit start - Interact Lever + + // CraftBukkit start - Interact Lever CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + // Craftbukkit the client updates the doors before the server does it's thing. // Forcibly send correct data. if (bie.isCancelled()) { ((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world)); return true; } - + // CraftBukkit end + int l = world.b(i, j, k); int i1 = l & 7; int j1 = 8 - (l & 8); @@ -228,4 +230,3 @@ public class BlockLever extends Block { return true; } } - diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index 4745f678..0e984995 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -1,15 +1,15 @@ package net.minecraft.server; - import java.util.List; import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockPressurePlate extends Block { @@ -73,22 +73,24 @@ public class BlockPressurePlate extends Block { if (world.b(i, j, k) == 1) { return; } else { + // CraftBukkit start - Interact Pressure Plate if (entity instanceof EntityLiving) { - // Craftbukkit start - Interact Pressure Plate CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftLivingEntity craftEntity = null; + if (entity instanceof EntityPlayerMP) { craftEntity = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity); } else { craftEntity = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity); } BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, craftEntity); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + if (bie.isCancelled()) return; } - + // CraftBukkit end + g(world, i, j, k); return; } @@ -101,7 +103,7 @@ public class BlockPressurePlate extends Block { List list = null; if (a == EnumMobType.a) { - list = world.b(null, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); + list = world.b(((Entity) (null)), AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); } if (a == EnumMobType.b) { list = world.a(net.minecraft.server.EntityLiving.class, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); @@ -168,4 +170,3 @@ public class BlockPressurePlate extends Block { return true; } } - diff --git a/src/main/java/net/minecraft/server/BlockWorkbench.java b/src/main/java/net/minecraft/server/BlockWorkbench.java index 08977d50..4ef0e564 100644 --- a/src/main/java/net/minecraft/server/BlockWorkbench.java +++ b/src/main/java/net/minecraft/server/BlockWorkbench.java @@ -1,10 +1,11 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockInteractEvent; - +// CraftBukkit end public class BlockWorkbench extends Block { @@ -31,18 +32,18 @@ public class BlockWorkbench extends Block { if (world.z) { return true; } else { - // Craftbukkit start - Interact Workbench + // CraftBukkit start - Interact Workbench CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); - + ((WorldServer) world).getServer().getPluginManager().callEvent(bie); - + if (bie.isCancelled()) return true; - + // CraftBukkit end + entityplayer.a(i, j, k); return true; } } } - diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 816ae774..917d116b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -1,17 +1,17 @@ package net.minecraft.server; - import java.io.IOException; import java.util.*; + +// CraftBukkit start import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.Event.Type; import org.bukkit.event.world.ChunkLoadedEvent; +// CraftBukkit end - -public class ChunkProviderServer - implements IChunkProvider { +public class ChunkProviderServer implements IChunkProvider { private Set a; private Chunk b; @@ -22,10 +22,10 @@ public class ChunkProviderServer private WorldServer g; public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { - a = new HashSet(); - e = new HashMap(); - f = new ArrayList(); - b = new Chunk(worldserver, new byte[32768], 0, 0); + a = ((Set) (new HashSet())); + e = ((Map) (new HashMap())); + f = ((List) (new ArrayList())); + b = new Chunk(((World) (worldserver)), new byte[32768], 0, 0); b.q = true; b.p = true; g = worldserver; @@ -36,7 +36,7 @@ public class ChunkProviderServer public boolean a(int i, int j) { ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); - return e.containsKey(chunkcoordinates); + return e.containsKey(((chunkcoordinates))); } public void c(int i, int j) { @@ -45,15 +45,15 @@ public class ChunkProviderServer char c1 = '\200'; if (k < -c1 || k > c1 || l < -c1 || l > c1) { - a.add(new ChunkCoordinates(i, j)); + a.add(((new ChunkCoordinates(i, j)))); } } public Chunk d(int i, int j) { ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); - a.remove(new ChunkCoordinates(i, j)); - Chunk chunk = (Chunk) e.get(chunkcoordinates); + a.remove(((new ChunkCoordinates(i, j)))); + Chunk chunk = (Chunk) e.get(((chunkcoordinates))); if (chunk == null) { chunk = e(i, j); @@ -64,14 +64,14 @@ public class ChunkProviderServer chunk = c.b(i, j); } } - e.put(chunkcoordinates, chunk); - f.add(chunk); + e.put(((chunkcoordinates)), ((chunk))); + f.add(((chunk))); chunk.c(); if (chunk != null) { chunk.d(); } - // Craftbukkit start + // CraftBukkit start CraftServer server = g.getServer(); if (server != null) { /* @@ -83,19 +83,19 @@ public class ChunkProviderServer CraftChunk cchunk = world.updateChunk(i, j); server.getPluginManager().callEvent(new ChunkLoadedEvent(Type.CHUNK_LOADED, cchunk)); } - // Craftbukkit end + // CraftBukkit end if (!chunk.n && a(i + 1, j + 1) && a(i, j + 1) && a(i + 1, j)) { - a(this, i, j); + a(((IChunkProvider) (this)), i, j); } if (a(i - 1, j) && !b(i - 1, j).n && a(i - 1, j + 1) && a(i, j + 1) && a(i - 1, j)) { - a(this, i - 1, j); + a(((IChunkProvider) (this)), i - 1, j); } if (a(i, j - 1) && !b(i, j - 1).n && a(i + 1, j - 1) && a(i, j - 1) && a(i + 1, j)) { - a(this, i, j - 1); + a(((IChunkProvider) (this)), i, j - 1); } if (a(i - 1, j - 1) && !b(i - 1, j - 1).n && a(i - 1, j - 1) && a(i, j - 1) && a(i - 1, j)) { - a(this, i - 1, j - 1); + a(((IChunkProvider) (this)), i - 1, j - 1); } } return chunk; @@ -103,7 +103,7 @@ public class ChunkProviderServer public Chunk b(int i, int j) { ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); - Chunk chunk = (Chunk) e.get(chunkcoordinates); + Chunk chunk = (Chunk) e.get(((chunkcoordinates))); if (chunk == null) { if (g.x) { @@ -121,7 +121,7 @@ public class ChunkProviderServer return null; } try { - Chunk chunk = d.a(g, i, j); + Chunk chunk = d.a(((World) (g)), i, j); if (chunk != null) { chunk.s = g.e; @@ -138,7 +138,7 @@ public class ChunkProviderServer return; } try { - d.b(g, chunk); + d.b(((World) (g)), chunk); } catch (Exception exception) { exception.printStackTrace(); } @@ -150,8 +150,8 @@ public class ChunkProviderServer } try { chunk.s = g.e; - d.a(g, chunk); - } catch (Throwable ioexception) { // Craftbukkit: Cast down to compile + d.a(((World) (g)), chunk); + } catch (Throwable ioexception) { // CraftBukkit -- downcast to work ioexception.printStackTrace(); } } @@ -206,9 +206,9 @@ public class ChunkProviderServer chunk.e(); b(chunk); a(chunk); - a.remove(chunkcoordinates); - e.remove(chunkcoordinates); - f.remove(chunk); + a.remove(((chunkcoordinates))); + e.remove(((chunkcoordinates))); + f.remove(((chunk))); } } @@ -223,4 +223,3 @@ public class ChunkProviderServer return !g.C; } } - diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 759651c7..991fe363 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1,16 +1,16 @@ package net.minecraft.server; - +// CraftBukkit start import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamagedEvent; +// CraftBukkit end import java.util.List; import java.util.Random; - public abstract class Entity { private static int a = 0; @@ -185,7 +185,6 @@ public abstract class Entity { l.a("splash", p + (double) f4, f2 + 1.0F, r + (double) f6, s, t, u); } - } N = 0.0F; ab = true; @@ -280,7 +279,6 @@ public abstract class Entity { d3 += d9; } } - } List list = l.a(this, z.a(d1, d2, d3)); @@ -377,7 +375,7 @@ public abstract class Entity { double d13 = r - d5; if (M && !flag) { - L += (double) MathHelper.a(d11 * d11 + d13 * d13) * 0.59999999999999998D; + L += ((float) ((double) MathHelper.a(d11 * d11 + d13 * d13) * 0.59999999999999998D)); int k3 = MathHelper.b(p); int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H); int l1 = MathHelper.b(r); @@ -412,9 +410,7 @@ public abstract class Entity { Block.m[l5].a(l, i5, j5, k5, this); } } - } - } R *= 0.4F; @@ -444,7 +440,7 @@ public abstract class Entity { N = 0.0F; } } else if (d1 < 0.0D) { - N -= d1; + N -= ((float) (d1)); } } @@ -458,20 +454,23 @@ public abstract class Entity { protected void b(int i1) { if (!ae) { - if(this instanceof EntityLiving) - { + // CraftBukkit start + if(this instanceof EntityLiving) { CraftEntity defender = null; CraftServer server = ((WorldServer)l).getServer(); - if(this instanceof EntityPlayerMP) - { + + if (this instanceof EntityPlayerMP) { defender = new CraftPlayer(server, (EntityPlayerMP)this); } else { defender = new CraftLivingEntity(server, (EntityLiving)this); } + EntityDamagedEvent ede = new EntityDamagedEvent(defender, EntityDamagedEvent.DamageCause.FIRE, i1); server.getPluginManager().callEvent(ede); - if(ede.isCancelled()) return; + + if (ede.isCancelled()) return; } + // CraftBukkit end a(((Entity) (null)), i1); } } @@ -535,8 +534,7 @@ public abstract class Entity { return l.k(i1, j1, k1); } - public void b(double d1, double d2, double d3, float f1, - float f2) { + public void b(double d1, double d2, double d3, float f1, float f2) { m = p = d1; n = q = d2; o = r = d3; @@ -555,8 +553,7 @@ public abstract class Entity { b(f1, f2); } - public void c(double d1, double d2, double d3, float f1, - float f2) { + public void c(double d1, double d2, double d3, float f1, float f2) { m = p = d1; n = q = d2 + (double) H; o = r = d3; @@ -665,15 +662,15 @@ public abstract class Entity { } public void d(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Pos", a(new double[] { + nbttagcompound.a("Pos", ((NBTBase) (a(new double[] { p, q, r - })); - nbttagcompound.a("Motion", a(new double[] { + })))); + nbttagcompound.a("Motion", ((NBTBase) (a(new double[] { s, t, u - })); - nbttagcompound.a("Rotation", a(new float[] { + })))); + nbttagcompound.a("Rotation", ((NBTBase) (a(new float[] { v, w - })); + })))); nbttagcompound.a("FallDistance", N); nbttagcompound.a("Fire", (short) Z); nbttagcompound.a("Air", (short) ad); @@ -696,8 +693,8 @@ public abstract class Entity { x = v = ((NBTTagFloat) nbttaglist2.a(0)).a; y = w = ((NBTTagFloat) nbttaglist2.a(1)).a; N = nbttagcompound.f("FallDistance"); - Z = nbttagcompound.c("Fire"); - ad = nbttagcompound.c("Air"); + Z = ((int) (nbttagcompound.c("Fire"))); + ad = ((int) (nbttagcompound.c("Air"))); A = nbttagcompound.l("OnGround"); a(p, q, r); b(nbttagcompound); @@ -719,7 +716,7 @@ public abstract class Entity { for (int j1 = 0; j1 < i1; j1++) { double d1 = ad2[j1]; - nbttaglist.a(new NBTTagDouble(d1)); + nbttaglist.a(((NBTBase) (new NBTTagDouble(d1)))); } return nbttaglist; @@ -733,7 +730,7 @@ public abstract class Entity { for (int j1 = 0; j1 < i1; j1++) { float f1 = af2[j1]; - nbttaglist.a(new NBTTagFloat(f1)); + nbttaglist.a(((NBTBase) (new NBTTagFloat(f1)))); } return nbttaglist; @@ -747,7 +744,7 @@ public abstract class Entity { EntityItem entityitem = new EntityItem(l, p, q + (double) f1, r, new ItemStack(i1, j1)); entityitem.c = 10; - l.a(entityitem); + l.a(((Entity) (entityitem))); return entityitem; } @@ -813,8 +810,8 @@ public abstract class Entity { } e -= d1; d -= d2; - v += d1; - w += d2; + v += ((float) (d1)); + w += ((float) (d2)); } public void A() { @@ -829,10 +826,17 @@ public abstract class Entity { return (double) J * 0.75D; } + public void e(Entity entity) { + // CraftBukkit start + setPassengerOf(entity); + } + public void setPassengerOf(Entity entity) { // e(null) doesn't really fly for overloaded methods, // so this method is needed - + + //CraftBukkit end + d = 0.0D; e = 0.0D; if (entity == null) { @@ -858,10 +862,6 @@ public abstract class Entity { k = entity; entity.j = this; } - - public void e(Entity entity) { - setPassengerOf(entity); - } public Vec3D C() { return null; @@ -872,6 +872,4 @@ public abstract class Entity { public int[] E() { return null; } - } - diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 92412d95..0e59d97e 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -1,12 +1,13 @@ package net.minecraft.server; import java.util.List; +import java.util.Random; +// CraftBukkit start import org.bukkit.Location; import org.bukkit.craftbukkit.CraftBoat; import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftMappable; -import org.bukkit.craftbukkit.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.vehicle.VehicleCreateEvent; @@ -14,10 +15,9 @@ import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; +// CraftBukkit end -public class EntityBoat extends Entity implements CraftMappable { - - private CraftBoat boat; +public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit public int a; public int b; @@ -29,9 +29,13 @@ public class EntityBoat extends Entity implements CraftMappable { private double ak; private double al; + // CraftBukkit start + private CraftBoat boat; + public CraftEntity getCraftEntity() { return boat; } + // CraftBukkit end public EntityBoat(World world) { super(world); @@ -42,10 +46,8 @@ public class EntityBoat extends Entity implements CraftMappable { a(1.5F, 0.6F); H = J / 2.0F; M = false; - - // CraftBukkit start - handleCreation(world); - // CraftBukkit end + + handleCreation(world); // CraftBukkit } public AxisAlignedBB d(Entity entity) { @@ -70,17 +72,14 @@ public class EntityBoat extends Entity implements CraftMappable { n = d2; o = d3; - // CraftBukkit start - handleCreation(world); - // CraftBukkit end + handleCreation(world); // CraftBukkit } // CraftBukkit start private void handleCreation(World world) { CraftServer server = ((WorldServer) world).getServer(); boat = new CraftBoat(server, this); - VehicleCreateEvent event = new VehicleCreateEvent( - Type.VEHICLE_CREATE, boat); + VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, boat); server.getPluginManager().callEvent(event); } // CraftBukkit end @@ -91,16 +90,14 @@ public class EntityBoat extends Entity implements CraftMappable { public boolean a(Entity entity, int i) { // CraftBukkit start - VehicleDamageEvent event = new VehicleDamageEvent( - Type.VEHICLE_DAMAGE, boat, - ((WorldServer)l).getWorld().toCraftEntity(entity), i); - ((WorldServer)l).getServer().getPluginManager().callEvent(event); - + VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, boat, ((WorldServer)l).getWorld().toCraftEntity(entity), i); + ((WorldServer) l).getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { return true; } // CraftBukkit end - + if (this.l.z || G) { return true; } @@ -127,12 +124,14 @@ public class EntityBoat extends Entity implements CraftMappable { } public void b_() { + // CraftBukkit start double prevX = p; double prevY = q; double prevZ = r; float prevYaw = v; float prevPitch = w; - + // CraftBukkit end + super.b_(); if (b > 0) { b--; @@ -169,8 +168,8 @@ public class EntityBoat extends Entity implements CraftMappable { for (; d13 >= 180D; d13 -= 360D) { ; } - v += d13 / (double) d; - w += (al - (double) w) / (double) d; + v += ((float) (d13 / (double) d)); + w += ((float) ((al - (double) w) / (double) d)); d--; a(d4, d7, d10); b(v, w); @@ -252,7 +251,6 @@ public class EntityBoat extends Entity implements CraftMappable { for (int j1 = 0; j1 < 2; j1++) { a(Item.B.aW, 1, 0.0F); } - } } else { s *= 0.99000000953674316D; @@ -281,29 +279,30 @@ public class EntityBoat extends Entity implements CraftMappable { if (d25 < -20D) { d25 = -20D; } - v += d25; + v += ((float) (d25)); b(v, w); - + // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); VehicleMoveEvent event = new VehicleMoveEvent( - Type.VEHICLE_MOVE, boat, - new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), - new Location(((WorldServer)l).getWorld(), p, q, r, v, w)); + Type.VEHICLE_MOVE, + boat, + new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), + new Location(((WorldServer)l).getWorld(), p, q, r, v, w) + ); server.getPluginManager().callEvent(event); // CraftBukkit end - - List list = this.l.b(this, z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + List list = this.l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { for (int k1 = 0; k1 < list.size(); k1++) { Entity entity = (Entity) list.get(k1); if (entity != j && entity.v() && (entity instanceof EntityBoat)) { - entity.c(this); + entity.c(((Entity) (this))); } } - } if (j != null && j.G) { j = null; @@ -322,21 +321,19 @@ public class EntityBoat extends Entity implements CraftMappable { } } + // CraftBukkit start public void c(Entity entity) { - // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( - Type.VEHICLE_COLLISION_ENTITY, boat, - ((WorldServer)l).getWorld().toCraftEntity(entity)); + VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, boat, ((WorldServer)l).getWorld().toCraftEntity(entity)); server.getPluginManager().callEvent(collsionEvent); - + if (collsionEvent.isCancelled()) { return; } - // CraftBukkit end - + super.c(entity); } + // CraftBukkit end protected void a(NBTTagCompound nbttagcompound) {} @@ -349,20 +346,16 @@ public class EntityBoat extends Entity implements CraftMappable { if (!l.z) { // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleEnterEvent event = new VehicleEnterEvent( - Type.VEHICLE_ENTER, - boat, - ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); + VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, boat, ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); server.getPluginManager().callEvent(event); - + if (event.isCancelled()) { return true; } // CraftBukkit end - - entityplayer.e(this); + + entityplayer.e(((Entity) (this))); } return true; } } - diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index cb54f5fe..d61296f7 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -1,7 +1,9 @@ package net.minecraft.server; import java.util.List; +import java.util.Random; +// CraftBukkit start import org.bukkit.Location; import org.bukkit.Vector; import org.bukkit.craftbukkit.CraftEntity; @@ -10,12 +12,10 @@ import org.bukkit.craftbukkit.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.vehicle.*; +// CraftBukkit end -public class EntityMinecart extends Entity - implements IInventory, CraftMappable { +public class EntityMinecart extends Entity implements IInventory, CraftMappable { // CraftBukkit - private CraftMinecart minecart; - private ItemStack ak[]; public int a; public int b; @@ -94,7 +94,10 @@ public class EntityMinecart extends Entity private double aq; private double ar; private double as; - + + // CraftBukkit start + private CraftMinecart minecart; + private boolean slowWhenEmpty = true; private double derailedX = 0.5; private double derailedY = 0.5; @@ -107,6 +110,11 @@ public class EntityMinecart extends Entity return minecart; } + public ItemStack[] getContents() { + return this.ak; + } + // CraftBukkit end + public EntityMinecart(World world) { super(world); ak = new ItemStack[36]; @@ -118,17 +126,9 @@ public class EntityMinecart extends Entity a(0.98F, 0.7F); H = J / 2.0F; M = false; - - // CraftBukkit start - handleCreation(world); - // CraftBukkit end - } - // CraftBukkit start - public ItemStack[] getContents() { - return this.ak; + handleCreation(world); // CraftBukkit } - // CraftBukkit end public AxisAlignedBB d(Entity entity) { return entity.z; @@ -142,8 +142,7 @@ public class EntityMinecart extends Entity return true; } - public EntityMinecart(World world, double d1, double d2, double d3, - int i) { + public EntityMinecart(World world, double d1, double d2, double d3, int i) { this(world); a(d1, d2 + (double) H, d3); s = 0.0D; @@ -153,18 +152,15 @@ public class EntityMinecart extends Entity n = d2; o = d3; d = i; - - // CraftBukkit start - handleCreation(world); - // CraftBukkit end + + handleCreation(world); // CraftBukkit } // CraftBukkit start private void handleCreation(World world) { CraftServer server = ((WorldServer) world).getServer(); minecart = CraftMinecart.getCraftMinecart(server, this); - VehicleCreateEvent event = new VehicleCreateEvent( - Type.VEHICLE_CREATE, minecart); + VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, minecart); server.getPluginManager().callEvent(event); } // CraftBukkit end @@ -175,18 +171,15 @@ public class EntityMinecart extends Entity public boolean a(Entity entity, int i) { // CraftBukkit start - VehicleDamageEvent event = new VehicleDamageEvent( - Type.VEHICLE_DAMAGE, minecart, - ((WorldServer)l).getWorld().toCraftEntity(entity), i); + VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity), i); ((WorldServer)l).getServer().getPluginManager().callEvent(event); - + if (event.isCancelled()) { return true; } - // CraftBukkit end - i = event.getDamage(); - + // CraftBukkit end + if (l.z || G) { return true; } @@ -238,7 +231,7 @@ public class EntityMinecart extends Entity entityitem.s = (float) W.nextGaussian() * f4; entityitem.t = (float) W.nextGaussian() * f4 + 0.2F; entityitem.u = (float) W.nextGaussian() * f4; - l.a(entityitem); + l.a(((Entity) (entityitem))); } while (true); } @@ -246,12 +239,13 @@ public class EntityMinecart extends Entity } public void b_() { + // CraftBukkit start double prevX = p; double prevY = q; double prevZ = r; float prevYaw = v; float prevPitch = w; - + // CraftBukkit end if (b > 0) { b--; } @@ -271,8 +265,8 @@ public class EntityMinecart extends Entity for (; d4 >= 180D; d4 -= 360D) { ; } - v += d4 / (double) an; - w += (as - (double) w) / (double) an; + v += ((float) (d4 / (double) an)); + w += ((float) ((as - (double) w) / (double) an)); an--; a(d1, d2, d3); b(v, w); @@ -380,6 +374,7 @@ public class EntityMinecart extends Entity } else if (ai[1][1] != 0 && MathHelper.b(p) - i == ai[1][0] && MathHelper.b(r) - i1 == ai[1][2]) { a(p, q + (double) ai[1][1], r); } + // CraftBukkit if (j != null || !slowWhenEmpty) { s *= 0.99699997901916504D; t *= 0.0D; @@ -459,18 +454,21 @@ public class EntityMinecart extends Entity u = d6; } if (A) { + // CraftBukkit start s *= derailedX; t *= derailedY; u *= derailedZ; + // CraftBukkit end } c(s, t, u); if (!A) { + // CraftBukkit start s *= flyingX; t *= flyingY; u *= flyingZ; + // CraftBukkit end } } - w = 0.0F; double d28 = m - p; double d29 = o - r; @@ -498,23 +496,24 @@ public class EntityMinecart extends Entity // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); VehicleMoveEvent event = new VehicleMoveEvent( - Type.VEHICLE_MOVE, minecart, - new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), - new Location(((WorldServer)l).getWorld(), p, q, r, v, w)); + Type.VEHICLE_MOVE, + minecart, + new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), + new Location(((WorldServer)l).getWorld(), p, q, r, v, w) + ); server.getPluginManager().callEvent(event); // CraftBukkit end - - List list = l.b(this, z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + List list = l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && list.size() > 0) { for (int i2 = 0; i2 < list.size(); i2++) { Entity entity = (Entity) list.get(i2); if (entity != j && entity.v() && (entity instanceof EntityMinecart)) { - entity.c(this); + entity.c(((Entity) (this))); } } - } if (j != null && j.G) { j = null; @@ -598,11 +597,11 @@ public class EntityMinecart extends Entity nbttagcompound1.a("Slot", (byte) i); ak[i].a(nbttagcompound1); - nbttaglist.a(nbttagcompound1); + nbttaglist.a(((NBTBase) (nbttagcompound1))); } } - nbttagcompound.a("Items", nbttaglist); + nbttagcompound.a("Items", ((NBTBase) (nbttaglist))); } } @@ -611,7 +610,7 @@ public class EntityMinecart extends Entity if (d == 2) { f = nbttagcompound.g("PushX"); aj = nbttagcompound.g("PushZ"); - e = nbttagcompound.c("Fuel"); + e = ((int) (nbttagcompound.c("Fuel"))); } else if (d == 1) { NBTTagList nbttaglist = nbttagcompound.k("Items"); @@ -624,7 +623,6 @@ public class EntityMinecart extends Entity ak[k] = new ItemStack(nbttagcompound1); } } - } } @@ -638,35 +636,31 @@ public class EntityMinecart extends Entity // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( - Type.VEHICLE_COLLISION_ENTITY, minecart, - ((WorldServer)l).getWorld().toCraftEntity(entity)); + VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity)); server.getPluginManager().callEvent(collsionEvent); - + if (collsionEvent.isCancelled()) { return; } - // CraftBukkit end - - if (!collsionEvent.isPickupCancelled() - && (entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) - && d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) { - // CraftBukkit start - VehicleEnterEvent enterEvent = new VehicleEnterEvent( - Type.VEHICLE_ENTER, minecart, - ((WorldServer)l).getWorld().toCraftEntity(entity)); - server.getPluginManager().callEvent(enterEvent); - // CraftBukkit end - - if (!enterEvent.isCancelled()) { - entity.e(this); + + if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) { + if (!collsionEvent.isPickupCancelled()) { + VehicleEnterEvent enterEvent = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity)); + server.getPluginManager().callEvent(enterEvent); + + if (!enterEvent.isCancelled()) { + entity.e(((Entity) (this))); + } } } + // CraftBukkit end + double d1 = entity.p - p; double d2 = entity.r - r; double d3 = d1 * d1 + d2 * d2; - if (!collsionEvent.isCollisionCancelled() && d3 >= 9.9999997473787516E-005D) { + // CraftBukkit + if (d3 >= 9.9999997473787516E-005D && !collsionEvent.isCollisionCancelled()) { d3 = MathHelper.a(d3); d1 /= d3; d2 /= d3; @@ -760,37 +754,34 @@ public class EntityMinecart extends Entity public void d() {} - public boolean a(EntityPlayer entityplayer) { + public boolean a(EntityPlayer entityplayer) { if (d == 0) { if (j != null && (j instanceof EntityPlayer) && j != entityplayer) { return true; } if (!l.z) { // CraftBukkit start - CraftServer server = ((WorldServer)l).getServer(); - VehicleEnterEvent event = new VehicleEnterEvent( - Type.VEHICLE_ENTER, - minecart, - ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); + CraftServer server = ((WorldServer) l).getServer(); + VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); server.getPluginManager().callEvent(event); - + if (event.isCancelled()) { return true; } // CraftBukkit end - - entityplayer.e(this); + + entityplayer.e(((Entity) (this))); } } else if (d == 1) { if (!l.z) { - entityplayer.a((IInventory)this); + entityplayer.a(((IInventory) (this))); } } else if (d == 2) { ItemStack itemstack = entityplayer.an.e(); if (itemstack != null && itemstack.c == Item.k.aW) { if (--itemstack.a == 0) { - entityplayer.an.a(entityplayer.an.c, null); + entityplayer.an.a(entityplayer.an.c, ((ItemStack) (null))); } e += 1200; } @@ -804,8 +795,6 @@ public class EntityMinecart extends Entity if (G) { return false; } - return entityplayer.b(this) <= 64D; + return entityplayer.b(((Entity) (this))) <= 64D; } - } - diff --git a/src/main/java/net/minecraft/server/EntityPlayerMP.java b/src/main/java/net/minecraft/server/EntityPlayerMP.java index 01138f2d..ee13cbce 100644 --- a/src/main/java/net/minecraft/server/EntityPlayerMP.java +++ b/src/main/java/net/minecraft/server/EntityPlayerMP.java @@ -1,11 +1,8 @@ package net.minecraft.server; - import java.util.*; - -public class EntityPlayerMP extends EntityPlayer - implements ICrafting { +public class EntityPlayerMP extends EntityPlayer implements ICrafting { public NetServerHandler a; public MinecraftServer b; @@ -26,8 +23,8 @@ public class EntityPlayerMP extends EntityPlayer public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s1, ItemInWorldManager iteminworldmanager) { super(world); - f = new LinkedList(); - aj = new HashSet(); + f = ((List) (new LinkedList())); + aj = ((Set) (new HashSet())); al = false; bE = 0xfa0a1f01; bF = 60; @@ -44,15 +41,14 @@ public class EntityPlayerMP extends EntityPlayer c((double) i + 0.5D, l, (double) j + 0.5D, 0.0F, 0.0F); b = minecraftserver; S = 0.0F; - iteminworldmanager.a = this; + iteminworldmanager.a = ((EntityPlayer) (this)); aw = s1; c = iteminworldmanager; H = 0.0F; } public void k() { - // CraftBukkit: Downcast to make it work. - ap.a((ICrafting)this); + ap.a(((ICrafting) (this))); } public int[] E() { @@ -66,7 +62,7 @@ public class EntityPlayerMP extends EntityPlayer int j = a(i); if (j != bG[i]) { - b.k.a(this, new Packet5PlayerInventory(g, i, j)); + b.k.a(((Entity) (this)), ((Packet) (new Packet5PlayerInventory(g, i, j)))); bG[i] = j; } } @@ -123,11 +119,11 @@ public class EntityPlayerMP extends EntityPlayer for (int i = 0; i < f.size(); i++) { ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) f.get(i); - double d2 = chunkcoordintpair1.a(this); + double d2 = chunkcoordintpair1.a(((Entity) (this))); if (i == 0 || d2 < d1) { chunkcoordintpair = chunkcoordintpair1; - d1 = chunkcoordintpair1.a(this); + d1 = chunkcoordintpair1.a(((Entity) (this))); } } @@ -141,18 +137,17 @@ public class EntityPlayerMP extends EntityPlayer flag = true; } if (flag) { - f.remove(chunkcoordintpair); - a.b(new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, b.e)); + f.remove(((chunkcoordintpair))); + a.b(((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, ((World) (b.e)))))); List list = b.e.d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16); for (int j = 0; j < list.size(); j++) { a((TileEntity) list.get(j)); } - } } if (ba != bE) { - a.b(new Packet8(ba)); + a.b(((Packet) (new Packet8(ba)))); bE = ba; } } @@ -176,10 +171,10 @@ public class EntityPlayerMP extends EntityPlayer public void c(Entity entity, int i) { if (!entity.G) { if (entity instanceof EntityItem) { - b.k.a(entity, new Packet22Collect(entity.g, g)); + b.k.a(entity, ((Packet) (new Packet22Collect(entity.g, g)))); } if (entity instanceof EntityArrow) { - b.k.a(entity, new Packet22Collect(entity.g, g)); + b.k.a(entity, ((Packet) (new Packet22Collect(entity.g, g)))); } } super.c(entity, i); @@ -190,7 +185,7 @@ public class EntityPlayerMP extends EntityPlayer if (!au) { av = -1; au = true; - b.k.a(this, new Packet18ArmAnimation(this, 1)); + b.k.a(((Entity) (this)), ((Packet) (new Packet18ArmAnimation(((Entity) (this)), 1)))); } } @@ -200,7 +195,7 @@ public class EntityPlayerMP extends EntityPlayer public void e(Entity entity) { super.e(entity); - a.b(new Packet39(this, k)); + a.b(((Packet) (new Packet39(((Entity) (this)), k)))); a.a(p, q, r, v, w); } @@ -220,29 +215,26 @@ public class EntityPlayerMP extends EntityPlayer public void a(int i, int j, int l) { R(); - a.b(new Packet100(bH, 1, "Crafting", 9)); - ap = new CraftingInventoryWorkbenchCB(an, this.l, i, j, l); + a.b(((Packet) (new Packet100(bH, 1, "Crafting", 9)))); + ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, this.l, i, j, l))); ap.f = bH; - // CraftBukkit: Downcast to make it work. - ap.a((ICrafting)this); + ap.a(((ICrafting) (this))); } public void a(IInventory iinventory) { R(); - a.b(new Packet100(bH, 0, iinventory.b(), iinventory.a())); - ap = new CraftingInventoryChestCB(an, iinventory); + a.b(((Packet) (new Packet100(bH, 0, iinventory.b(), iinventory.a())))); + ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory))); ap.f = bH; - // CraftBukkit: Downcast to make it work. - ap.a((ICrafting)this); + ap.a(((ICrafting) (this))); } public void a(TileEntityFurnace tileentityfurnace) { R(); - a.b(new Packet100(bH, 2, tileentityfurnace.b(), tileentityfurnace.a())); - ap = new CraftingInventoryFurnaceCB(an, tileentityfurnace); + a.b(((Packet) (new Packet100(bH, 2, tileentityfurnace.b(), tileentityfurnace.a())))); + ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace))); ap.f = bH; - // CraftBukkit: Downcast to make it work. - ap.a((ICrafting)this); + ap.a(((ICrafting) (this))); } public void a(CraftingInventoryCB craftinginventorycb, int i, ItemStack itemstack) { @@ -252,24 +244,24 @@ public class EntityPlayerMP extends EntityPlayer if (am) { return; } else { - a.b(new Packet103(craftinginventorycb.f, i, itemstack)); + a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack)))); return; } } public void a(CraftingInventoryCB craftinginventorycb, List list) { - a.b(new Packet104(craftinginventorycb.f, list)); - a.b(new Packet103(-1, -1, an.i())); + a.b(((Packet) (new Packet104(craftinginventorycb.f, list)))); + a.b(((Packet) (new Packet103(-1, -1, an.i())))); } public void a(CraftingInventoryCB craftinginventorycb, int i, int j) { - a.b(new Packet105(craftinginventorycb.f, i, j)); + a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j)))); } public void a(ItemStack itemstack) {} public void I() { - a.b(new Packet101(ap.f)); + a.b(((Packet) (new Packet101(ap.f)))); K(); } @@ -277,15 +269,13 @@ public class EntityPlayerMP extends EntityPlayer if (am) { return; } else { - a.b(new Packet103(-1, -1, an.i())); + a.b(((Packet) (new Packet103(-1, -1, an.i())))); return; } } public void K() { - // CraftBukkit: Downcast to make it work. - ap.a((ICrafting)this); + ap.a(((EntityPlayer) (this))); ap = ao; } } - diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 92febcd5..f7a23b5c 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -1,12 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityCombustEvent; +// CraftBukkit end public class EntitySkeleton extends EntityMobs { @@ -34,14 +35,14 @@ public class EntitySkeleton extends EntityMobs { float f1 = b(1.0F); if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { - //Craftbukkit start + // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { Z = 300; } - //Craftbukkit stop + // CraftBukkit end } } super.G(); @@ -53,14 +54,14 @@ public class EntitySkeleton extends EntityMobs { double d2 = entity.r - r; if (bg == 0) { - EntityArrow entityarrow = new EntityArrow(l, this); + EntityArrow entityarrow = new EntityArrow(l, ((EntityLiving) (this))); entityarrow.q += 1.3999999761581421D; double d3 = entity.q - 0.20000000298023224D - entityarrow.q; float f2 = MathHelper.a(d1 * d1 + d2 * d2) * 0.2F; - l.a(this, "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F)); - l.a(entityarrow); + l.a(((Entity) (this)), "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F)); + l.a(((Entity) (entityarrow))); entityarrow.a(d1, d3 + (double) f2, d2, 0.6F, 12F); bg = 30; } @@ -85,4 +86,3 @@ public class EntitySkeleton extends EntityMobs { a = new ItemStack(Item.i, 1); } } - diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 60b3bce3..8185ba64 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -1,13 +1,13 @@ package net.minecraft.server; - import java.util.Random; +// CraftBukkit start import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityCombustEvent; - +// CraftBukkit end public class EntityZombie extends EntityMobs { @@ -23,14 +23,14 @@ public class EntityZombie extends EntityMobs { float f1 = b(1.0F); if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { - //Craftbukkit start + // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { Z = 300; } - //Craftbukkit stop + // CraftBukkit end } } super.G(); @@ -52,4 +52,3 @@ public class EntityZombie extends EntityMobs { return Item.J.aW; } } - diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index b7fb4574..3f04438f 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -1,6 +1,6 @@ package net.minecraft.server; - +// CraftBukkit start import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftPlayer; @@ -8,10 +8,10 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamagedByBlockEvent; import org.bukkit.event.entity.EntityDamagedByEntityEvent; import org.bukkit.event.entity.EntityDamagedEvent; +// CraftBukkit end import java.util.*; - public class Explosion { public boolean a; @@ -27,7 +27,7 @@ public class Explosion { public Explosion(World world, Entity entity, double d1, double d2, double d3, float f1) { a = false; h = new Random(); - g = new HashSet(); + g = ((Set) (new HashSet())); i = world; e = entity; f = f1; @@ -74,7 +74,7 @@ public class Explosion { f2 -= (Block.m[i3].a(e) + 0.3F) * f3; } if (f2 > 0.0F) { - g.add(new ChunkPosition(j2, k2, l2)); + g.add(((new ChunkPosition(j2, k2, l2)))); } d5 += d1 * (double) f3; d7 += d2 * (double) f3; @@ -82,7 +82,6 @@ public class Explosion { f2 -= f3 * 0.75F; } while (true); } - } } @@ -113,37 +112,37 @@ public class Explosion { double d13 = i.a(vec3d, entity.z); double d14 = (1.0D - d11) * d13; - // Craftbukkit: explosion damage hook + // CraftBukkit start - explosion damage hook int damage = (int) (((d14 * d14 + d14) / 2D) * 8D * (double) f + 1.0D); - CraftServer servr = ((WorldServer)i).getServer(); + CraftServer servr = ((WorldServer) i).getServer(); CraftEntity damagee = null; - if(entity instanceof EntityPlayerMP) - { - damagee = new CraftPlayer(servr, (EntityPlayerMP)entity); - } else if(entity instanceof EntityLiving) - { - damagee = new CraftLivingEntity(servr, (EntityLiving)entity); + if (entity instanceof EntityPlayerMP) { + damagee = new CraftPlayer(servr, (EntityPlayerMP) entity); + } else if(entity instanceof EntityLiving) { + damagee = new CraftLivingEntity(servr, (EntityLiving) entity); } - if(e == null) { // Block explosion + + if (e == null) { // Block explosion // Craftbukkit TODO: get the x/y/z of the tnt block? EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(null, damagee, EntityDamagedEvent.DamageCause.BLOCK_EXPLOSION, damage); servr.getPluginManager().callEvent(edbbe); if(!edbbe.isCancelled()) entity.a(e, damage); } else { CraftEntity damager = null; - if(e instanceof EntityPlayerMP) - { + if (e instanceof EntityPlayerMP) { // not possible in normal operations - damager = new CraftPlayer(servr, (EntityPlayerMP)e); - } else if(e instanceof EntityLiving) - { + damager = new CraftPlayer(servr, (EntityPlayerMP) e); + } else if (e instanceof EntityLiving) { damager = new CraftLivingEntity(servr, (EntityLiving) e); } EntityDamagedByEntityEvent edbbe = new EntityDamagedByEntityEvent(damager, damagee, EntityDamagedEvent.DamageCause.ENTITY_EXPLOSION, damage); servr.getPluginManager().callEvent(edbbe); - if(!edbbe.isCancelled()) entity.a(e, damage); + + if (!edbbe.isCancelled()) { + entity.a(e, damage); + } } - // Craftbukkit: end + // Craftbukkit end double d15 = d14; @@ -156,10 +155,10 @@ public class Explosion { f = f1; ArrayList arraylist = new ArrayList(); - arraylist.addAll(g); + ((List) (arraylist)).addAll(((java.util.Collection) (g))); if (a) { - for (int j4 = arraylist.size() - 1; j4 >= 0; j4--) { - ChunkPosition chunkposition = (ChunkPosition) arraylist.get(j4); + for (int j4 = ((List) (arraylist)).size() - 1; j4 >= 0; j4--) { + ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j4); int i2 = chunkposition.a; int k4 = chunkposition.b; int l4 = chunkposition.c; @@ -170,7 +169,6 @@ public class Explosion { i.d(i2, k4, l4, Block.ar.bh); } } - } } @@ -178,9 +176,9 @@ public class Explosion { i.a(b, c, d, "random.explode", 4F, (1.0F + (i.l.nextFloat() - i.l.nextFloat()) * 0.2F) * 0.7F); ArrayList arraylist = new ArrayList(); - arraylist.addAll(g); - for (int j = arraylist.size() - 1; j >= 0; j--) { - ChunkPosition chunkposition = (ChunkPosition) arraylist.get(j); + ((List) (arraylist)).addAll(((java.util.Collection) (g))); + for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) { + ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j); int k = chunkposition.a; int l = chunkposition.b; int i1 = chunkposition.c; @@ -217,4 +215,3 @@ public class Explosion { } } - diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java index c573e819..56507b3c 100644 --- a/src/main/java/net/minecraft/server/IInventory.java +++ b/src/main/java/net/minecraft/server/IInventory.java @@ -1,6 +1,5 @@ package net.minecraft.server;
-
public interface IInventory {
public abstract int a();
@@ -21,4 +20,3 @@ public interface IInventory { public abstract ItemStack[] getContents(); // CraftBukkit
}
-
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java index 8d7f8d6d..4652cc1a 100644 --- a/src/main/java/net/minecraft/server/InventoryCraftResult.java +++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java @@ -1,15 +1,14 @@ package net.minecraft.server;
-
-public class InventoryCraftResult
- implements IInventory {
+public class InventoryCraftResult implements IInventory {
private ItemStack a[];
- // CraftBukkit
+ // CraftBukkit start
public ItemStack[] getContents() {
return a;
}
+ // CraftBukkit end
public InventoryCraftResult() {
a = new ItemStack[1];
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java index 90502d47..cf1fd2de 100644 --- a/src/main/java/net/minecraft/server/InventoryCrafting.java +++ b/src/main/java/net/minecraft/server/InventoryCrafting.java @@ -1,17 +1,16 @@ package net.minecraft.server;
-
-public class InventoryCrafting
- implements IInventory {
+public class InventoryCrafting implements IInventory {
private ItemStack a[];
private int b;
private CraftingInventoryCB c;
- //CraftBukkit
+ // CraftBukkit start
public ItemStack[] getContents() {
return a;
}
+ // CraftBukkit end
public InventoryCrafting(CraftingInventoryCB craftinginventorycb, int i, int j) {
b = i * j;
@@ -37,7 +36,7 @@ public class InventoryCrafting ItemStack itemstack = a[i];
a[i] = null;
- c.a(this);
+ c.a(((IInventory) (this)));
return itemstack;
}
ItemStack itemstack1 = a[i].a(j);
@@ -45,7 +44,7 @@ public class InventoryCrafting if (a[i].a == 0) {
a[i] = null;
}
- c.a(this);
+ c.a(((IInventory) (this)));
return itemstack1;
} else {
return null;
@@ -54,7 +53,7 @@ public class InventoryCrafting public void a(int i, ItemStack itemstack) {
a[i] = itemstack;
- c.a(this);
+ c.a(((IInventory) (this)));
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java index e79d74b5..ff6aaab9 100644 --- a/src/main/java/net/minecraft/server/InventoryLargeChest.java +++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java @@ -1,13 +1,11 @@ package net.minecraft.server;
-
-public class InventoryLargeChest
- implements IInventory {
+public class InventoryLargeChest implements IInventory {
private String a;
private IInventory b;
private IInventory c;
-
+
// CraftBukkit start
public ItemStack[] getContents() {
ItemStack[] result = new ItemStack[a()];
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index 186fa6e9..e4c796a5 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -1,8 +1,6 @@ package net.minecraft.server;
-
-public class InventoryPlayer
- implements IInventory {
+public class InventoryPlayer implements IInventory {
public ItemStack a[];
public ItemStack b[];
@@ -11,7 +9,7 @@ public class InventoryPlayer private ItemStack f;
public boolean d;
- // CraftBukket start
+ // CraftBukkit start
public ItemStack[] getContents() {
return a;
}
@@ -19,7 +17,7 @@ public class InventoryPlayer public ItemStack[] getArmorContents() {
return b;
}
- // CraftBukket end
+ // CraftBukkit end
public InventoryPlayer(EntityPlayer entityplayer) {
a = new ItemStack[36];
@@ -183,7 +181,7 @@ public class InventoryPlayer nbttagcompound.a("Slot", (byte) k);
a[k].a(nbttagcompound);
- nbttaglist.a(nbttagcompound);
+ nbttaglist.a(((NBTBase) (nbttagcompound)));
}
}
@@ -193,7 +191,7 @@ public class InventoryPlayer nbttagcompound1.a("Slot", (byte) (l + 100));
b[l].a(nbttagcompound1);
- nbttaglist.a(nbttagcompound1);
+ nbttaglist.a(((NBTBase) (nbttagcompound1)));
}
}
@@ -218,7 +216,6 @@ public class InventoryPlayer b[l - 100] = itemstack;
}
}
-
}
public int a() {
@@ -320,7 +317,6 @@ public class InventoryPlayer b[l] = null;
}
}
-
}
public void d() {
@@ -340,6 +336,6 @@ public class InventoryPlayer if (e.G) {
return false;
}
- return entityplayer.b((Entity)e) <= 64D; // CraftBukkit: downcast to Entity
+ return entityplayer.b(((Entity) (e))) <= 64D;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 72c4f21c..e37d9ac3 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -1,12 +1,13 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.BlockFace; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockPlacedEvent; - +// CraftBukkit end public class ItemBlock extends Item { @@ -19,16 +20,17 @@ public class ItemBlock extends Item { } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { - // Craftbukkit start + // CraftBukkit start // Bail if we have nothing of the item in hand if (itemstack.a == 0) { return false; } - - // Craftbukkit store info of the clicked block + + // CraftBukkit store info of the clicked block CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); BlockFace faceClicked = CraftBlock.notchToBlockFace(l); - + // CraftBukkit end + if (world.a(i, j, k) == Block.aS.bh) { l = 0; } else { @@ -51,11 +53,11 @@ public class ItemBlock extends Item { i++; } } - - // CraftBukkit store the old data so we can undo it + + // CraftBukkit start - store the old data so we can undo it int oldMaterial = world.a(i, j, k); int oldData = world.b(i, j, k); - + if (world.a(a, i, j, k, false)) { Block block = Block.m[a]; @@ -64,23 +66,23 @@ public class ItemBlock extends Item { CraftBlock placedBlock = (CraftBlock) blockClicked.getFace(faceClicked) ; CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); - + int xFromSpawn = (int) MathHelper.e(i - world.m); int distanceFromSpawn = (int) MathHelper.e(k - world.o); if (xFromSpawn > distanceFromSpawn) { distanceFromSpawn = xFromSpawn; } - - // Craftbukkit hardcoded Spawn distance for now + + // CraftBukkit hardcoded Spawn distance for now boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp(); - + BlockPlacedEvent bpe = new BlockPlacedEvent(Type.BLOCK_PLACED, placedBlock, blockClicked, itemInHand, thePlayer, canBuild); ((WorldServer) world).getServer().getPluginManager().callEvent(bpe); - + if (bpe.isCancelled() || !bpe.canBuild()) { - // Craftbukkit Undo! - + // CraftBukkit Undo! + // Specialcase iceblocks, replace with 'glass' first (so it doesn't explode into water) if (this.a == 79) { world.a(i, j, k, 20); @@ -90,15 +92,15 @@ public class ItemBlock extends Item { } else { world.g(i, j, k); world.g(i, j, k, this.a); - + Block.m[a].c(world, i, j, k, l); - // Craftbukkit Decompiler doesn't record the downcast. Oops. - Block.m[a].a(world, i, j, k, (EntityLiving) entityplayer); + Block.m[a].a(world, i, j, k, ((EntityLiving) (entityplayer))); world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.bq.c(), (block.bq.a() + 1.0F) / 2.0F, block.bq.b() * 0.8F); itemstack.a--; } } } + // CraftBukkit end return true; } @@ -106,4 +108,3 @@ public class ItemBlock extends Item { return Block.m[a].e(); } } - diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java index 61102abb..659b4e1b 100644 --- a/src/main/java/net/minecraft/server/ItemBoat.java +++ b/src/main/java/net/minecraft/server/ItemBoat.java @@ -1,11 +1,12 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemBoat extends Item { @@ -42,22 +43,21 @@ public class ItemBoat extends Item { int k = movingobjectposition.d; if (!world.z) { - // Craftbukkit start - // Boat placement + // CraftBukkit start - Boat placement CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(movingobjectposition.e)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + if (pie.isCancelled()) return itemstack; - - world.a(new EntityBoat(world, (float) i + 0.5F, (float) j + 1.5F, (float) k + 0.5F)); + // CraftBukkit end + + world.a(((Entity) (new EntityBoat(world, (float) i + 0.5F, (float) j + 1.5F, (float) k + 0.5F)))); } itemstack.a--; } return itemstack; } } - diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java index 7fd30540..d9478fa6 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -1,5 +1,8 @@ package net.minecraft.server; +import java.util.Random; + +// CraftBukkit start import org.bukkit.BlockFace; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; @@ -7,7 +10,7 @@ import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemBucket extends Item { @@ -50,37 +53,39 @@ public class ItemBucket extends Item { if (!world.a(entityplayer, i, j, k)) { return itemstack; } - - // Craftbukkit start - // Craftbukkit Click == placed when handling an empty bucket! + + // CraftBukkit start - Click == placed when handling an empty bucket! CraftWorld theWorld = ((WorldServer) world).getWorld(); CraftBlock blockClicked = (CraftBlock) theWorld.getBlockAt(i, j, k); BlockFace direction = CraftBlock.notchToBlockFace(movingobjectposition.e); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftItemStack itemInHand = new CraftItemStack(itemstack); - + // CraftBukkit end + if (a == 0) { if (world.c(i, j, k) == Material.f && world.b(i, j, k) == 0) { + // CraftBukkit start PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction); ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - - if (!pie.isCancelled()) { - world.d(i, j, k, 0); - return new ItemStack(Item.av); - } else { + + if (pie.isCancelled()) { return itemstack; } + // CraftBukkit end + world.d(i, j, k, 0); + return new ItemStack(Item.av); } if (world.c(i, j, k) == Material.g && world.b(i, j, k) == 0) { + // CraftBukkit start PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction); ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - - if (!pie.isCancelled()) { - world.d(i, j, k, 0); - return new ItemStack(Item.aw); - } else { + + if (pie.isCancelled()) { return itemstack; } + // CraftBukkit end + world.d(i, j, k, 0); + return new ItemStack(Item.aw); } } else { if (a < 0) { @@ -111,15 +116,15 @@ public class ItemBucket extends Item { world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D); } } else { - // Craftbukkit bucket empty. + // CraftBukkit start - bucket empty. PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction); ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - - if (!pie.isCancelled()) { - world.b(i, j, k, a, 0); - } else { + + if (pie.isCancelled()) { return itemstack; } + // CraftBukkit end + world.b(i, j, k, a, 0); } return new ItemStack(Item.au); } @@ -130,4 +135,3 @@ public class ItemBucket extends Item { return itemstack; } } - diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java index de365d03..00920b00 100644 --- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java +++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java @@ -1,12 +1,15 @@ package net.minecraft.server; +import java.util.Random; + +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.block.BlockIgniteEvent; - +// CraftBukkit end public class ItemFlintAndSteel extends Item { @@ -17,9 +20,9 @@ public class ItemFlintAndSteel extends Item { } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { - // Craftbukkit start - get the clicked block + // CraftBukkit - get the clicked block CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); - + if (l == 0) { j--; } @@ -41,30 +44,28 @@ public class ItemFlintAndSteel extends Item { int i1 = world.a(i, j, k); if (i1 == 0) { - // Craftbukkit start - // Flint and steel - + // CraftBukkit start - Flint and steel CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + org.bukkit.Block pblock = (((WorldServer) world).getWorld().getBlockAt(i, j, k)); BlockIgniteEvent bie = new BlockIgniteEvent((org.bukkit.Block) pblock, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, thePlayer); ((WorldServer) world).getServer().getPluginManager().callEvent(bie); boolean preventLighter = pie.isCancelled(); boolean preventFire = bie.isCancelled(); - + if (preventLighter || preventFire) { return false; - } else { - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F); - world.d(i, j, k, Block.ar.bh); } + // CraftBukkit end + + world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F); + world.d(i, j, k, Block.ar.bh); } itemstack.b(1); return true; } } - diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java index 4002370f..d0fc4292 100644 --- a/src/main/java/net/minecraft/server/ItemHoe.java +++ b/src/main/java/net/minecraft/server/ItemHoe.java @@ -1,11 +1,14 @@ package net.minecraft.server; +import java.util.Random; + +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemHoe extends Item { @@ -20,17 +23,17 @@ public class ItemHoe extends Item { Material material = world.c(i, j + 1, k); if (!material.a() && i1 == Block.u.bh || i1 == Block.v.bh) { - // Craftbukkit start - // Hoes + // CraftBukkit start - Hoes CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + if (pie.isCancelled()) return false; - + // CraftBukkit end + Block block = Block.aA; world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.bq.c(), (block.bq.a() + 1.0F) / 2.0F, block.bq.b() * 0.8F); @@ -50,9 +53,8 @@ public class ItemHoe extends Item { EntityItem entityitem = new EntityItem(world, (float) i + f1, (float) j + f2, (float) k + f3, new ItemStack(Item.Q)); entityitem.c = 10; - world.a(entityitem); + world.a(((Entity) (entityitem))); } - } return true; } else { @@ -60,4 +62,3 @@ public class ItemHoe extends Item { } } } - diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 6376b0aa..83b755b7 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -1,6 +1,5 @@ package net.minecraft.server; - public class ItemInWorldManager { private World b; diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java index dfbd443b..c8c0012b 100644 --- a/src/main/java/net/minecraft/server/ItemMinecart.java +++ b/src/main/java/net/minecraft/server/ItemMinecart.java @@ -1,11 +1,12 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemMinecart extends Item { @@ -21,19 +22,19 @@ public class ItemMinecart extends Item { int i1 = world.a(i, j, k); if (i1 == Block.aG.bh) { - // Craftbukkit start - // Minecarts + // CraftBukkit start - Minecarts CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + if (pie.isCancelled()) return false; - + // CraftBukkit end + if (!world.z) { - world.a(new EntityMinecart(world, (float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, a)); + world.a(((Entity) (new EntityMinecart(world, (float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, a)))); } itemstack.a--; return true; @@ -42,4 +43,3 @@ public class ItemMinecart extends Item { } } } - diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java index f983fd1b..da2e2b28 100644 --- a/src/main/java/net/minecraft/server/ItemRedstone.java +++ b/src/main/java/net/minecraft/server/ItemRedstone.java @@ -1,11 +1,12 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemRedstone extends Item { @@ -14,9 +15,9 @@ public class ItemRedstone extends Item { } public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { - // Craftbukkit start get the clicked block + // CraftBukkit - get the clicked block CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); - + if (l == 0) { j--; } @@ -39,20 +40,19 @@ public class ItemRedstone extends Item { return false; } if (Block.av.a(world, i, j, k)) { - // Craftbukkit start - // Redstone + // CraftBukkit start - Redstone CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + if (pie.isCancelled()) return false; - + // CraftBukkit end + itemstack.a--; world.d(i, j, k, Block.av.bh); } return true; } } - diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java index ea475125..31633441 100644 --- a/src/main/java/net/minecraft/server/ItemSeeds.java +++ b/src/main/java/net/minecraft/server/ItemSeeds.java @@ -1,11 +1,12 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemSeeds extends Item { @@ -23,25 +24,24 @@ public class ItemSeeds extends Item { int i1 = world.a(i, j, k); if (i1 == Block.aA.bh) { - // Craftbukkit start - // Seeds + // CraftBukkit start - Seeds CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - - if (!pie.isCancelled()) { - world.d(i, j + 1, k, a); - itemstack.a--; - return true; - } else { + + if (pie.isCancelled()) { return false; } + // CraftBukkit end + + world.d(i, j + 1, k, a); + itemstack.a--; + return true; } else { return false; } } } - diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java index c7f949ea..1fabaa9f 100644 --- a/src/main/java/net/minecraft/server/ItemSign.java +++ b/src/main/java/net/minecraft/server/ItemSign.java @@ -1,11 +1,12 @@ package net.minecraft.server; +// CraftBukkit start import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerItemEvent; - +// CraftBukkit end public class ItemSign extends Item { @@ -22,10 +23,10 @@ public class ItemSign extends Item { if (!world.c(i, j, k).a()) { return false; } - - // Craftbukkit - store the clicked block + + // CraftBukkit - store the clicked block CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); - + if (l == 1) { j++; } @@ -44,17 +45,18 @@ public class ItemSign extends Item { if (!Block.aD.a(world, i, j, k)) { return false; } - - // Craftbukkit start + + // CraftBukkit start // Signs CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); - + ((WorldServer) world).getServer().getPluginManager().callEvent(pie); - + if (pie.isCancelled()) return false; - + // CraftBukkit end + if (l == 1) { world.b(i, j, k, Block.aD.bh, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf); } else { @@ -69,4 +71,3 @@ public class ItemSign extends Item { return true; } } - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index b54a1d4c..1cd9bfdc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1,26 +1,28 @@ package net.minecraft.server; - import java.io.File; +import java.io.IOException; +import java.io.PrintStream; import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import joptsimple.OptionSet; +// CraftBukkit start +import java.net.UnknownHostException; +import joptsimple.OptionSet; import org.bukkit.craftbukkit.CraftServer; +// CraftBukkit end - -public class MinecraftServer -implements ICommandListener, Runnable { +public class MinecraftServer implements ICommandListener, Runnable { public static Logger a = Logger.getLogger("Minecraft"); - public static HashMap<String, Integer> b = new HashMap<String, Integer>(); + public static HashMap b = new HashMap(); public NetworkListenThread c; public PropertyManager d; public WorldServer e; @@ -30,8 +32,8 @@ implements ICommandListener, Runnable { int h; public String i; public int j; - private List<IUpdatePlayerListBox> p; - private List<ServerCommand> q; + private List p; + private List q; public EntityTracker k; public boolean l; public boolean m; @@ -45,8 +47,8 @@ implements ICommandListener, Runnable { o = true; g = false; h = 0; - p = new ArrayList<IUpdatePlayerListBox>(); - q = Collections.synchronizedList(new ArrayList<ServerCommand>()); + p = ((List) (new ArrayList())); + q = Collections.synchronizedList(((List) (new ArrayList()))); new ThreadSleepForever(this); this.options = options; // CraftBukkit @@ -56,8 +58,8 @@ implements ICommandListener, Runnable { private boolean d() throws UnknownHostException { ThreadCommandReader threadcommandreader = new ThreadCommandReader(this); - threadcommandreader.setDaemon(true); - threadcommandreader.start(); + ((Thread) (threadcommandreader)).setDaemon(true); + ((Thread) (threadcommandreader)).start(); ConsoleLogManager.a(); a.info("Starting minecraft server version Beta 1.1_02"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { @@ -65,7 +67,7 @@ implements ICommandListener, Runnable { a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } a.info("Loading properties"); - d = new PropertyManager(options); // Craftbukkit + d = new PropertyManager(new File("server.properties")); String s = d.a("server-ip", ""); l = d.a("online-mode", true); @@ -94,7 +96,6 @@ implements ICommandListener, Runnable { a.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file."); } - f = new ServerConfigurationManager(this); k = new EntityTracker(this); String s1 = d.a("level-name", "world"); @@ -108,7 +109,7 @@ implements ICommandListener, Runnable { private void c(String s) { a.info("Preparing start region"); e = new WorldServer(this, new File("."), s, d.a("hellworld", false) ? -1 : 0); - e.a(new WorldManager(this)); + e.a(((IWorldAccess) (new WorldManager(this)))); e.k = d.a("spawn-monsters", true) ? 1 : 0; f.a(e); byte byte0 = 10; @@ -121,7 +122,6 @@ implements ICommandListener, Runnable { } e.A.d((e.m >> 4) + i1, (e.o >> 4) + j1); } - } e(); @@ -136,13 +136,13 @@ implements ICommandListener, Runnable { private void e() { i = null; j = 0; - - server.loadPlugins(); + + server.loadPlugins(); // CraftBukkit } private void f() { a.info("Saving chunks"); - e.a(true, null); + e.a(true, ((IProgressUpdate) (null))); } private void g() { @@ -197,7 +197,7 @@ implements ICommandListener, Runnable { } } catch (Exception exception) { exception.printStackTrace(); - a.log(Level.SEVERE, "Unexpected exception", exception); + a.log(Level.SEVERE, "Unexpected exception", ((Throwable) (exception))); while (o) { b(); try { @@ -214,28 +214,28 @@ implements ICommandListener, Runnable { } private void h() { - ArrayList<String> arraylist = new ArrayList<String>(); + ArrayList arraylist = new ArrayList(); - for (Iterator<String> iterator = b.keySet().iterator(); iterator.hasNext();) { + for (Iterator iterator = b.keySet().iterator(); iterator.hasNext();) { String s = (String) iterator.next(); - int k1 = ((Integer) b.get(s)).intValue(); + int k1 = ((Integer) b.get(((s)))).intValue(); if (k1 > 0) { - b.put(s, Integer.valueOf(k1 - 1)); + b.put(((s)), ((Integer.valueOf(k1 - 1)))); } else { - arraylist.add(s); + ((List) (arraylist)).add(((s))); } } - for (int i1 = 0; i1 < arraylist.size(); i1++) { - b.remove(arraylist.get(i1)); + for (int i1 = 0; i1 < ((List) (arraylist)).size(); i1++) { + b.remove(((List) (arraylist)).get(i1)); } AxisAlignedBB.a(); Vec3D.a(); h++; if (h % 20 == 0) { - f.a(new Packet4UpdateTime(e.e)); + f.a(((Packet) (new Packet4UpdateTime(e.e)))); } e.f(); while (e.d()) { @@ -252,12 +252,12 @@ implements ICommandListener, Runnable { try { b(); } catch (Exception exception) { - a.log(Level.WARNING, "Unexpected exception while parsing console command", exception); + a.log(Level.WARNING, "Unexpected exception while parsing console command", ((Throwable) (exception))); } } public void a(String s, ICommandListener icommandlistener) { - q.add(new ServerCommand(s, icommandlistener)); + q.add(((new ServerCommand(s, icommandlistener)))); } public void b() { @@ -298,7 +298,7 @@ implements ICommandListener, Runnable { o = false; } else if (s.toLowerCase().startsWith("save-all")) { a(s1, "Forcing save.."); - e.a(true, null); + e.a(true, ((IProgressUpdate) (null))); a(s1, "Save complete."); } else if (s.toLowerCase().startsWith("save-off")) { a(s1, "Disabling level saving.."); @@ -418,7 +418,7 @@ implements ICommandListener, Runnable { } else if (s.toLowerCase().startsWith("say ")) { s = s.substring(s.indexOf(" ")).trim(); a.info((new StringBuilder()).append("[").append(s1).append("] ").append(s).toString()); - f.a(new Packet3Chat((new StringBuilder()).append("\247d[Server] ").append(s).toString())); + f.a(((Packet) (new Packet3Chat((new StringBuilder()).append("\247d[Server] ").append(s).toString())))); } else if (s.toLowerCase().startsWith("tell ")) { String as2[] = s.split(" "); @@ -428,7 +428,7 @@ implements ICommandListener, Runnable { a.info((new StringBuilder()).append("[").append(s1).append("->").append(as2[1]).append("] ").append(s).toString()); s = (new StringBuilder()).append("\2477").append(s1).append(" whispers ").append(s).toString(); a.info(s); - if (!f.a(as2[1], new Packet3Chat(s))) { + if (!f.a(as2[1], ((Packet) (new Packet3Chat(s))))) { icommandlistener.b("There's no player by that name online."); } } @@ -454,20 +454,20 @@ implements ICommandListener, Runnable { } public void a(IUpdatePlayerListBox iupdateplayerlistbox) { - p.add(iupdateplayerlistbox); + p.add(((iupdateplayerlistbox))); } // Craftbukkit start - replaces main(String args[]) public static void main(final OptionSet options) { try { + // CraftBukkit - remove gui MinecraftServer minecraftserver = new MinecraftServer(options); (new ThreadServerApplication("Server thread", minecraftserver)).start(); } catch (Exception exception) { - a.log(Level.SEVERE, "Failed to start the minecraft server", exception); + a.log(Level.SEVERE, "Failed to start the minecraft server", ((Throwable) (exception))); } } - // Craftbukkit end public File a(String s) { return new File(s); @@ -484,5 +484,4 @@ implements ICommandListener, Runnable { public static boolean a(MinecraftServer minecraftserver) { return minecraftserver.o; } - -}
\ No newline at end of file +} diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index a0c5c1dd..62970f2e 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -1,10 +1,12 @@ package net.minecraft.server; +import java.io.PrintStream; import java.util.*; import java.util.logging.Logger; -import org.bukkit.BlockDamageLevel; +// CraftBukkit start import org.bukkit.BlockFace; +import org.bukkit.BlockDamageLevel; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftItemStack; @@ -16,9 +18,9 @@ import org.bukkit.event.block.BlockRightClickedEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerMoveEvent; +// CraftBukkit end -public class NetServerHandler extends NetHandler - implements ICommandListener { +public class NetServerHandler extends NetHandler implements ICommandListener { public static Logger a = Logger.getLogger("Minecraft"); public NetworkManager b; @@ -30,19 +32,25 @@ public class NetServerHandler extends NetHandler private double h; private double i; private boolean j; - private Map<Integer, Short> k; - // CraftBukkit - next 2 lines + private Map k; + + // CraftBukkit start - next 2 lines private final CraftServer server; private final CraftPlayer player; + public CraftPlayer getPlayer() { + return player; + } + // CraftBukkit end + public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayerMP entityplayermp) { c = false; f = 0; j = true; - k = new HashMap<Integer, Short>(); + k = ((Map) (new HashMap())); d = minecraftserver; b = networkmanager; - networkmanager.a(this); + networkmanager.a(((NetHandler) (this))); e = entityplayermp; entityplayermp.a = this; @@ -51,23 +59,17 @@ public class NetServerHandler extends NetHandler player = new CraftPlayer(server, e); } - // CraftBukkit start - public CraftPlayer getPlayer() { - return player; - } - // CraftBukkit end - public void a() { b.a(); if (f++ % 20 == 0) { - b.a(new Packet0KeepAlive()); + b.a(((Packet) (new Packet0KeepAlive()))); } } public void a(String s) { - b.a(new Packet255KickDisconnect(s)); + b.a(((Packet) (new Packet255KickDisconnect(s)))); b.c(); - d.f.a(new Packet3Chat((new StringBuilder()).append("\247e").append(e.aw).append(" left the game.").toString())); + d.f.a(((Packet) (new Packet3Chat((new StringBuilder()).append("\247e").append(e.aw).append(" left the game.").toString())))); d.f.c(e); c = true; } @@ -135,7 +137,7 @@ public class NetServerHandler extends NetHandler g = e.p; h = e.q; i = e.r; - d.e.f(e); + d.e.f(((Entity) (e))); return; } double d2 = e.q; @@ -175,7 +177,7 @@ public class NetServerHandler extends NetHandler double d13 = d6 - e.q; double d14 = d8 - e.r; float f5 = 0.0625F; - boolean flag = d.e.a(e, e.z.b().e(f5, f5, f5)).size() == 0; + boolean flag = d.e.a(((Entity) (e)), e.z.b().e(f5, f5, f5)).size() == 0; e.c(d12, d13, d14); d12 = d4 - e.p; @@ -194,7 +196,7 @@ public class NetServerHandler extends NetHandler System.out.println((new StringBuilder()).append("Expected ").append(e.p).append(", ").append(e.q).append(", ").append(e.r).toString()); } e.b(d4, d6, d8, f3, f4); - boolean flag2 = d.e.a(e, e.z.b().e(f5, f5, f5)).size() == 0; + boolean flag2 = d.e.a(((Entity) (e)), e.z.b().e(f5, f5, f5)).size() == 0; if (flag && (flag1 || !flag2)) { a(g, h, i, f3, f4); @@ -206,9 +208,7 @@ public class NetServerHandler extends NetHandler } } - public void a(double d1, double d2, double d3, float f1, - float f2) { - + public void a(double d1, double d2, double d3, float f1, float f2) { // CraftBukkit start Location from = player.getLocation(); Location to = new Location(player.getWorld(), d1, d2, d3, f1, f2); @@ -230,7 +230,7 @@ public class NetServerHandler extends NetHandler h = d2; i = d3; e.b(d1, d2, d3, f1, f2); - e.a.b(new Packet13PlayerLookMove(d1, d2 + 1.6200000047683716D, d2, d3, f1, f2, false)); + e.a.b(((Packet) (new Packet13PlayerLookMove(d1, d2 + 1.6200000047683716D, d2, d3, f1, f2, false)))); } // CraftBukkit start @@ -238,7 +238,7 @@ public class NetServerHandler extends NetHandler private int lastX; private int lastY; private int lastZ; - // Craftbukkit stop + // CraftBukkit end public void a(Packet14BlockDig packet14blockdig) { if (packet14blockdig.e == 4) { @@ -280,7 +280,7 @@ public class NetServerHandler extends NetHandler i2 = l1; } - // Craftbukkit start + // CraftBukkit start CraftBlock block = (CraftBlock) player.getWorld().getBlockAt(l, i1, j1); int blockID = block.getTypeID(); float damage = 0; @@ -294,7 +294,7 @@ public class NetServerHandler extends NetHandler BlockDamagedEvent event; // If the amount of damage that the player is going to do to the block // is >= 1, then the block is going to break (eg, flowers, torches) - if(damage >= 1.0F) { + if (damage >= 1.0F) { event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player); } else { event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STARTED, player); @@ -306,7 +306,7 @@ public class NetServerHandler extends NetHandler } } } else if (packet14blockdig.e == 2) { - // Get last block that the player hit + // CraftBukkit start - Get last block that the player hit // Otherwise the block is a Bedrock @(0,0,0) block = (CraftBlock) player.getWorld().getBlockAt(lastX, lastY, lastZ); BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player); @@ -314,8 +314,10 @@ public class NetServerHandler extends NetHandler if (!event.isCancelled()) { e.c.a(); } + // CraftBukkit end } else if (packet14blockdig.e == 1) { if (i2 > 16 || flag) { + // CraftBukkit start BlockDamagedEvent 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. @@ -330,6 +332,7 @@ public class NetServerHandler extends NetHandler } else { e.c.d = 0; // Reset the amount of damage if stopping break. } + // CraftBukkit end } } else if (packet14blockdig.e == 3) { double d6 = e.p - ((double) l + 0.5D); @@ -338,30 +341,33 @@ public class NetServerHandler extends NetHandler double d9 = d6 * d6 + d7 * d7 + d8 * d8; if (d9 < 256D) { - e.a.b(new Packet53BlockChange(l, i1, j1, d.e)); + e.a.b(((Packet) (new Packet53BlockChange(l, i1, j1, ((World) (d.e)))))); } } + + // CraftBukkit start lastX = l; lastY = i1; lastZ = j1; - // Craftbukkit stop + // CraftBukkit end d.e.B = false; } - // Craftbukkit start - store the last block right clicked and what type it was + + // CraftBukkit start - store the last block right clicked and what type it was CraftBlock lastRightClicked; int lastMaterial; public void a(Packet15Place packet15place) { ItemStack itemstack = e.an.e(); - // Craftbukkit we don't check spawn protection here anymore - /* boolean flag = */ d.e.B = d.f.g(e.aw); + boolean flag = d.e.B = d.f.g(e.aw); + // CraftBukkit start CraftBlock blockClicked = null; BlockFace blockFace = null; if (packet15place.d == 255) { - // Craftbukkit ITEM_USE -- if we have a lastRightClicked then it could be a usable location + // CraftBukkit ITEM_USE -- if we have a lastRightClicked then it could be a usable location if (packet15place.e != null && packet15place.e.c == lastMaterial) { blockClicked = lastRightClicked; } else if (lastMaterial == 0) { @@ -370,7 +376,7 @@ public class NetServerHandler extends NetHandler lastRightClicked = null; lastMaterial = 0; } else { - // Craftbukkit RIGHTCLICK or BLOCK_PLACE .. or nothing + // CraftBukkit RIGHTCLICK or BLOCK_PLACE .. or nothing blockClicked = (CraftBlock) d.e.getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c); lastRightClicked = blockClicked; lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.c; @@ -382,21 +388,23 @@ public class NetServerHandler extends NetHandler blockFace = BlockFace.Self; } - // Craftbukkit if rightclick decremented the item, always send the update packet. - // this is not here for Craftbukkit's own functionality; rather it is to fix + // CraftBukkit if rightclick decremented the item, always send the update packet. + // this is not here for CraftBukkit's own functionality; rather it is to fix // a notch bug where the item doesn't update correctly. boolean always = false; + // CraftBukkit end if (packet15place.d == 255) { if (itemstack == null) { return; } + // CraftBukkit start CraftItemStack craftItem = new CraftItemStack(itemstack); CraftPlayer player = new CraftPlayer(server, e); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, player, craftItem, blockClicked, blockFace); - // Craftbukkit We still call this event even in spawn protection. + // CraftBukkit We still call this event even in spawn protection. // Don't call this event if using Buckets / signs switch (craftItem.getType()) { case Sign: @@ -410,12 +418,13 @@ public class NetServerHandler extends NetHandler if (!pie.isCancelled()) { int itemstackAmount = itemstack.a; - e.c.a(e, d.e, itemstack); - // Craftbukkit notch decrements the counter by 1 in the above method with food, + e.c.a(((EntityPlayer) (e)), ((World) (d.e)), itemstack); + // CraftBukkit notch decrements the counter by 1 in the above method with food, // snowballs and so forth, but he does it in a place that doesnt cause the // inventory update packet to get sent always = (itemstack.a != itemstackAmount); } + // CraftBukkit end } else { int l = packet15place.a; int i1 = packet15place.b; @@ -427,19 +436,16 @@ public class NetServerHandler extends NetHandler if (l1 > i2) { i2 = l1; } - - // Craftbukkit start + // CraftBukkit start - spawn proection moved to ItemBlock!!! CraftItemStack craftItem = new CraftItemStack(itemstack); CraftPlayer player = new CraftPlayer(server, e); -// boolean canBuild = (i2 > 16) || flag; BlockRightClickedEvent brce = new BlockRightClickedEvent(Type.BLOCK_RIGHTCLICKED, blockClicked, blockFace, craftItem, player); server.getPluginManager().callEvent(brce); - // Craftbukkit WE HAVE MOVED THE SPAWN PROTECTION CHECK DOWN INTO CLASS ItemBlock!!! - e.c.a(e, d.e, itemstack, l, i1, j1, k1); + e.c.a(((EntityPlayer) (e)), ((World) (d.e)), itemstack, l, i1, j1, k1); + // CraftBukkit end - // These are the response packets back to the client - e.a.b(new Packet53BlockChange(l, i1, j1, d.e)); + e.a.b(((Packet) (new Packet53BlockChange(l, i1, j1, ((World) (d.e)))))); if (k1 == 0) { i1--; } @@ -458,32 +464,33 @@ public class NetServerHandler extends NetHandler if (k1 == 5) { l++; } - e.a.b(new Packet53BlockChange(l, i1, j1, d.e)); + e.a.b(((Packet) (new Packet53BlockChange(l, i1, j1, ((World) (d.e)))))); } if (itemstack != null && itemstack.a == 0) { e.an.a[e.an.c] = null; } e.am = true; e.an.a[e.an.c] = ItemStack.a(e.an.a[e.an.c]); - Slot slot = e.ap.a(e.an, e.an.c); + Slot slot = e.ap.a(((IInventory) (e.an)), e.an.c); e.ap.a(); e.am = false; - if (always || !ItemStack.a(e.an.e(), packet15place.e)) { - b(new Packet103(e.ap.f, slot.c, e.an.e())); + // CraftBukkit - Boolean flag + if (!ItemStack.a(e.an.e(), packet15place.e) || always) { + b(((Packet) (new Packet103(e.ap.f, slot.c, e.an.e())))); } d.e.B = false; } public void a(String s, Object aobj[]) { a.info((new StringBuilder()).append(e.aw).append(" lost connection: ").append(s).toString()); - d.f.a(new Packet3Chat((new StringBuilder()).append("\247e").append(e.aw).append(" left the game.").toString())); + d.f.a(((Packet) (new Packet3Chat((new StringBuilder()).append("\247e").append(e.aw).append(" left the game.").toString())))); d.f.c(e); c = true; } public void a(Packet packet) { - a.warning((new StringBuilder()).append(getClass()).append(" wasn't prepared to deal with a ").append(packet.getClass()).toString()); + a.warning((new StringBuilder()).append((((this).getClass()))).append(" wasn't prepared to deal with a ").append(((((packet)).getClass()))).toString()); a("Protocol error, unexpected packet"); } @@ -504,7 +511,7 @@ public class NetServerHandler extends NetHandler } s = s.trim(); for (int l = 0; l < s.length(); l++) { - if (FontAllowedCharacters.a.indexOf(s.charAt(l)) < 0) { + if (FontAllowedCharacters.a.indexOf(((int) (s.charAt(l)))) < 0) { a("Illegal characters in chat"); return; } @@ -520,10 +527,10 @@ public class NetServerHandler extends NetHandler if (event.isCancelled()) { return; } - // CraftBukkit stop + // CraftBukkit end a.info(s); - d.f.a(new Packet3Chat(s)); + d.f.a(((Packet) (new Packet3Chat(s)))); } } @@ -542,9 +549,9 @@ public class NetServerHandler extends NetHandler if (s.toLowerCase().startsWith("/me ")) { s = (new StringBuilder()).append("* ").append(e.aw).append(" ").append(s.substring(s.indexOf(" ")).trim()).toString(); a.info(s); - d.f.a(new Packet3Chat(s)); + d.f.a(((Packet) (new Packet3Chat(s)))); } else if (s.toLowerCase().startsWith("/kill")) { - e.a(null, 1000); + e.a(((Entity) (null)), 1000); } else if (s.toLowerCase().startsWith("/tell ")) { String as[] = s.split(" "); @@ -553,15 +560,15 @@ public class NetServerHandler extends NetHandler s = s.substring(s.indexOf(" ")).trim(); s = (new StringBuilder()).append("\2477").append(e.aw).append(" whispers ").append(s).toString(); a.info((new StringBuilder()).append(s).append(" to ").append(as[1]).toString()); - if (!d.f.a(as[1], new Packet3Chat(s))) { - b(new Packet3Chat("\247cThere's no player by that name online.")); + if (!d.f.a(as[1], ((Packet) (new Packet3Chat(s))))) { + b(((Packet) (new Packet3Chat("\247cThere's no player by that name online.")))); } } } else if (d.f.g(e.aw)) { String s1 = s.substring(1); a.info((new StringBuilder()).append(e.aw).append(" issued server command: ").append(s1).toString()); - d.a(s1, this); + d.a(s1, ((ICommandListener) (this))); } else { String s2 = s.substring(1); @@ -622,35 +629,35 @@ public class NetServerHandler extends NetHandler } public void a(Packet102 packet102) { - if (e.ap.f == packet102.a && e.ap.c(e)) { - ItemStack itemstack = e.ap.a(packet102.b, packet102.c, e); + if (e.ap.f == packet102.a && e.ap.c(((EntityPlayer) (e)))) { + ItemStack itemstack = e.ap.a(packet102.b, packet102.c, ((EntityPlayer) (e))); if (ItemStack.a(packet102.e, itemstack)) { - e.a.b(new Packet106(packet102.a, packet102.d, true)); + e.a.b(((Packet) (new Packet106(packet102.a, packet102.d, true)))); e.am = true; e.ap.a(); e.J(); e.am = false; } else { - k.put(Integer.valueOf(e.ap.f), Short.valueOf(packet102.d)); - e.a.b(new Packet106(packet102.a, packet102.d, false)); - e.ap.a(e, false); - ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); + k.put(((Integer.valueOf(e.ap.f))), ((Short.valueOf(packet102.d)))); + e.a.b(((Packet) (new Packet106(packet102.a, packet102.d, false)))); + e.ap.a(((EntityPlayer) (e)), false); + ArrayList arraylist = new ArrayList(); for (int l = 0; l < e.ap.e.size(); l++) { - arraylist.add(((Slot) e.ap.e.get(l)).c()); + ((List) (arraylist)).add(((((Slot) e.ap.e.get(l)).c()))); } - e.a(e.ap, arraylist); + e.a(e.ap, ((List) (arraylist))); } } } public void a(Packet106 packet106) { - Short short1 = (Short) k.get(Integer.valueOf(e.ap.f)); + Short short1 = (Short) k.get(((Integer.valueOf(e.ap.f)))); - if (short1 != null && packet106.b == short1.shortValue() && e.ap.f == packet106.a && !e.ap.c(e)) { - e.ap.a(e, true); + if (short1 != null && packet106.b == short1.shortValue() && e.ap.f == packet106.a && !e.ap.c(((EntityPlayer) (e)))) { + e.ap.a(((EntityPlayer) (e)), true); } } @@ -665,7 +672,7 @@ public class NetServerHandler extends NetHandler flag = false; } else { for (int k1 = 0; k1 < packet130.d[l].length(); k1++) { - if (FontAllowedCharacters.a.indexOf(packet130.d[l].charAt(k1)) < 0) { + if (FontAllowedCharacters.a.indexOf(((int) (packet130.d[l].charAt(k1)))) < 0) { flag = false; } } diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java index 4be80a80..9e548214 100644 --- a/src/main/java/net/minecraft/server/PropertyManager.java +++ b/src/main/java/net/minecraft/server/PropertyManager.java @@ -1,12 +1,11 @@ package net.minecraft.server; - import java.io.*; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; -import joptsimple.OptionSet; +import joptsimple.OptionSet; // CraftBukkit public class PropertyManager { @@ -14,25 +13,25 @@ public class PropertyManager { private Properties b; private File c; - private OptionSet options = null; // Craftbukkit - public PropertyManager(File file) { b = new Properties(); c = file; if (file.exists()) { try { - b.load(new FileInputStream(file)); + b.load(((java.io.InputStream) (new FileInputStream(file)))); } catch (Exception exception) { - a.log(Level.WARNING, (new StringBuilder()).append("Failed to load ").append(file).toString(), exception); + a.log(Level.WARNING, (new StringBuilder()).append("Failed to load ").append(((file))).toString(), ((Throwable) (exception))); a(); } } else { - a.log(Level.WARNING, (new StringBuilder()).append(file).append(" does not exist").toString()); + a.log(Level.WARNING, (new StringBuilder()).append(((file))).append(" does not exist").toString()); a(); } } // Craftbukkit start + private OptionSet options = null; + public PropertyManager(final OptionSet options) { this((File)options.valueOf("config")); @@ -55,15 +54,15 @@ public class PropertyManager { public void b() { try { - b.store(new FileOutputStream(c), "Minecraft server properties"); + b.store(((java.io.OutputStream) (new FileOutputStream(c))), "Minecraft server properties"); } catch (Exception exception) { - a.log(Level.WARNING, (new StringBuilder()).append("Failed to save ").append(c).toString(), exception); + a.log(Level.WARNING, (new StringBuilder()).append("Failed to save ").append(((c))).toString(), ((Throwable) (exception))); a(); } } public String a(String s, String s1) { - if (!b.containsKey(s)) { + if (!b.containsKey(((s)))) { b.setProperty(s, getOverride(s, s1)); // Craftbukkit b(); } @@ -87,6 +86,4 @@ public class PropertyManager { } return getOverride(s, flag); // Craftbukkit } - } - diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 26cff10b..141286be 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -3,38 +3,41 @@ package net.minecraft.server; import java.io.*; import java.util.*; import java.util.logging.Logger; -import org.bukkit.craftbukkit.CraftPlayer; +// CraftBukkit start +import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerLoginEvent; - +// CraftBukkit end public class ServerConfigurationManager { public static Logger a = Logger.getLogger("Minecraft"); - public List<EntityPlayerMP> b; + public List b; private MinecraftServer c; private PlayerManager d; private int e; - private Set<String> f; - private Set<String> g; - private Set<String> h; + private Set f; + private Set g; + private Set h; private File i; private File j; private File k; private PlayerNBTManager l; - private CraftServer server; // Craftbukkit - public ServerConfigurationManager(MinecraftServer minecraftserver) { - minecraftserver.server = new CraftServer(minecraftserver, this); // CraftBukkit - server = minecraftserver.server; // Craftbukkit + private CraftServer server; // CraftBukkit - b = new ArrayList<EntityPlayerMP>(); - f = new HashSet<String>(); - g = new HashSet<String>(); - h = new HashSet<String>(); + public ServerConfigurationManager(MinecraftServer minecraftserver) { + // CraftBukkit 2 lines! + minecraftserver.server = new CraftServer(minecraftserver, this); + server = minecraftserver.server; + + b = ((List) (new ArrayList())); + f = ((Set) (new HashSet())); + g = ((Set) (new HashSet())); + h = ((Set) (new HashSet())); c = minecraftserver; i = minecraftserver.a("banned-players.txt"); j = minecraftserver.a("banned-ips.txt"); @@ -58,16 +61,16 @@ public class ServerConfigurationManager { } public void a(EntityPlayerMP entityplayermp) { - b.add(entityplayermp); + b.add(((entityplayermp))); l.b(entityplayermp); c.e.A.d((int) entityplayermp.p >> 4, (int) entityplayermp.r >> 4); - for (; c.e.a(entityplayermp, entityplayermp.z).size() != 0; entityplayermp.a(entityplayermp.p, entityplayermp.q + 1.0D, entityplayermp.r)) { + for (; c.e.a(((Entity) (entityplayermp)), entityplayermp.z).size() != 0; entityplayermp.a(entityplayermp.p, entityplayermp.q + 1.0D, entityplayermp.r)) { ; } - c.e.a(entityplayermp); + c.e.a(((Entity) (entityplayermp))); d.a(entityplayermp); - // Craftbukkit + // CraftBukkit server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayermp))); } @@ -77,27 +80,29 @@ public class ServerConfigurationManager { public void c(EntityPlayerMP entityplayermp) { l.a(entityplayermp); - c.e.d(entityplayermp); - b.remove(entityplayermp); + c.e.d(((Entity) (entityplayermp))); + b.remove(((entityplayermp))); d.b(entityplayermp); - // Craftbukkit + // CraftBukkit server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayermp))); } public EntityPlayerMP a(NetLoginHandler netloginhandler, String s, String s1) { - // Craftbukkit note: this entire method needs to be changed + // CraftBukkit start - note: this entire method needs to be changed // Instead of kicking then returning, we need to store the kick reason // in the event, check with plugins to see if it's ok, and THEN kick // depending on the outcome. - - EntityPlayerMP entity = new EntityPlayerMP(c, c.e, s, new ItemInWorldManager(c.e)); + EntityPlayerMP entity = new EntityPlayerMP(c, ((World) (c.e)), s, new ItemInWorldManager(((World) (c.e)))); PlayerLoginEvent event = new PlayerLoginEvent(Type.PLAYER_LOGIN, new CraftPlayer(server, entity)); + // CraftBukkit end + + String s2 = ((netloginhandler.b.b())).toString(); - String s2 = netloginhandler.b.b().toString(); s2 = s2.substring(s2.indexOf("/") + 1); s2 = s2.substring(0, s2.indexOf(":")); + // CraftBukkit start if (f.contains(s.trim().toLowerCase())) { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!"); } else if (g.contains(s2)) { @@ -111,7 +116,7 @@ public class ServerConfigurationManager { netloginhandler.a(event.getKickMessage()); return null; } - + // CraftBukkit end for (int i1 = 0; i1 < b.size(); i1++) { EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1); @@ -120,28 +125,29 @@ public class ServerConfigurationManager { } } + // CraftBukkit return entity; } public EntityPlayerMP d(EntityPlayerMP entityplayermp) { c.k.a(entityplayermp); - c.k.b(entityplayermp); + c.k.b(((Entity) (entityplayermp))); d.b(entityplayermp); - b.remove(entityplayermp); - c.e.e(entityplayermp); - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(c, c.e, entityplayermp.aw, new ItemInWorldManager(c.e)); + b.remove(((entityplayermp))); + c.e.e(((Entity) (entityplayermp))); + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(c, ((World) (c.e)), entityplayermp.aw, new ItemInWorldManager(((World) (c.e)))); entityplayermp1.g = entityplayermp.g; entityplayermp1.a = entityplayermp.a; c.e.A.d((int) entityplayermp1.p >> 4, (int) entityplayermp1.r >> 4); - for (; c.e.a(entityplayermp1, entityplayermp1.z).size() != 0; entityplayermp1.a(entityplayermp1.p, entityplayermp1.q + 1.0D, entityplayermp1.r)) { + for (; c.e.a(((Entity) (entityplayermp1)), entityplayermp1.z).size() != 0; entityplayermp1.a(entityplayermp1.p, entityplayermp1.q + 1.0D, entityplayermp1.r)) { ; } - entityplayermp1.a.b(new Packet9()); + entityplayermp1.a.b(((Packet) (new Packet9()))); entityplayermp1.a.a(entityplayermp1.p, entityplayermp1.q, entityplayermp1.r, entityplayermp1.v, entityplayermp1.w); d.a(entityplayermp1); - c.e.a(entityplayermp1); - b.add(entityplayermp1); + c.e.a(((Entity) (entityplayermp1))); + b.add(((entityplayermp1))); entityplayermp1.k(); return entityplayermp1; } @@ -160,7 +166,6 @@ public class ServerConfigurationManager { entityplayermp.a.b(packet); } - } public String c() { @@ -177,127 +182,127 @@ public class ServerConfigurationManager { } public void a(String s) { - f.add(s.toLowerCase()); + f.add(((s.toLowerCase()))); f(); } public void b(String s) { - f.remove(s.toLowerCase()); + f.remove(((s.toLowerCase()))); f(); } private void e() { try { f.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(i)); + BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(i)))); for (String s = ""; (s = bufferedreader.readLine()) != null;) { - f.add(s.trim().toLowerCase()); + f.add(((s.trim().toLowerCase()))); } bufferedreader.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to load ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to load ban list: ").append(((exception))).toString()); } } private void f() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(i, false)); + PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(i, false)))); String s; - for (Iterator<String> iterator = f.iterator(); iterator.hasNext(); printwriter.println(s)) { + for (Iterator iterator = f.iterator(); iterator.hasNext(); printwriter.println(s)) { s = (String) iterator.next(); } printwriter.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to save ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to save ban list: ").append(((exception))).toString()); } } public void c(String s) { - g.add(s.toLowerCase()); + g.add(((s.toLowerCase()))); h(); } public void d(String s) { - g.remove(s.toLowerCase()); + g.remove(((s.toLowerCase()))); h(); } private void g() { try { g.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(j)); + BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(j)))); for (String s = ""; (s = bufferedreader.readLine()) != null;) { - g.add(s.trim().toLowerCase()); + g.add(((s.trim().toLowerCase()))); } bufferedreader.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(((exception))).toString()); } } private void h() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(j, false)); + PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(j, false)))); String s; - for (Iterator<String> iterator = g.iterator(); iterator.hasNext(); printwriter.println(s)) { + for (Iterator iterator = g.iterator(); iterator.hasNext(); printwriter.println(s)) { s = (String) iterator.next(); } printwriter.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(((exception))).toString()); } } public void e(String s) { - h.add(s.toLowerCase()); + h.add(((s.toLowerCase()))); j(); } public void f(String s) { - h.remove(s.toLowerCase()); + h.remove(((s.toLowerCase()))); j(); } private void i() { try { h.clear(); - BufferedReader bufferedreader = new BufferedReader(new FileReader(k)); + BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(k)))); for (String s = ""; (s = bufferedreader.readLine()) != null;) { - h.add(s.trim().toLowerCase()); + h.add(((s.trim().toLowerCase()))); } bufferedreader.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(((exception))).toString()); } } private void j() { try { - PrintWriter printwriter = new PrintWriter(new FileWriter(k, false)); + PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(k, false)))); String s; - for (Iterator<String> iterator = h.iterator(); iterator.hasNext(); printwriter.println(s)) { + for (Iterator iterator = h.iterator(); iterator.hasNext(); printwriter.println(s)) { s = (String) iterator.next(); } printwriter.close(); } catch (Exception exception) { - a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(exception).toString()); + a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(((exception))).toString()); } } public boolean g(String s) { - return h.contains(s.trim().toLowerCase()); + return h.contains(((s.trim().toLowerCase()))); } public EntityPlayerMP h(String s) { @@ -316,7 +321,7 @@ public class ServerConfigurationManager { EntityPlayerMP entityplayermp = h(s); if (entityplayermp != null) { - entityplayermp.a.b(new Packet3Chat(s1)); + entityplayermp.a.b(((Packet) (new Packet3Chat(s1)))); } } @@ -331,7 +336,6 @@ public class ServerConfigurationManager { entityplayermp.a.b(packet); } } - } public void i(String s) { @@ -341,10 +345,9 @@ public class ServerConfigurationManager { EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1); if (g(entityplayermp.aw)) { - entityplayermp.a.b(packet3chat); + entityplayermp.a.b(((Packet) (packet3chat))); } } - } public boolean a(String s, Packet packet) { @@ -362,9 +365,7 @@ public class ServerConfigurationManager { for (int i1 = 0; i1 < b.size(); i1++) { l.a((EntityPlayerMP) b.get(i1)); } - } public void a(int i1, int j1, int k1, TileEntity tileentity) {} - } diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java index 63234dd4..c966c17b 100644 --- a/src/main/java/net/minecraft/server/Slot.java +++ b/src/main/java/net/minecraft/server/Slot.java @@ -1,6 +1,5 @@ package net.minecraft.server;
-
public class Slot {
public final int a; // CraftBukkit: private -> public
@@ -8,7 +7,7 @@ public class Slot { public int c;
public int d;
public int e;
-
+
public Slot(IInventory iinventory, int i, int j, int k) {
b = iinventory;
a = i;
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index cc5e7f81..a1285c1a 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -1,8 +1,6 @@ package net.minecraft.server;
-
-public class TileEntityChest extends TileEntity
- implements IInventory {
+public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack e[];
@@ -70,7 +68,6 @@ public class TileEntityChest extends TileEntity e[j] = new ItemStack(nbttagcompound1);
}
}
-
}
public void b(NBTTagCompound nbttagcompound) {
@@ -83,11 +80,11 @@ public class TileEntityChest extends TileEntity nbttagcompound1.a("Slot", (byte) i);
e[i].a(nbttagcompound1);
- nbttaglist.a(nbttagcompound1);
+ nbttaglist.a(((NBTBase) (nbttagcompound1)));
}
}
- nbttagcompound.a("Items", nbttaglist);
+ nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index ff266f7c..164a03da 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -1,8 +1,6 @@ package net.minecraft.server;
-
-public class TileEntityFurnace extends TileEntity
- implements IInventory {
+public class TileEntityFurnace extends TileEntity implements IInventory {
private ItemStack h[];
public int e;
@@ -13,7 +11,7 @@ public class TileEntityFurnace extends TileEntity public ItemStack[] getContents() {
return h;
}
- // CraftBukkit end
+ // CraftBukkit end
public TileEntityFurnace() {
h = new ItemStack[3];
@@ -74,8 +72,8 @@ public class TileEntityFurnace extends TileEntity }
}
- e = nbttagcompound.c("BurnTime");
- g = nbttagcompound.c("CookTime");
+ e = ((int) (nbttagcompound.c("BurnTime")));
+ g = ((int) (nbttagcompound.c("CookTime")));
f = a(h[1]);
}
@@ -91,11 +89,11 @@ public class TileEntityFurnace extends TileEntity nbttagcompound1.a("Slot", (byte) j);
h[j].a(nbttagcompound1);
- nbttaglist.a(nbttagcompound1);
+ nbttaglist.a(((NBTBase) (nbttagcompound1)));
}
}
- nbttagcompound.a("Items", nbttaglist);
+ nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 47af8d8b..f0eb3c13 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1,17 +1,16 @@ package net.minecraft.server; import java.io.File; -import java.util.Random; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +// CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.Event; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; - +// CraftBukkit end public class WorldServer extends World { @@ -20,8 +19,6 @@ public class WorldServer extends World { public boolean C; private MinecraftServer D; private MCHashTable E; - private final CraftWorld world; // CraftBukkit - private final CraftServer server; // CraftBukkit public WorldServer(MinecraftServer minecraftserver, File file, String s, int i) { super(file, s, (new Random()).nextLong(), WorldProvider.a(i)); @@ -32,7 +29,83 @@ public class WorldServer extends World { server = minecraftserver.server; // CraftBukkit } + public void f() { + super.f(); + } + + public void a(Entity entity, boolean flag) { + if (!D.m && (entity instanceof EntityAnimals)) { + entity.l(); + } + if (entity.j == null || !(entity.j instanceof EntityPlayer)) { + super.a(entity, flag); + } + } + + public void b(Entity entity, boolean flag) { + super.a(entity, flag); + } + + protected IChunkProvider a(File file) { + A = new ChunkProviderServer(this, q.a(file), q.c()); + return ((IChunkProvider) (A)); + } + + public List d(int i, int j, int k, int l, int i1, int j1) { + ArrayList arraylist = new ArrayList(); + + for (int k1 = 0; k1 < c.size(); k1++) { + TileEntity tileentity = (TileEntity) c.get(k1); + + if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) { + ((List) (arraylist)).add(((tileentity))); + } + } + + return ((List) (arraylist)); + } + + public boolean a(EntityPlayer entityplayer, int i, int j, int k) { + int l = (int) MathHelper.e(i - m); + int i1 = (int) MathHelper.e(k - o); + + if (l > i1) { + i1 = l; + } + return i1 > 16 || D.f.g(entityplayer.aw); + } + + protected void b(Entity entity) { + super.b(entity); + E.a(entity.g, ((entity))); + } + + protected void c(Entity entity) { + super.c(entity); + E.d(entity.g); + } + + public Entity a(int i) { + return (Entity) E.a(i); + } + + public void a(Entity entity, byte byte0) { + Packet38 packet38 = new Packet38(entity.g, byte0); + + D.k.b(entity, ((Packet) (packet38))); + } + + public Explosion a(Entity entity, double d1, double d2, double d3, float f1, boolean flag) { + Explosion explosion = super.a(entity, d1, d2, d3, f1, flag); + + D.f.a(d1, d2, d3, 64D, ((Packet) (new Packet60(d1, d2, d3, f1, explosion.g)))); + return explosion; + } + // CraftBukkit start + private final CraftWorld world; + private final CraftServer server; + @Override public boolean c(int i1, int j1, int k1, int l1) { boolean result = super.c(i1, j1, k1, l1); @@ -60,8 +133,10 @@ public class WorldServer extends World { public CraftServer getServer() { return server; } + // CraftBukkit end // XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! + // XXX: done because it calls private k() @Override public void g(int i1, int j1, int k1, int l1) { k(i1 - 1, j1, k1, l1); @@ -94,30 +169,29 @@ public class WorldServer extends World { } } - @Override // XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! + @Override public boolean a(int i1, int j1, int k1, int l1, boolean flag) { int i2 = a(j1, k1, l1); Block block = Block.m[i2]; Block block1 = Block.m[i1]; AxisAlignedBB axisalignedbb = block1.d(this, j1, k1, l1); - // Craftbukkit - We dont want to allow the user to override the bounding box check if (flag) { axisalignedbb = null; } if (axisalignedbb != null && !a(axisalignedbb)) { return false; } - + // Craftbukkit start - We dont want to allow the user to override the bounding box check boolean defaultReturn; - + if (block == Block.A || block == Block.B || block == Block.C || block == Block.D || block == Block.ar || block == Block.aS) { defaultReturn = true; } else { defaultReturn = (i1 > 0) && (block == null) && (block1.a(this, j1, k1, l1)); } - + // Craftbukkit - If flag is true, it's natural, not user placement. Don't hook. if (!flag) { BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, getWorld().getBlockAt(j1, k1, l1), i1, defaultReturn); @@ -127,81 +201,6 @@ public class WorldServer extends World { } else { return defaultReturn; } - } - // CraftBukkit stop - - public void f() { - super.f(); - } - - public void a(Entity entity, boolean flag) { - if (!D.m && (entity instanceof EntityAnimals)) { - entity.l(); - } - if (entity.j == null || !(entity.j instanceof EntityPlayer)) { - super.a(entity, flag); - } - } - - public void b(Entity entity, boolean flag) { - super.a(entity, flag); - } - - protected IChunkProvider a(File file) { - A = new ChunkProviderServer(this, q.a(file), q.c()); - return A; - } - - public List<TileEntity> d(int i, int j, int k, int l, int i1, int j1) { - ArrayList<TileEntity> arraylist = new ArrayList<TileEntity>(); - - for (int k1 = 0; k1 < c.size(); k1++) { - TileEntity tileentity = (TileEntity) c.get(k1); - - if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) { - arraylist.add(tileentity); - } - } - - return arraylist; - } - - public boolean a(EntityPlayer entityplayer, int i, int j, int k) { - int l = (int) MathHelper.e(i - m); - int i1 = (int) MathHelper.e(k - o); - - if (l > i1) { - i1 = l; - } - return i1 > 16 || D.f.g(entityplayer.aw); - } - - protected void b(Entity entity) { - super.b(entity); - E.a(entity.g, entity); - } - - protected void c(Entity entity) { - super.c(entity); - E.d(entity.g); - } - - public Entity a(int i) { - return (Entity) E.a(i); - } - - public void a(Entity entity, byte byte0) { - Packet38 packet38 = new Packet38(entity.g, byte0); - - D.k.b(entity, packet38); - } - - public Explosion a(Entity entity, double d1, double d2, double d3, - float f1, boolean flag) { - Explosion explosion = super.a(entity, d1, d2, d3, f1, flag); - - D.f.a(d1, d2, d3, 64D, new Packet60(d1, d2, d3, f1, explosion.g)); - return explosion; + // CraftBukkit end } } - |