Updated against new mc-dev format, takes out quite some casting troubles at the cost of extra ()'s

This commit is contained in:
Erik Broes 2011-01-11 09:25:13 +01:00
parent 75654e8db5
commit 22dab8e985
44 changed files with 770 additions and 817 deletions

View file

@ -1,13 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockButton extends Block { public class BlockButton extends Block {
@ -136,7 +136,7 @@ public class BlockButton extends Block {
} }
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { 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); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -144,6 +144,7 @@ public class BlockButton extends Block {
((WorldServer) world).getServer().getPluginManager().callEvent(bie); ((WorldServer) world).getServer().getPluginManager().callEvent(bie);
if (bie.isCancelled()) return true; if (bie.isCancelled()) return true;
// CraftBukkit end
if (world.z) { if (world.z) {
return true; return true;
@ -255,4 +256,3 @@ public class BlockButton extends Block {
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
} }
} }

View file

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.LivingEntity; import org.bukkit.LivingEntity;
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftEntity;
@ -7,6 +8,7 @@ import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.entity.EntityDamagedByBlockEvent; import org.bukkit.event.entity.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedEvent; import org.bukkit.event.entity.EntityDamagedEvent;
// CraftBukkit end
import java.util.Random; 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) { 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; CraftEntity toPassIn = null;
if(entity instanceof EntityPlayerMP) if (entity instanceof EntityPlayerMP) {
{
toPassIn = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity); toPassIn = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity);
} else if(entity instanceof EntityLiving) } else if (entity instanceof EntityLiving) {
{
toPassIn = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity); toPassIn = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity);
} }
if(toPassIn != null)
{ if(toPassIn != null) {
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1); EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1);
((WorldServer) world).getServer().getPluginManager().callEvent(edbbe); ((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);
}
}
if (edbbe.isCancelled())
return;
}
// CraftBukkit end TODO: Other entities (when their respective classes are added) hitting a Cactus
entity.a(((Entity) (null)), 1);
}
}

View file

@ -1,13 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockChest extends BlockContainer { public class BlockChest extends BlockContainer {
@ -83,8 +83,8 @@ public class BlockChest extends BlockContainer {
TileEntityChest tileentitychest = (TileEntityChest) world.l(i, j, k); TileEntityChest tileentitychest = (TileEntityChest) world.l(i, j, k);
label0: label0:
for (int l = 0; l < tileentitychest.a(); l++) { for (int l = 0; l < ((IInventory) (tileentitychest)).a(); l++) {
ItemStack itemstack = tileentitychest.a(l); ItemStack itemstack = ((IInventory) (tileentitychest)).a(l);
if (itemstack == null) { if (itemstack == null) {
continue; continue;
@ -109,7 +109,7 @@ public class BlockChest extends BlockContainer {
entityitem.s = (float) a.nextGaussian() * f3; entityitem.s = (float) a.nextGaussian() * f3;
entityitem.t = (float) a.nextGaussian() * f3 + 0.2F; entityitem.t = (float) a.nextGaussian() * f3 + 0.2F;
entityitem.u = (float) a.nextGaussian() * f3; entityitem.u = (float) a.nextGaussian() * f3;
world.a(entityitem); world.a(((Entity) (entityitem)));
} while (true); } while (true);
} }
@ -117,7 +117,7 @@ public class BlockChest extends BlockContainer {
} }
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) { 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)) { if (world.d(i, j + 1, k)) {
return true; return true;
@ -135,35 +135,36 @@ public class BlockChest extends BlockContainer {
return true; return true;
} }
if (world.a(i - 1, j, k) == bh) { 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) { 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) { 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) { 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) { if (world.z) {
return true; return true;
} else { } else {
// Craftbukkit start - Interact Chest // CraftBukkit start - Interact Chest
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
((WorldServer) world).getServer().getPluginManager().callEvent(bie); ((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; return true;
} }
} }
protected TileEntity a_() { protected TileEntity a_() {
return new TileEntityChest(); return ((TileEntity) (new TileEntityChest()));
} }
} }

View file

@ -1,13 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockDoor extends Block { 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) { 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); return super.d(world, i, j, k);
} }
@ -72,7 +71,7 @@ public class BlockDoor extends Block {
return true; return true;
} }
// Craftbukkit start - Interact Door // CraftBukkit start - Interact Door
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -86,6 +85,7 @@ public class BlockDoor extends Block {
((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j + 1, k, (WorldServer) world)); ((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j + 1, k, (WorldServer) world));
return true; return true;
} }
// CraftBukkit end
if (world.a(i, j + 1, k) == bh) { if (world.a(i, j + 1, k) == bh) {
world.b(i, j + 1, k, (l ^ 4) + 8); world.b(i, j + 1, k, (l ^ 4) + 8);
@ -192,4 +192,3 @@ public class BlockDoor extends Block {
} }
} }
} }

View file

@ -1,12 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.BlockFace; import org.bukkit.BlockFace;
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
// CraftBukkit end
public class BlockFlowing extends BlockFluids { public class BlockFlowing extends BlockFluids {
@ -87,7 +88,7 @@ public class BlockFlowing extends BlockFluids {
i(world, i1, j1, k1); i(world, i1, j1, k1);
} }
// Craftbukkit start // CraftBukkit start
CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i1, j1, k1); CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i1, j1, k1);
if (l(world, i1, j1 - 1, k1)) { if (l(world, i1, j1 - 1, k1)) {
// Craftbucket send "down" to the server // Craftbucket send "down" to the server
@ -101,6 +102,7 @@ public class BlockFlowing extends BlockFluids {
world.b(i1, j1 - 1, k1, bh, l1 + 8); world.b(i1, j1 - 1, k1, bh, l1 + 8);
} }
} }
// CraftBukkit end
} else if (l1 >= 0 && (l1 == 0 || k(world, i1, j1 - 1, k1))) { } else if (l1 >= 0 && (l1 == 0 || k(world, i1, j1 - 1, k1))) {
boolean aflag[] = j(world, i1, j1, k1); boolean aflag[] = j(world, i1, j1, k1);
int k2 = l1 + byte0; int k2 = l1 + byte0;
@ -111,7 +113,7 @@ public class BlockFlowing extends BlockFluids {
if (k2 >= 8) { if (k2 >= 8) {
return; 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 }; BlockFace[] faces = new BlockFace[]{ BlockFace.North, BlockFace.South, BlockFace.East, BlockFace.West };
int index = 0; int index = 0;
for (BlockFace currentFace: faces) { for (BlockFace currentFace: faces) {
@ -124,8 +126,8 @@ public class BlockFlowing extends BlockFluids {
} }
index++; index++;
} }
// CraftBukkit end
} }
// Craftbukkit stop
} }
private void f(World world, int i1, int j1, int k1, int l1) { private void f(World world, int i1, int j1, int k1, int l1) {
@ -278,4 +280,3 @@ public class BlockFlowing extends BlockFluids {
} }
} }
} }

View file

@ -1,13 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockFurnace extends BlockContainer { public class BlockFurnace extends BlockContainer {
@ -47,7 +47,7 @@ public class BlockFurnace extends BlockContainer {
if (Block.o[k1] && !Block.o[j1]) { if (Block.o[k1] && !Block.o[j1]) {
byte0 = 4; byte0 = 4;
} }
world.b(i, j, k, byte0); world.b(i, j, k, ((int) (byte0)));
} }
public int a(int i) { public int a(int i) {
@ -68,7 +68,7 @@ public class BlockFurnace extends BlockContainer {
if (world.z) { if (world.z) {
return true; return true;
} else { } else {
// Craftbukkit start - Interact Furnace // CraftBukkit start - Interact Furnace
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -76,6 +76,7 @@ public class BlockFurnace extends BlockContainer {
((WorldServer) world).getServer().getPluginManager().callEvent(bie); ((WorldServer) world).getServer().getPluginManager().callEvent(bie);
if (bie.isCancelled()) return true; if (bie.isCancelled()) return true;
// CraftBukkit end
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.l(i, j, k); TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.l(i, j, k);
@ -98,7 +99,7 @@ public class BlockFurnace extends BlockContainer {
} }
protected TileEntity a_() { protected TileEntity a_() {
return new TileEntityFurnace(); return ((TileEntity) (new TileEntityFurnace()));
} }
public void a(World world, int i, int j, int k, EntityLiving entityliving) { public void a(World world, int i, int j, int k, EntityLiving entityliving) {
@ -118,4 +119,3 @@ public class BlockFurnace extends BlockContainer {
} }
} }
} }

View file

@ -1,11 +1,11 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockJukeBox extends Block { public class BlockJukeBox extends Block {
@ -21,7 +21,7 @@ public class BlockJukeBox extends Block {
int l = world.b(i, j, k); int l = world.b(i, j, k);
if (l > 0) { if (l > 0) {
// Craftbukkit start - Interact Jukebox // CraftBukkit start - Interact Jukebox
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -29,6 +29,7 @@ public class BlockJukeBox extends Block {
((WorldServer) world).getServer().getPluginManager().callEvent(bie); ((WorldServer) world).getServer().getPluginManager().callEvent(bie);
if (bie.isCancelled()) return true; if (bie.isCancelled()) return true;
// CraftBukkit end
f(world, i, j, k, l); f(world, i, j, k, l);
return true; return true;
@ -38,7 +39,7 @@ public class BlockJukeBox extends Block {
} }
public void f(World world, int i, int j, int k, int l) { 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); world.b(i, j, k, 0);
int i1 = (Item.aU.aW + l) - 1; int i1 = (Item.aU.aW + l) - 1;
float f1 = 0.7F; 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 entityitem = new EntityItem(world, (double) i + d, (double) j + d1, (double) k + d2, new ItemStack(i1));
entityitem.c = 10; 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) { 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); super.a(world, i, j, k, l, f1);
} }
} }

View file

@ -1,12 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
// CraftBukkit end
public class BlockLeaves extends BlockLeavesBase { public class BlockLeaves extends BlockLeavesBase {
@ -33,11 +34,8 @@ public class BlockLeaves extends BlockLeavesBase {
world.c(i + j1, j + k1, k + l1, 7); 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; b[(k1 + j1) * i1 + (j2 + j1) * byte1 + (l2 + j1)] = -1;
} }
} }
} }
} }
for (int l1 = 1; l1 <= 4; l1++) { 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; b[(k2 + j1) * i1 + (i3 + j1) * byte1 + (k3 + j1 + 1)] = l1;
} }
} }
} }
} }
} }
} }
int i2 = b[j1 * i1 + j1 * byte1 + j1]; 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) { private void g(World world, int i, int j, int k) {
// Craftbukkit start // CraftBukkit start
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
CraftWorld cworld = ((WorldServer) world).getWorld(); CraftWorld cworld = ((WorldServer) world).getWorld();
LeavesDecayEvent event = new LeavesDecayEvent(Type.LEAVES_DECAY, cworld.getBlockAt(i, j, k)); LeavesDecayEvent event = new LeavesDecayEvent(Type.LEAVES_DECAY, cworld.getBlockAt(i, j, k));
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) return;
return; // CraftBukkit end
}
// Craftbukkit end
a_(world, i, j, k, world.b(i, j, k)); a_(world, i, j, k, world.b(i, j, k));
world.d(i, j, k, 0); world.d(i, j, k, 0);
@ -152,4 +142,3 @@ public class BlockLeaves extends BlockLeavesBase {
super.b(world, i, j, k, entity); super.b(world, i, j, k, entity);
} }
} }

View file

@ -1,10 +1,11 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockLever extends Block { public class BlockLever extends Block {
@ -139,7 +140,7 @@ public class BlockLever extends Block {
return true; return true;
} }
// Craftbukkit start - Interact Lever // CraftBukkit start - Interact Lever
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -152,6 +153,7 @@ public class BlockLever extends Block {
((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world)); ((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
return true; return true;
} }
// CraftBukkit end
int l = world.b(i, j, k); int l = world.b(i, j, k);
int i1 = l & 7; int i1 = l & 7;
@ -228,4 +230,3 @@ public class BlockLever extends Block {
return true; return true;
} }
} }

View file

@ -1,15 +1,15 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockPressurePlate extends Block { public class BlockPressurePlate extends Block {
@ -73,10 +73,11 @@ public class BlockPressurePlate extends Block {
if (world.b(i, j, k) == 1) { if (world.b(i, j, k) == 1) {
return; return;
} else { } else {
// CraftBukkit start - Interact Pressure Plate
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
// Craftbukkit start - Interact Pressure Plate
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftLivingEntity craftEntity = null; CraftLivingEntity craftEntity = null;
if (entity instanceof EntityPlayerMP) { if (entity instanceof EntityPlayerMP) {
craftEntity = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity); craftEntity = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity);
} else { } else {
@ -88,6 +89,7 @@ public class BlockPressurePlate extends Block {
if (bie.isCancelled()) return; if (bie.isCancelled()) return;
} }
// CraftBukkit end
g(world, i, j, k); g(world, i, j, k);
return; return;
@ -101,7 +103,7 @@ public class BlockPressurePlate extends Block {
List list = null; List list = null;
if (a == EnumMobType.a) { 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) { 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)); 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; return true;
} }
} }

View file

@ -1,10 +1,11 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
// CraftBukkit end
public class BlockWorkbench extends Block { public class BlockWorkbench extends Block {
@ -31,7 +32,7 @@ public class BlockWorkbench extends Block {
if (world.z) { if (world.z) {
return true; return true;
} else { } else {
// Craftbukkit start - Interact Workbench // CraftBukkit start - Interact Workbench
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player); BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
@ -39,10 +40,10 @@ public class BlockWorkbench extends Block {
((WorldServer) world).getServer().getPluginManager().callEvent(bie); ((WorldServer) world).getServer().getPluginManager().callEvent(bie);
if (bie.isCancelled()) return true; if (bie.isCancelled()) return true;
// CraftBukkit end
entityplayer.a(i, j, k); entityplayer.a(i, j, k);
return true; return true;
} }
} }
} }

View file

@ -1,17 +1,17 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.world.ChunkLoadedEvent; import org.bukkit.event.world.ChunkLoadedEvent;
// CraftBukkit end
public class ChunkProviderServer implements IChunkProvider {
public class ChunkProviderServer
implements IChunkProvider {
private Set a; private Set a;
private Chunk b; private Chunk b;
@ -22,10 +22,10 @@ public class ChunkProviderServer
private WorldServer g; private WorldServer g;
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
a = new HashSet(); a = ((Set) (new HashSet()));
e = new HashMap(); e = ((Map) (new HashMap()));
f = new ArrayList(); f = ((List) (new ArrayList()));
b = new Chunk(worldserver, new byte[32768], 0, 0); b = new Chunk(((World) (worldserver)), new byte[32768], 0, 0);
b.q = true; b.q = true;
b.p = true; b.p = true;
g = worldserver; g = worldserver;
@ -36,7 +36,7 @@ public class ChunkProviderServer
public boolean a(int i, int j) { public boolean a(int i, int j) {
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
return e.containsKey(chunkcoordinates); return e.containsKey(((chunkcoordinates)));
} }
public void c(int i, int j) { public void c(int i, int j) {
@ -45,15 +45,15 @@ public class ChunkProviderServer
char c1 = '\200'; char c1 = '\200';
if (k < -c1 || k > c1 || l < -c1 || l > c1) { 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) { public Chunk d(int i, int j) {
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
a.remove(new ChunkCoordinates(i, j)); a.remove(((new ChunkCoordinates(i, j))));
Chunk chunk = (Chunk) e.get(chunkcoordinates); Chunk chunk = (Chunk) e.get(((chunkcoordinates)));
if (chunk == null) { if (chunk == null) {
chunk = e(i, j); chunk = e(i, j);
@ -64,14 +64,14 @@ public class ChunkProviderServer
chunk = c.b(i, j); chunk = c.b(i, j);
} }
} }
e.put(chunkcoordinates, chunk); e.put(((chunkcoordinates)), ((chunk)));
f.add(chunk); f.add(((chunk)));
chunk.c(); chunk.c();
if (chunk != null) { if (chunk != null) {
chunk.d(); chunk.d();
} }
// Craftbukkit start // CraftBukkit start
CraftServer server = g.getServer(); CraftServer server = g.getServer();
if (server != null) { if (server != null) {
/* /*
@ -83,19 +83,19 @@ public class ChunkProviderServer
CraftChunk cchunk = world.updateChunk(i, j); CraftChunk cchunk = world.updateChunk(i, j);
server.getPluginManager().callEvent(new ChunkLoadedEvent(Type.CHUNK_LOADED, cchunk)); 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)) { 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)) { 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)) { 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)) { 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; return chunk;
@ -103,7 +103,7 @@ public class ChunkProviderServer
public Chunk b(int i, int j) { public Chunk b(int i, int j) {
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j); ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
Chunk chunk = (Chunk) e.get(chunkcoordinates); Chunk chunk = (Chunk) e.get(((chunkcoordinates)));
if (chunk == null) { if (chunk == null) {
if (g.x) { if (g.x) {
@ -121,7 +121,7 @@ public class ChunkProviderServer
return null; return null;
} }
try { try {
Chunk chunk = d.a(g, i, j); Chunk chunk = d.a(((World) (g)), i, j);
if (chunk != null) { if (chunk != null) {
chunk.s = g.e; chunk.s = g.e;
@ -138,7 +138,7 @@ public class ChunkProviderServer
return; return;
} }
try { try {
d.b(g, chunk); d.b(((World) (g)), chunk);
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
@ -150,8 +150,8 @@ public class ChunkProviderServer
} }
try { try {
chunk.s = g.e; chunk.s = g.e;
d.a(g, chunk); d.a(((World) (g)), chunk);
} catch (Throwable ioexception) { // Craftbukkit: Cast down to compile } catch (Throwable ioexception) { // CraftBukkit -- downcast to work
ioexception.printStackTrace(); ioexception.printStackTrace();
} }
} }
@ -206,9 +206,9 @@ public class ChunkProviderServer
chunk.e(); chunk.e();
b(chunk); b(chunk);
a(chunk); a(chunk);
a.remove(chunkcoordinates); a.remove(((chunkcoordinates)));
e.remove(chunkcoordinates); e.remove(((chunkcoordinates)));
f.remove(chunk); f.remove(((chunk)));
} }
} }
@ -223,4 +223,3 @@ public class ChunkProviderServer
return !g.C; return !g.C;
} }
} }

View file

@ -1,16 +1,16 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftEntity;
import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamagedEvent; import org.bukkit.event.entity.EntityDamagedEvent;
// CraftBukkit end
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public abstract class Entity { public abstract class Entity {
private static int a = 0; 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); l.a("splash", p + (double) f4, f2 + 1.0F, r + (double) f6, s, t, u);
} }
} }
N = 0.0F; N = 0.0F;
ab = true; ab = true;
@ -280,7 +279,6 @@ public abstract class Entity {
d3 += d9; d3 += d9;
} }
} }
} }
List list = l.a(this, z.a(d1, d2, d3)); List list = l.a(this, z.a(d1, d2, d3));
@ -377,7 +375,7 @@ public abstract class Entity {
double d13 = r - d5; double d13 = r - d5;
if (M && !flag) { 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 k3 = MathHelper.b(p);
int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H); int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H);
int l1 = MathHelper.b(r); int l1 = MathHelper.b(r);
@ -412,9 +410,7 @@ public abstract class Entity {
Block.m[l5].a(l, i5, j5, k5, this); Block.m[l5].a(l, i5, j5, k5, this);
} }
} }
} }
} }
R *= 0.4F; R *= 0.4F;
@ -444,7 +440,7 @@ public abstract class Entity {
N = 0.0F; N = 0.0F;
} }
} else if (d1 < 0.0D) { } else if (d1 < 0.0D) {
N -= d1; N -= ((float) (d1));
} }
} }
@ -458,20 +454,23 @@ public abstract class Entity {
protected void b(int i1) { protected void b(int i1) {
if (!ae) { if (!ae) {
if(this instanceof EntityLiving) // CraftBukkit start
{ if(this instanceof EntityLiving) {
CraftEntity defender = null; CraftEntity defender = null;
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
if(this instanceof EntityPlayerMP)
{ if (this instanceof EntityPlayerMP) {
defender = new CraftPlayer(server, (EntityPlayerMP)this); defender = new CraftPlayer(server, (EntityPlayerMP)this);
} else { } else {
defender = new CraftLivingEntity(server, (EntityLiving)this); defender = new CraftLivingEntity(server, (EntityLiving)this);
} }
EntityDamagedEvent ede = new EntityDamagedEvent(defender, EntityDamagedEvent.DamageCause.FIRE, i1); EntityDamagedEvent ede = new EntityDamagedEvent(defender, EntityDamagedEvent.DamageCause.FIRE, i1);
server.getPluginManager().callEvent(ede); server.getPluginManager().callEvent(ede);
if (ede.isCancelled()) return; if (ede.isCancelled()) return;
} }
// CraftBukkit end
a(((Entity) (null)), i1); a(((Entity) (null)), i1);
} }
} }
@ -535,8 +534,7 @@ public abstract class Entity {
return l.k(i1, j1, k1); return l.k(i1, j1, k1);
} }
public void b(double d1, double d2, double d3, float f1, public void b(double d1, double d2, double d3, float f1, float f2) {
float f2) {
m = p = d1; m = p = d1;
n = q = d2; n = q = d2;
o = r = d3; o = r = d3;
@ -555,8 +553,7 @@ public abstract class Entity {
b(f1, f2); b(f1, f2);
} }
public void c(double d1, double d2, double d3, float f1, public void c(double d1, double d2, double d3, float f1, float f2) {
float f2) {
m = p = d1; m = p = d1;
n = q = d2 + (double) H; n = q = d2 + (double) H;
o = r = d3; o = r = d3;
@ -665,15 +662,15 @@ public abstract class Entity {
} }
public void d(NBTTagCompound nbttagcompound) { public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Pos", a(new double[] { nbttagcompound.a("Pos", ((NBTBase) (a(new double[] {
p, q, r p, q, r
})); }))));
nbttagcompound.a("Motion", a(new double[] { nbttagcompound.a("Motion", ((NBTBase) (a(new double[] {
s, t, u s, t, u
})); }))));
nbttagcompound.a("Rotation", a(new float[] { nbttagcompound.a("Rotation", ((NBTBase) (a(new float[] {
v, w v, w
})); }))));
nbttagcompound.a("FallDistance", N); nbttagcompound.a("FallDistance", N);
nbttagcompound.a("Fire", (short) Z); nbttagcompound.a("Fire", (short) Z);
nbttagcompound.a("Air", (short) ad); nbttagcompound.a("Air", (short) ad);
@ -696,8 +693,8 @@ public abstract class Entity {
x = v = ((NBTTagFloat) nbttaglist2.a(0)).a; x = v = ((NBTTagFloat) nbttaglist2.a(0)).a;
y = w = ((NBTTagFloat) nbttaglist2.a(1)).a; y = w = ((NBTTagFloat) nbttaglist2.a(1)).a;
N = nbttagcompound.f("FallDistance"); N = nbttagcompound.f("FallDistance");
Z = nbttagcompound.c("Fire"); Z = ((int) (nbttagcompound.c("Fire")));
ad = nbttagcompound.c("Air"); ad = ((int) (nbttagcompound.c("Air")));
A = nbttagcompound.l("OnGround"); A = nbttagcompound.l("OnGround");
a(p, q, r); a(p, q, r);
b(nbttagcompound); b(nbttagcompound);
@ -719,7 +716,7 @@ public abstract class Entity {
for (int j1 = 0; j1 < i1; j1++) { for (int j1 = 0; j1 < i1; j1++) {
double d1 = ad2[j1]; double d1 = ad2[j1];
nbttaglist.a(new NBTTagDouble(d1)); nbttaglist.a(((NBTBase) (new NBTTagDouble(d1))));
} }
return nbttaglist; return nbttaglist;
@ -733,7 +730,7 @@ public abstract class Entity {
for (int j1 = 0; j1 < i1; j1++) { for (int j1 = 0; j1 < i1; j1++) {
float f1 = af2[j1]; float f1 = af2[j1];
nbttaglist.a(new NBTTagFloat(f1)); nbttaglist.a(((NBTBase) (new NBTTagFloat(f1))));
} }
return nbttaglist; 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 entityitem = new EntityItem(l, p, q + (double) f1, r, new ItemStack(i1, j1));
entityitem.c = 10; entityitem.c = 10;
l.a(entityitem); l.a(((Entity) (entityitem)));
return entityitem; return entityitem;
} }
@ -813,8 +810,8 @@ public abstract class Entity {
} }
e -= d1; e -= d1;
d -= d2; d -= d2;
v += d1; v += ((float) (d1));
w += d2; w += ((float) (d2));
} }
public void A() { public void A() {
@ -829,10 +826,17 @@ public abstract class Entity {
return (double) J * 0.75D; return (double) J * 0.75D;
} }
public void e(Entity entity) {
// CraftBukkit start
setPassengerOf(entity);
}
public void setPassengerOf(Entity entity) { public void setPassengerOf(Entity entity) {
// e(null) doesn't really fly for overloaded methods, // e(null) doesn't really fly for overloaded methods,
// so this method is needed // so this method is needed
//CraftBukkit end
d = 0.0D; d = 0.0D;
e = 0.0D; e = 0.0D;
if (entity == null) { if (entity == null) {
@ -859,10 +863,6 @@ public abstract class Entity {
entity.j = this; entity.j = this;
} }
public void e(Entity entity) {
setPassengerOf(entity);
}
public Vec3D C() { public Vec3D C() {
return null; return null;
} }
@ -872,6 +872,4 @@ public abstract class Entity {
public int[] E() { public int[] E() {
return null; return null;
} }
} }

View file

@ -1,12 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List; import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftBoat; import org.bukkit.craftbukkit.CraftBoat;
import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftEntity;
import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.CraftMappable;
import org.bukkit.craftbukkit.CraftMinecart;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.vehicle.VehicleCreateEvent; 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.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.event.vehicle.VehicleMoveEvent;
// CraftBukkit end
public class EntityBoat extends Entity implements CraftMappable { public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
private CraftBoat boat;
public int a; public int a;
public int b; public int b;
@ -29,9 +29,13 @@ public class EntityBoat extends Entity implements CraftMappable {
private double ak; private double ak;
private double al; private double al;
// CraftBukkit start
private CraftBoat boat;
public CraftEntity getCraftEntity() { public CraftEntity getCraftEntity() {
return boat; return boat;
} }
// CraftBukkit end
public EntityBoat(World world) { public EntityBoat(World world) {
super(world); super(world);
@ -43,9 +47,7 @@ public class EntityBoat extends Entity implements CraftMappable {
H = J / 2.0F; H = J / 2.0F;
M = false; M = false;
// CraftBukkit start handleCreation(world); // CraftBukkit
handleCreation(world);
// CraftBukkit end
} }
public AxisAlignedBB d(Entity entity) { public AxisAlignedBB d(Entity entity) {
@ -70,17 +72,14 @@ public class EntityBoat extends Entity implements CraftMappable {
n = d2; n = d2;
o = d3; o = d3;
// CraftBukkit start handleCreation(world); // CraftBukkit
handleCreation(world);
// CraftBukkit end
} }
// CraftBukkit start // CraftBukkit start
private void handleCreation(World world) { private void handleCreation(World world) {
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
boat = new CraftBoat(server, this); boat = new CraftBoat(server, this);
VehicleCreateEvent event = new VehicleCreateEvent( VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, boat);
Type.VEHICLE_CREATE, boat);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
} }
// CraftBukkit end // CraftBukkit end
@ -91,9 +90,7 @@ public class EntityBoat extends Entity implements CraftMappable {
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
// CraftBukkit start // CraftBukkit start
VehicleDamageEvent event = new VehicleDamageEvent( VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, boat, ((WorldServer)l).getWorld().toCraftEntity(entity), i);
Type.VEHICLE_DAMAGE, boat,
((WorldServer)l).getWorld().toCraftEntity(entity), i);
((WorldServer) l).getServer().getPluginManager().callEvent(event); ((WorldServer) l).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -127,11 +124,13 @@ public class EntityBoat extends Entity implements CraftMappable {
} }
public void b_() { public void b_() {
// CraftBukkit start
double prevX = p; double prevX = p;
double prevY = q; double prevY = q;
double prevZ = r; double prevZ = r;
float prevYaw = v; float prevYaw = v;
float prevPitch = w; float prevPitch = w;
// CraftBukkit end
super.b_(); super.b_();
if (b > 0) { if (b > 0) {
@ -169,8 +168,8 @@ public class EntityBoat extends Entity implements CraftMappable {
for (; d13 >= 180D; d13 -= 360D) { for (; d13 >= 180D; d13 -= 360D) {
; ;
} }
v += d13 / (double) d; v += ((float) (d13 / (double) d));
w += (al - (double) w) / (double) d; w += ((float) ((al - (double) w) / (double) d));
d--; d--;
a(d4, d7, d10); a(d4, d7, d10);
b(v, w); b(v, w);
@ -252,7 +251,6 @@ public class EntityBoat extends Entity implements CraftMappable {
for (int j1 = 0; j1 < 2; j1++) { for (int j1 = 0; j1 < 2; j1++) {
a(Item.B.aW, 1, 0.0F); a(Item.B.aW, 1, 0.0F);
} }
} }
} else { } else {
s *= 0.99000000953674316D; s *= 0.99000000953674316D;
@ -281,29 +279,30 @@ public class EntityBoat extends Entity implements CraftMappable {
if (d25 < -20D) { if (d25 < -20D) {
d25 = -20D; d25 = -20D;
} }
v += d25; v += ((float) (d25));
b(v, w); b(v, w);
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
VehicleMoveEvent event = new VehicleMoveEvent( VehicleMoveEvent event = new VehicleMoveEvent(
Type.VEHICLE_MOVE, boat, Type.VEHICLE_MOVE,
boat,
new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch),
new Location(((WorldServer)l).getWorld(), p, q, r, v, w)); new Location(((WorldServer)l).getWorld(), p, q, r, v, w)
);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// CraftBukkit end // 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) { if (list != null && list.size() > 0) {
for (int k1 = 0; k1 < list.size(); k1++) { for (int k1 = 0; k1 < list.size(); k1++) {
Entity entity = (Entity) list.get(k1); Entity entity = (Entity) list.get(k1);
if (entity != j && entity.v() && (entity instanceof EntityBoat)) { if (entity != j && entity.v() && (entity instanceof EntityBoat)) {
entity.c(this); entity.c(((Entity) (this)));
} }
} }
} }
if (j != null && j.G) { if (j != null && j.G) {
j = null; j = null;
@ -322,21 +321,19 @@ public class EntityBoat extends Entity implements CraftMappable {
} }
} }
public void c(Entity entity) {
// CraftBukkit start // CraftBukkit start
public void c(Entity entity) {
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, boat, ((WorldServer)l).getWorld().toCraftEntity(entity));
Type.VEHICLE_COLLISION_ENTITY, boat,
((WorldServer)l).getWorld().toCraftEntity(entity));
server.getPluginManager().callEvent(collsionEvent); server.getPluginManager().callEvent(collsionEvent);
if (collsionEvent.isCancelled()) { if (collsionEvent.isCancelled()) {
return; return;
} }
// CraftBukkit end
super.c(entity); super.c(entity);
} }
// CraftBukkit end
protected void a(NBTTagCompound nbttagcompound) {} protected void a(NBTTagCompound nbttagcompound) {}
@ -349,10 +346,7 @@ public class EntityBoat extends Entity implements CraftMappable {
if (!l.z) { if (!l.z) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
VehicleEnterEvent event = new VehicleEnterEvent( VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, boat, ((WorldServer)l).getWorld().toCraftEntity(entityplayer));
Type.VEHICLE_ENTER,
boat,
((WorldServer)l).getWorld().toCraftEntity(entityplayer));
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -360,9 +354,8 @@ public class EntityBoat extends Entity implements CraftMappable {
} }
// CraftBukkit end // CraftBukkit end
entityplayer.e(this); entityplayer.e(((Entity) (this)));
} }
return true; return true;
} }
} }

View file

@ -1,7 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List; import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Vector; import org.bukkit.Vector;
import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftEntity;
@ -10,11 +12,9 @@ import org.bukkit.craftbukkit.CraftMinecart;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.vehicle.*; import org.bukkit.event.vehicle.*;
// CraftBukkit end
public class EntityMinecart extends Entity public class EntityMinecart extends Entity implements IInventory, CraftMappable { // CraftBukkit
implements IInventory, CraftMappable {
private CraftMinecart minecart;
private ItemStack ak[]; private ItemStack ak[];
public int a; public int a;
@ -95,6 +95,9 @@ public class EntityMinecart extends Entity
private double ar; private double ar;
private double as; private double as;
// CraftBukkit start
private CraftMinecart minecart;
private boolean slowWhenEmpty = true; private boolean slowWhenEmpty = true;
private double derailedX = 0.5; private double derailedX = 0.5;
private double derailedY = 0.5; private double derailedY = 0.5;
@ -107,6 +110,11 @@ public class EntityMinecart extends Entity
return minecart; return minecart;
} }
public ItemStack[] getContents() {
return this.ak;
}
// CraftBukkit end
public EntityMinecart(World world) { public EntityMinecart(World world) {
super(world); super(world);
ak = new ItemStack[36]; ak = new ItemStack[36];
@ -119,17 +127,9 @@ public class EntityMinecart extends Entity
H = J / 2.0F; H = J / 2.0F;
M = false; M = false;
// CraftBukkit start handleCreation(world); // CraftBukkit
handleCreation(world);
// CraftBukkit end
} }
// CraftBukkit start
public ItemStack[] getContents() {
return this.ak;
}
// CraftBukkit end
public AxisAlignedBB d(Entity entity) { public AxisAlignedBB d(Entity entity) {
return entity.z; return entity.z;
} }
@ -142,8 +142,7 @@ public class EntityMinecart extends Entity
return true; return true;
} }
public EntityMinecart(World world, double d1, double d2, double d3, public EntityMinecart(World world, double d1, double d2, double d3, int i) {
int i) {
this(world); this(world);
a(d1, d2 + (double) H, d3); a(d1, d2 + (double) H, d3);
s = 0.0D; s = 0.0D;
@ -154,17 +153,14 @@ public class EntityMinecart extends Entity
o = d3; o = d3;
d = i; d = i;
// CraftBukkit start handleCreation(world); // CraftBukkit
handleCreation(world);
// CraftBukkit end
} }
// CraftBukkit start // CraftBukkit start
private void handleCreation(World world) { private void handleCreation(World world) {
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
minecart = CraftMinecart.getCraftMinecart(server, this); minecart = CraftMinecart.getCraftMinecart(server, this);
VehicleCreateEvent event = new VehicleCreateEvent( VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, minecart);
Type.VEHICLE_CREATE, minecart);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
} }
// CraftBukkit end // CraftBukkit end
@ -175,17 +171,14 @@ public class EntityMinecart extends Entity
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
// CraftBukkit start // CraftBukkit start
VehicleDamageEvent event = new VehicleDamageEvent( VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity), i);
Type.VEHICLE_DAMAGE, minecart,
((WorldServer)l).getWorld().toCraftEntity(entity), i);
((WorldServer)l).getServer().getPluginManager().callEvent(event); ((WorldServer)l).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return true; return true;
} }
// CraftBukkit end
i = event.getDamage(); i = event.getDamage();
// CraftBukkit end
if (l.z || G) { if (l.z || G) {
return true; return true;
@ -238,7 +231,7 @@ public class EntityMinecart extends Entity
entityitem.s = (float) W.nextGaussian() * f4; entityitem.s = (float) W.nextGaussian() * f4;
entityitem.t = (float) W.nextGaussian() * f4 + 0.2F; entityitem.t = (float) W.nextGaussian() * f4 + 0.2F;
entityitem.u = (float) W.nextGaussian() * f4; entityitem.u = (float) W.nextGaussian() * f4;
l.a(entityitem); l.a(((Entity) (entityitem)));
} while (true); } while (true);
} }
@ -246,12 +239,13 @@ public class EntityMinecart extends Entity
} }
public void b_() { public void b_() {
// CraftBukkit start
double prevX = p; double prevX = p;
double prevY = q; double prevY = q;
double prevZ = r; double prevZ = r;
float prevYaw = v; float prevYaw = v;
float prevPitch = w; float prevPitch = w;
// CraftBukkit end
if (b > 0) { if (b > 0) {
b--; b--;
} }
@ -271,8 +265,8 @@ public class EntityMinecart extends Entity
for (; d4 >= 180D; d4 -= 360D) { for (; d4 >= 180D; d4 -= 360D) {
; ;
} }
v += d4 / (double) an; v += ((float) (d4 / (double) an));
w += (as - (double) w) / (double) an; w += ((float) ((as - (double) w) / (double) an));
an--; an--;
a(d1, d2, d3); a(d1, d2, d3);
b(v, w); 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]) { } 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); a(p, q + (double) ai[1][1], r);
} }
// CraftBukkit
if (j != null || !slowWhenEmpty) { if (j != null || !slowWhenEmpty) {
s *= 0.99699997901916504D; s *= 0.99699997901916504D;
t *= 0.0D; t *= 0.0D;
@ -459,18 +454,21 @@ public class EntityMinecart extends Entity
u = d6; u = d6;
} }
if (A) { if (A) {
// CraftBukkit start
s *= derailedX; s *= derailedX;
t *= derailedY; t *= derailedY;
u *= derailedZ; u *= derailedZ;
// CraftBukkit end
} }
c(s, t, u); c(s, t, u);
if (!A) { if (!A) {
// CraftBukkit start
s *= flyingX; s *= flyingX;
t *= flyingY; t *= flyingY;
u *= flyingZ; u *= flyingZ;
// CraftBukkit end
} }
} }
w = 0.0F; w = 0.0F;
double d28 = m - p; double d28 = m - p;
double d29 = o - r; double d29 = o - r;
@ -498,23 +496,24 @@ public class EntityMinecart extends Entity
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
VehicleMoveEvent event = new VehicleMoveEvent( VehicleMoveEvent event = new VehicleMoveEvent(
Type.VEHICLE_MOVE, minecart, Type.VEHICLE_MOVE,
minecart,
new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch),
new Location(((WorldServer)l).getWorld(), p, q, r, v, w)); new Location(((WorldServer)l).getWorld(), p, q, r, v, w)
);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// CraftBukkit end // 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) { if (list != null && list.size() > 0) {
for (int i2 = 0; i2 < list.size(); i2++) { for (int i2 = 0; i2 < list.size(); i2++) {
Entity entity = (Entity) list.get(i2); Entity entity = (Entity) list.get(i2);
if (entity != j && entity.v() && (entity instanceof EntityMinecart)) { if (entity != j && entity.v() && (entity instanceof EntityMinecart)) {
entity.c(this); entity.c(((Entity) (this)));
} }
} }
} }
if (j != null && j.G) { if (j != null && j.G) {
j = null; j = null;
@ -598,11 +597,11 @@ public class EntityMinecart extends Entity
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
ak[i].a(nbttagcompound1); 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) { if (d == 2) {
f = nbttagcompound.g("PushX"); f = nbttagcompound.g("PushX");
aj = nbttagcompound.g("PushZ"); aj = nbttagcompound.g("PushZ");
e = nbttagcompound.c("Fuel"); e = ((int) (nbttagcompound.c("Fuel")));
} else if (d == 1) { } else if (d == 1) {
NBTTagList nbttaglist = nbttagcompound.k("Items"); NBTTagList nbttaglist = nbttagcompound.k("Items");
@ -624,7 +623,6 @@ public class EntityMinecart extends Entity
ak[k] = new ItemStack(nbttagcompound1); ak[k] = new ItemStack(nbttagcompound1);
} }
} }
} }
} }
@ -638,35 +636,31 @@ public class EntityMinecart extends Entity
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer)l).getServer(); CraftServer server = ((WorldServer)l).getServer();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity));
Type.VEHICLE_COLLISION_ENTITY, minecart,
((WorldServer)l).getWorld().toCraftEntity(entity));
server.getPluginManager().callEvent(collsionEvent); server.getPluginManager().callEvent(collsionEvent);
if (collsionEvent.isCancelled()) { if (collsionEvent.isCancelled()) {
return; return;
} }
// CraftBukkit end
if (!collsionEvent.isPickupCancelled() if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) {
&& (entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) if (!collsionEvent.isPickupCancelled()) {
&& d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) { VehicleEnterEvent enterEvent = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity));
// CraftBukkit start
VehicleEnterEvent enterEvent = new VehicleEnterEvent(
Type.VEHICLE_ENTER, minecart,
((WorldServer)l).getWorld().toCraftEntity(entity));
server.getPluginManager().callEvent(enterEvent); server.getPluginManager().callEvent(enterEvent);
// CraftBukkit end
if (!enterEvent.isCancelled()) { if (!enterEvent.isCancelled()) {
entity.e(this); entity.e(((Entity) (this)));
} }
} }
}
// CraftBukkit end
double d1 = entity.p - p; double d1 = entity.p - p;
double d2 = entity.r - r; double d2 = entity.r - r;
double d3 = d1 * d1 + d2 * d2; 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); d3 = MathHelper.a(d3);
d1 /= d3; d1 /= d3;
d2 /= d3; d2 /= d3;
@ -768,10 +762,7 @@ public class EntityMinecart extends Entity
if (!l.z) { if (!l.z) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) l).getServer(); CraftServer server = ((WorldServer) l).getServer();
VehicleEnterEvent event = new VehicleEnterEvent( VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entityplayer));
Type.VEHICLE_ENTER,
minecart,
((WorldServer)l).getWorld().toCraftEntity(entityplayer));
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -779,18 +770,18 @@ public class EntityMinecart extends Entity
} }
// CraftBukkit end // CraftBukkit end
entityplayer.e(this); entityplayer.e(((Entity) (this)));
} }
} else if (d == 1) { } else if (d == 1) {
if (!l.z) { if (!l.z) {
entityplayer.a((IInventory)this); entityplayer.a(((IInventory) (this)));
} }
} else if (d == 2) { } else if (d == 2) {
ItemStack itemstack = entityplayer.an.e(); ItemStack itemstack = entityplayer.an.e();
if (itemstack != null && itemstack.c == Item.k.aW) { if (itemstack != null && itemstack.c == Item.k.aW) {
if (--itemstack.a == 0) { if (--itemstack.a == 0) {
entityplayer.an.a(entityplayer.an.c, null); entityplayer.an.a(entityplayer.an.c, ((ItemStack) (null)));
} }
e += 1200; e += 1200;
} }
@ -804,8 +795,6 @@ public class EntityMinecart extends Entity
if (G) { if (G) {
return false; return false;
} }
return entityplayer.b(this) <= 64D; return entityplayer.b(((Entity) (this))) <= 64D;
} }
} }

View file

@ -1,11 +1,8 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.*; import java.util.*;
public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public class EntityPlayerMP extends EntityPlayer
implements ICrafting {
public NetServerHandler a; public NetServerHandler a;
public MinecraftServer b; public MinecraftServer b;
@ -26,8 +23,8 @@ public class EntityPlayerMP extends EntityPlayer
public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s1, ItemInWorldManager iteminworldmanager) { public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s1, ItemInWorldManager iteminworldmanager) {
super(world); super(world);
f = new LinkedList(); f = ((List) (new LinkedList()));
aj = new HashSet(); aj = ((Set) (new HashSet()));
al = false; al = false;
bE = 0xfa0a1f01; bE = 0xfa0a1f01;
bF = 60; 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); c((double) i + 0.5D, l, (double) j + 0.5D, 0.0F, 0.0F);
b = minecraftserver; b = minecraftserver;
S = 0.0F; S = 0.0F;
iteminworldmanager.a = this; iteminworldmanager.a = ((EntityPlayer) (this));
aw = s1; aw = s1;
c = iteminworldmanager; c = iteminworldmanager;
H = 0.0F; H = 0.0F;
} }
public void k() { public void k() {
// CraftBukkit: Downcast to make it work. ap.a(((ICrafting) (this)));
ap.a((ICrafting)this);
} }
public int[] E() { public int[] E() {
@ -66,7 +62,7 @@ public class EntityPlayerMP extends EntityPlayer
int j = a(i); int j = a(i);
if (j != bG[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; bG[i] = j;
} }
} }
@ -123,11 +119,11 @@ public class EntityPlayerMP extends EntityPlayer
for (int i = 0; i < f.size(); i++) { for (int i = 0; i < f.size(); i++) {
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) f.get(i); ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) f.get(i);
double d2 = chunkcoordintpair1.a(this); double d2 = chunkcoordintpair1.a(((Entity) (this)));
if (i == 0 || d2 < d1) { if (i == 0 || d2 < d1) {
chunkcoordintpair = chunkcoordintpair1; chunkcoordintpair = chunkcoordintpair1;
d1 = chunkcoordintpair1.a(this); d1 = chunkcoordintpair1.a(((Entity) (this)));
} }
} }
@ -141,18 +137,17 @@ public class EntityPlayerMP extends EntityPlayer
flag = true; flag = true;
} }
if (flag) { if (flag) {
f.remove(chunkcoordintpair); f.remove(((chunkcoordintpair)));
a.b(new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, b.e)); 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); 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++) { for (int j = 0; j < list.size(); j++) {
a((TileEntity) list.get(j)); a((TileEntity) list.get(j));
} }
} }
} }
if (ba != bE) { if (ba != bE) {
a.b(new Packet8(ba)); a.b(((Packet) (new Packet8(ba))));
bE = ba; bE = ba;
} }
} }
@ -176,10 +171,10 @@ public class EntityPlayerMP extends EntityPlayer
public void c(Entity entity, int i) { public void c(Entity entity, int i) {
if (!entity.G) { if (!entity.G) {
if (entity instanceof EntityItem) { 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) { 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); super.c(entity, i);
@ -190,7 +185,7 @@ public class EntityPlayerMP extends EntityPlayer
if (!au) { if (!au) {
av = -1; av = -1;
au = true; 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) { public void e(Entity entity) {
super.e(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); 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) { public void a(int i, int j, int l) {
R(); R();
a.b(new Packet100(bH, 1, "Crafting", 9)); a.b(((Packet) (new Packet100(bH, 1, "Crafting", 9))));
ap = new CraftingInventoryWorkbenchCB(an, this.l, i, j, l); ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, this.l, i, j, l)));
ap.f = bH; ap.f = bH;
// CraftBukkit: Downcast to make it work. ap.a(((ICrafting) (this)));
ap.a((ICrafting)this);
} }
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
R(); R();
a.b(new Packet100(bH, 0, iinventory.b(), iinventory.a())); a.b(((Packet) (new Packet100(bH, 0, iinventory.b(), iinventory.a()))));
ap = new CraftingInventoryChestCB(an, iinventory); ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory)));
ap.f = bH; ap.f = bH;
// CraftBukkit: Downcast to make it work. ap.a(((ICrafting) (this)));
ap.a((ICrafting)this);
} }
public void a(TileEntityFurnace tileentityfurnace) { public void a(TileEntityFurnace tileentityfurnace) {
R(); R();
a.b(new Packet100(bH, 2, tileentityfurnace.b(), tileentityfurnace.a())); a.b(((Packet) (new Packet100(bH, 2, tileentityfurnace.b(), tileentityfurnace.a()))));
ap = new CraftingInventoryFurnaceCB(an, tileentityfurnace); ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace)));
ap.f = bH; 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) { public void a(CraftingInventoryCB craftinginventorycb, int i, ItemStack itemstack) {
@ -252,24 +244,24 @@ public class EntityPlayerMP extends EntityPlayer
if (am) { if (am) {
return; return;
} else { } else {
a.b(new Packet103(craftinginventorycb.f, i, itemstack)); a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack))));
return; return;
} }
} }
public void a(CraftingInventoryCB craftinginventorycb, List list) { public void a(CraftingInventoryCB craftinginventorycb, List list) {
a.b(new Packet104(craftinginventorycb.f, list)); a.b(((Packet) (new Packet104(craftinginventorycb.f, list))));
a.b(new Packet103(-1, -1, an.i())); a.b(((Packet) (new Packet103(-1, -1, an.i()))));
} }
public void a(CraftingInventoryCB craftinginventorycb, int i, int j) { 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 a(ItemStack itemstack) {}
public void I() { public void I() {
a.b(new Packet101(ap.f)); a.b(((Packet) (new Packet101(ap.f))));
K(); K();
} }
@ -277,15 +269,13 @@ public class EntityPlayerMP extends EntityPlayer
if (am) { if (am) {
return; return;
} else { } else {
a.b(new Packet103(-1, -1, an.i())); a.b(((Packet) (new Packet103(-1, -1, an.i()))));
return; return;
} }
} }
public void K() { public void K() {
// CraftBukkit: Downcast to make it work. ap.a(((EntityPlayer) (this)));
ap.a((ICrafting)this);
ap = ao; ap = ao;
} }
} }

View file

@ -1,12 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
// CraftBukkit end
public class EntitySkeleton extends EntityMobs { public class EntitySkeleton extends EntityMobs {
@ -34,14 +35,14 @@ public class EntitySkeleton extends EntityMobs {
float f1 = b(1.0F); float f1 = b(1.0F);
if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { if (f1 > 0.5F && l.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(); CraftServer server = ((WorldServer) l).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this));
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
Z = 300; Z = 300;
} }
//Craftbukkit stop // CraftBukkit end
} }
} }
super.G(); super.G();
@ -53,14 +54,14 @@ public class EntitySkeleton extends EntityMobs {
double d2 = entity.r - r; double d2 = entity.r - r;
if (bg == 0) { if (bg == 0) {
EntityArrow entityarrow = new EntityArrow(l, this); EntityArrow entityarrow = new EntityArrow(l, ((EntityLiving) (this)));
entityarrow.q += 1.3999999761581421D; entityarrow.q += 1.3999999761581421D;
double d3 = entity.q - 0.20000000298023224D - entityarrow.q; double d3 = entity.q - 0.20000000298023224D - entityarrow.q;
float f2 = MathHelper.a(d1 * d1 + d2 * d2) * 0.2F; 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(((Entity) (this)), "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F));
l.a(entityarrow); l.a(((Entity) (entityarrow)));
entityarrow.a(d1, d3 + (double) f2, d2, 0.6F, 12F); entityarrow.a(d1, d3 + (double) f2, d2, 0.6F, 12F);
bg = 30; bg = 30;
} }
@ -85,4 +86,3 @@ public class EntitySkeleton extends EntityMobs {
a = new ItemStack(Item.i, 1); a = new ItemStack(Item.i, 1);
} }
} }

View file

@ -1,13 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
// CraftBukkit end
public class EntityZombie extends EntityMobs { public class EntityZombie extends EntityMobs {
@ -23,14 +23,14 @@ public class EntityZombie extends EntityMobs {
float f1 = b(1.0F); float f1 = b(1.0F);
if (f1 > 0.5F && l.h(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { if (f1 > 0.5F && l.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(); CraftServer server = ((WorldServer) l).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this));
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
Z = 300; Z = 300;
} }
//Craftbukkit stop // CraftBukkit end
} }
} }
super.G(); super.G();
@ -52,4 +52,3 @@ public class EntityZombie extends EntityMobs {
return Item.J.aW; return Item.J.aW;
} }
} }

View file

@ -1,6 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftEntity; import org.bukkit.craftbukkit.CraftEntity;
import org.bukkit.craftbukkit.CraftLivingEntity; import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftPlayer; 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.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedByEntityEvent; import org.bukkit.event.entity.EntityDamagedByEntityEvent;
import org.bukkit.event.entity.EntityDamagedEvent; import org.bukkit.event.entity.EntityDamagedEvent;
// CraftBukkit end
import java.util.*; import java.util.*;
public class Explosion { public class Explosion {
public boolean a; public boolean a;
@ -27,7 +27,7 @@ public class Explosion {
public Explosion(World world, Entity entity, double d1, double d2, double d3, float f1) { public Explosion(World world, Entity entity, double d1, double d2, double d3, float f1) {
a = false; a = false;
h = new Random(); h = new Random();
g = new HashSet(); g = ((Set) (new HashSet()));
i = world; i = world;
e = entity; e = entity;
f = f1; f = f1;
@ -74,7 +74,7 @@ public class Explosion {
f2 -= (Block.m[i3].a(e) + 0.3F) * f3; f2 -= (Block.m[i3].a(e) + 0.3F) * f3;
} }
if (f2 > 0.0F) { if (f2 > 0.0F) {
g.add(new ChunkPosition(j2, k2, l2)); g.add(((new ChunkPosition(j2, k2, l2))));
} }
d5 += d1 * (double) f3; d5 += d1 * (double) f3;
d7 += d2 * (double) f3; d7 += d2 * (double) f3;
@ -82,7 +82,6 @@ public class Explosion {
f2 -= f3 * 0.75F; f2 -= f3 * 0.75F;
} while (true); } while (true);
} }
} }
} }
@ -113,17 +112,16 @@ public class Explosion {
double d13 = i.a(vec3d, entity.z); double d13 = i.a(vec3d, entity.z);
double d14 = (1.0D - d11) * d13; 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); 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; CraftEntity damagee = null;
if(entity instanceof EntityPlayerMP) if (entity instanceof EntityPlayerMP) {
{
damagee = new CraftPlayer(servr, (EntityPlayerMP) entity); damagee = new CraftPlayer(servr, (EntityPlayerMP) entity);
} else if(entity instanceof EntityLiving) } else if(entity instanceof EntityLiving) {
{
damagee = new CraftLivingEntity(servr, (EntityLiving) entity); 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? // Craftbukkit TODO: get the x/y/z of the tnt block?
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(null, damagee, EntityDamagedEvent.DamageCause.BLOCK_EXPLOSION, damage); EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(null, damagee, EntityDamagedEvent.DamageCause.BLOCK_EXPLOSION, damage);
@ -131,19 +129,20 @@ public class Explosion {
if(!edbbe.isCancelled()) entity.a(e, damage); if(!edbbe.isCancelled()) entity.a(e, damage);
} else { } else {
CraftEntity damager = null; CraftEntity damager = null;
if(e instanceof EntityPlayerMP) if (e instanceof EntityPlayerMP) {
{
// not possible in normal operations // not possible in normal operations
damager = new CraftPlayer(servr, (EntityPlayerMP) e); damager = new CraftPlayer(servr, (EntityPlayerMP) e);
} else if(e instanceof EntityLiving) } else if (e instanceof EntityLiving) {
{
damager = new CraftLivingEntity(servr, (EntityLiving) e); damager = new CraftLivingEntity(servr, (EntityLiving) e);
} }
EntityDamagedByEntityEvent edbbe = new EntityDamagedByEntityEvent(damager, damagee, EntityDamagedEvent.DamageCause.ENTITY_EXPLOSION, damage); EntityDamagedByEntityEvent edbbe = new EntityDamagedByEntityEvent(damager, damagee, EntityDamagedEvent.DamageCause.ENTITY_EXPLOSION, damage);
servr.getPluginManager().callEvent(edbbe); 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; double d15 = d14;
@ -156,10 +155,10 @@ public class Explosion {
f = f1; f = f1;
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
arraylist.addAll(g); ((List) (arraylist)).addAll(((java.util.Collection) (g)));
if (a) { if (a) {
for (int j4 = arraylist.size() - 1; j4 >= 0; j4--) { for (int j4 = ((List) (arraylist)).size() - 1; j4 >= 0; j4--) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(j4); ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j4);
int i2 = chunkposition.a; int i2 = chunkposition.a;
int k4 = chunkposition.b; int k4 = chunkposition.b;
int l4 = chunkposition.c; int l4 = chunkposition.c;
@ -170,7 +169,6 @@ public class Explosion {
i.d(i2, k4, l4, Block.ar.bh); 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); 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 arraylist = new ArrayList();
arraylist.addAll(g); ((List) (arraylist)).addAll(((java.util.Collection) (g)));
for (int j = arraylist.size() - 1; j >= 0; j--) { for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(j); ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j);
int k = chunkposition.a; int k = chunkposition.a;
int l = chunkposition.b; int l = chunkposition.b;
int i1 = chunkposition.c; int i1 = chunkposition.c;
@ -217,4 +215,3 @@ public class Explosion {
} }
} }

View file

@ -1,6 +1,5 @@
package net.minecraft.server; package net.minecraft.server;
public interface IInventory { public interface IInventory {
public abstract int a(); public abstract int a();
@ -21,4 +20,3 @@ public interface IInventory {
public abstract ItemStack[] getContents(); // CraftBukkit public abstract ItemStack[] getContents(); // CraftBukkit
} }

View file

@ -1,15 +1,14 @@
package net.minecraft.server; package net.minecraft.server;
public class InventoryCraftResult implements IInventory {
public class InventoryCraftResult
implements IInventory {
private ItemStack a[]; private ItemStack a[];
// CraftBukkit // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
return a; return a;
} }
// CraftBukkit end
public InventoryCraftResult() { public InventoryCraftResult() {
a = new ItemStack[1]; a = new ItemStack[1];

View file

@ -1,17 +1,16 @@
package net.minecraft.server; package net.minecraft.server;
public class InventoryCrafting implements IInventory {
public class InventoryCrafting
implements IInventory {
private ItemStack a[]; private ItemStack a[];
private int b; private int b;
private CraftingInventoryCB c; private CraftingInventoryCB c;
//CraftBukkit // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
return a; return a;
} }
// CraftBukkit end
public InventoryCrafting(CraftingInventoryCB craftinginventorycb, int i, int j) { public InventoryCrafting(CraftingInventoryCB craftinginventorycb, int i, int j) {
b = i * j; b = i * j;
@ -37,7 +36,7 @@ public class InventoryCrafting
ItemStack itemstack = a[i]; ItemStack itemstack = a[i];
a[i] = null; a[i] = null;
c.a(this); c.a(((IInventory) (this)));
return itemstack; return itemstack;
} }
ItemStack itemstack1 = a[i].a(j); ItemStack itemstack1 = a[i].a(j);
@ -45,7 +44,7 @@ public class InventoryCrafting
if (a[i].a == 0) { if (a[i].a == 0) {
a[i] = null; a[i] = null;
} }
c.a(this); c.a(((IInventory) (this)));
return itemstack1; return itemstack1;
} else { } else {
return null; return null;
@ -54,7 +53,7 @@ public class InventoryCrafting
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
a[i] = itemstack; a[i] = itemstack;
c.a(this); c.a(((IInventory) (this)));
} }
public int c() { public int c() {

View file

@ -1,8 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
public class InventoryLargeChest implements IInventory {
public class InventoryLargeChest
implements IInventory {
private String a; private String a;
private IInventory b; private IInventory b;

View file

@ -1,8 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
public class InventoryPlayer implements IInventory {
public class InventoryPlayer
implements IInventory {
public ItemStack a[]; public ItemStack a[];
public ItemStack b[]; public ItemStack b[];
@ -11,7 +9,7 @@ public class InventoryPlayer
private ItemStack f; private ItemStack f;
public boolean d; public boolean d;
// CraftBukket start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
return a; return a;
} }
@ -19,7 +17,7 @@ public class InventoryPlayer
public ItemStack[] getArmorContents() { public ItemStack[] getArmorContents() {
return b; return b;
} }
// CraftBukket end // CraftBukkit end
public InventoryPlayer(EntityPlayer entityplayer) { public InventoryPlayer(EntityPlayer entityplayer) {
a = new ItemStack[36]; a = new ItemStack[36];
@ -183,7 +181,7 @@ public class InventoryPlayer
nbttagcompound.a("Slot", (byte) k); nbttagcompound.a("Slot", (byte) k);
a[k].a(nbttagcompound); a[k].a(nbttagcompound);
nbttaglist.a(nbttagcompound); nbttaglist.a(((NBTBase) (nbttagcompound)));
} }
} }
@ -193,7 +191,7 @@ public class InventoryPlayer
nbttagcompound1.a("Slot", (byte) (l + 100)); nbttagcompound1.a("Slot", (byte) (l + 100));
b[l].a(nbttagcompound1); b[l].a(nbttagcompound1);
nbttaglist.a(nbttagcompound1); nbttaglist.a(((NBTBase) (nbttagcompound1)));
} }
} }
@ -218,7 +216,6 @@ public class InventoryPlayer
b[l - 100] = itemstack; b[l - 100] = itemstack;
} }
} }
} }
public int a() { public int a() {
@ -320,7 +317,6 @@ public class InventoryPlayer
b[l] = null; b[l] = null;
} }
} }
} }
public void d() { public void d() {
@ -340,6 +336,6 @@ public class InventoryPlayer
if (e.G) { if (e.G) {
return false; return false;
} }
return entityplayer.b((Entity)e) <= 64D; // CraftBukkit: downcast to Entity return entityplayer.b(((Entity) (e))) <= 64D;
} }
} }

View file

@ -1,12 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.BlockFace; import org.bukkit.BlockFace;
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockPlacedEvent; import org.bukkit.event.block.BlockPlacedEvent;
// CraftBukkit end
public class ItemBlock extends Item { public class ItemBlock extends Item {
@ -19,15 +20,16 @@ public class ItemBlock extends Item {
} }
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { 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 // Bail if we have nothing of the item in hand
if (itemstack.a == 0) { if (itemstack.a == 0) {
return false; 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); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockFace faceClicked = CraftBlock.notchToBlockFace(l); BlockFace faceClicked = CraftBlock.notchToBlockFace(l);
// CraftBukkit end
if (world.a(i, j, k) == Block.aS.bh) { if (world.a(i, j, k) == Block.aS.bh) {
l = 0; l = 0;
@ -52,7 +54,7 @@ public class ItemBlock extends Item {
} }
} }
// 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 oldMaterial = world.a(i, j, k);
int oldData = world.b(i, j, k); int oldData = world.b(i, j, k);
@ -72,14 +74,14 @@ public class ItemBlock extends Item {
distanceFromSpawn = xFromSpawn; distanceFromSpawn = xFromSpawn;
} }
// Craftbukkit hardcoded Spawn distance for now // CraftBukkit hardcoded Spawn distance for now
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp(); boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();
BlockPlacedEvent bpe = new BlockPlacedEvent(Type.BLOCK_PLACED, placedBlock, blockClicked, itemInHand, thePlayer, canBuild); BlockPlacedEvent bpe = new BlockPlacedEvent(Type.BLOCK_PLACED, placedBlock, blockClicked, itemInHand, thePlayer, canBuild);
((WorldServer) world).getServer().getPluginManager().callEvent(bpe); ((WorldServer) world).getServer().getPluginManager().callEvent(bpe);
if (bpe.isCancelled() || !bpe.canBuild()) { if (bpe.isCancelled() || !bpe.canBuild()) {
// Craftbukkit Undo! // CraftBukkit Undo!
// Specialcase iceblocks, replace with 'glass' first (so it doesn't explode into water) // Specialcase iceblocks, replace with 'glass' first (so it doesn't explode into water)
if (this.a == 79) { if (this.a == 79) {
@ -92,13 +94,13 @@ public class ItemBlock extends Item {
world.g(i, j, k, this.a); world.g(i, j, k, this.a);
Block.m[a].c(world, i, j, k, l); 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); 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--; itemstack.a--;
} }
} }
} }
// CraftBukkit end
return true; return true;
} }
@ -106,4 +108,3 @@ public class ItemBlock extends Item {
return Block.m[a].e(); return Block.m[a].e();
} }
} }

View file

@ -1,11 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemBoat extends Item { public class ItemBoat extends Item {
@ -42,8 +43,7 @@ public class ItemBoat extends Item {
int k = movingobjectposition.d; int k = movingobjectposition.d;
if (!world.z) { if (!world.z) {
// Craftbukkit start // CraftBukkit start - Boat placement
// Boat placement
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
@ -52,12 +52,12 @@ public class ItemBoat extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) return itemstack; if (pie.isCancelled()) return itemstack;
// CraftBukkit end
world.a(new EntityBoat(world, (float) i + 0.5F, (float) j + 1.5F, (float) k + 0.5F)); world.a(((Entity) (new EntityBoat(world, (float) i + 0.5F, (float) j + 1.5F, (float) k + 0.5F))));
} }
itemstack.a--; itemstack.a--;
} }
return itemstack; return itemstack;
} }
} }

View file

@ -1,5 +1,8 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.BlockFace; import org.bukkit.BlockFace;
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
@ -7,7 +10,7 @@ import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemBucket extends Item { public class ItemBucket extends Item {
@ -51,36 +54,38 @@ public class ItemBucket extends Item {
return itemstack; return itemstack;
} }
// Craftbukkit start // CraftBukkit start - Click == placed when handling an empty bucket!
// Craftbukkit Click == placed when handling an empty bucket!
CraftWorld theWorld = ((WorldServer) world).getWorld(); CraftWorld theWorld = ((WorldServer) world).getWorld();
CraftBlock blockClicked = (CraftBlock) theWorld.getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) theWorld.getBlockAt(i, j, k);
BlockFace direction = CraftBlock.notchToBlockFace(movingobjectposition.e); BlockFace direction = CraftBlock.notchToBlockFace(movingobjectposition.e);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
// CraftBukkit end
if (a == 0) { if (a == 0) {
if (world.c(i, j, k) == Material.f && world.b(i, j, k) == 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); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction);
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (!pie.isCancelled()) { if (pie.isCancelled()) {
return itemstack;
}
// CraftBukkit end
world.d(i, j, k, 0); world.d(i, j, k, 0);
return new ItemStack(Item.av); return new ItemStack(Item.av);
} else {
return itemstack;
}
} }
if (world.c(i, j, k) == Material.g && world.b(i, j, k) == 0) { 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); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction);
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (!pie.isCancelled()) { if (pie.isCancelled()) {
world.d(i, j, k, 0);
return new ItemStack(Item.aw);
} else {
return itemstack; return itemstack;
} }
// CraftBukkit end
world.d(i, j, k, 0);
return new ItemStack(Item.aw);
} }
} else { } else {
if (a < 0) { 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); world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
} }
} else { } else {
// Craftbukkit bucket empty. // CraftBukkit start - bucket empty.
PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, direction);
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (!pie.isCancelled()) { if (pie.isCancelled()) {
world.b(i, j, k, a, 0);
} else {
return itemstack; return itemstack;
} }
// CraftBukkit end
world.b(i, j, k, a, 0);
} }
return new ItemStack(Item.au); return new ItemStack(Item.au);
} }
@ -130,4 +135,3 @@ public class ItemBucket extends Item {
return itemstack; return itemstack;
} }
} }

View file

@ -1,12 +1,15 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
// CraftBukkit end
public class ItemFlintAndSteel extends Item { public class ItemFlintAndSteel extends Item {
@ -17,7 +20,7 @@ public class ItemFlintAndSteel extends Item {
} }
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { 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); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
if (l == 0) { if (l == 0) {
@ -41,9 +44,7 @@ public class ItemFlintAndSteel extends Item {
int i1 = world.a(i, j, k); int i1 = world.a(i, j, k);
if (i1 == 0) { if (i1 == 0) {
// Craftbukkit start // CraftBukkit start - Flint and steel
// Flint and steel
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l));
@ -58,13 +59,13 @@ public class ItemFlintAndSteel extends Item {
if (preventLighter || preventFire) { if (preventLighter || preventFire) {
return false; return false;
} else { }
// 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.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
world.d(i, j, k, Block.ar.bh); world.d(i, j, k, Block.ar.bh);
} }
}
itemstack.b(1); itemstack.b(1);
return true; return true;
} }
} }

View file

@ -1,11 +1,14 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemHoe extends Item { public class ItemHoe extends Item {
@ -20,8 +23,7 @@ public class ItemHoe extends Item {
Material material = world.c(i, j + 1, k); Material material = world.c(i, j + 1, k);
if (!material.a() && i1 == Block.u.bh || i1 == Block.v.bh) { if (!material.a() && i1 == Block.u.bh || i1 == Block.v.bh) {
// Craftbukkit start // CraftBukkit start - Hoes
// Hoes
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
@ -30,6 +32,7 @@ public class ItemHoe extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) return false; if (pie.isCancelled()) return false;
// CraftBukkit end
Block block = Block.aA; Block block = Block.aA;
@ -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 entityitem = new EntityItem(world, (float) i + f1, (float) j + f2, (float) k + f3, new ItemStack(Item.Q));
entityitem.c = 10; entityitem.c = 10;
world.a(entityitem); world.a(((Entity) (entityitem)));
} }
} }
return true; return true;
} else { } else {
@ -60,4 +62,3 @@ public class ItemHoe extends Item {
} }
} }
} }

View file

@ -1,6 +1,5 @@
package net.minecraft.server; package net.minecraft.server;
public class ItemInWorldManager { public class ItemInWorldManager {
private World b; private World b;

View file

@ -1,11 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemMinecart extends Item { public class ItemMinecart extends Item {
@ -21,8 +22,7 @@ public class ItemMinecart extends Item {
int i1 = world.a(i, j, k); int i1 = world.a(i, j, k);
if (i1 == Block.aG.bh) { if (i1 == Block.aG.bh) {
// Craftbukkit start // CraftBukkit start - Minecarts
// Minecarts
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
@ -31,9 +31,10 @@ public class ItemMinecart extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) return false; if (pie.isCancelled()) return false;
// CraftBukkit end
if (!world.z) { 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--; itemstack.a--;
return true; return true;
@ -42,4 +43,3 @@ public class ItemMinecart extends Item {
} }
} }
} }

View file

@ -1,11 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemRedstone extends Item { public class ItemRedstone extends Item {
@ -14,7 +15,7 @@ public class ItemRedstone extends Item {
} }
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { 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); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
if (l == 0) { if (l == 0) {
@ -39,8 +40,7 @@ public class ItemRedstone extends Item {
return false; return false;
} }
if (Block.av.a(world, i, j, k)) { if (Block.av.a(world, i, j, k)) {
// Craftbukkit start // CraftBukkit start - Redstone
// Redstone
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l)); PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l));
@ -48,6 +48,7 @@ public class ItemRedstone extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) return false; if (pie.isCancelled()) return false;
// CraftBukkit end
itemstack.a--; itemstack.a--;
world.d(i, j, k, Block.av.bh); world.d(i, j, k, Block.av.bh);
@ -55,4 +56,3 @@ public class ItemRedstone extends Item {
return true; return true;
} }
} }

View file

@ -1,11 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemSeeds extends Item { public class ItemSeeds extends Item {
@ -23,8 +24,7 @@ public class ItemSeeds extends Item {
int i1 = world.a(i, j, k); int i1 = world.a(i, j, k);
if (i1 == Block.aA.bh) { if (i1 == Block.aA.bh) {
// Craftbukkit start // CraftBukkit start - Seeds
// Seeds
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
@ -32,16 +32,16 @@ public class ItemSeeds extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (!pie.isCancelled()) { if (pie.isCancelled()) {
return false;
}
// CraftBukkit end
world.d(i, j + 1, k, a); world.d(i, j + 1, k, a);
itemstack.a--; itemstack.a--;
return true; return true;
} else { } else {
return false; return false;
} }
} else {
return false;
} }
} }
}

View file

@ -1,11 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; import org.bukkit.craftbukkit.CraftItemStack;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
// CraftBukkit end
public class ItemSign extends Item { public class ItemSign extends Item {
@ -23,7 +24,7 @@ public class ItemSign extends Item {
return false; return false;
} }
// Craftbukkit - store the clicked block // CraftBukkit - store the clicked block
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
if (l == 1) { if (l == 1) {
@ -45,7 +46,7 @@ public class ItemSign extends Item {
return false; return false;
} }
// Craftbukkit start // CraftBukkit start
// Signs // Signs
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
@ -54,6 +55,7 @@ public class ItemSign extends Item {
((WorldServer) world).getServer().getPluginManager().callEvent(pie); ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) return false; if (pie.isCancelled()) return false;
// CraftBukkit end
if (l == 1) { if (l == 1) {
world.b(i, j, k, Block.aD.bh, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf); world.b(i, j, k, Block.aD.bh, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf);
@ -69,4 +71,3 @@ public class ItemSign extends Item {
return true; return true;
} }
} }

View file

@ -1,26 +1,28 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start
import java.net.UnknownHostException;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import org.bukkit.craftbukkit.CraftServer; 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 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 NetworkListenThread c;
public PropertyManager d; public PropertyManager d;
public WorldServer e; public WorldServer e;
@ -30,8 +32,8 @@ implements ICommandListener, Runnable {
int h; int h;
public String i; public String i;
public int j; public int j;
private List<IUpdatePlayerListBox> p; private List p;
private List<ServerCommand> q; private List q;
public EntityTracker k; public EntityTracker k;
public boolean l; public boolean l;
public boolean m; public boolean m;
@ -45,8 +47,8 @@ implements ICommandListener, Runnable {
o = true; o = true;
g = false; g = false;
h = 0; h = 0;
p = new ArrayList<IUpdatePlayerListBox>(); p = ((List) (new ArrayList()));
q = Collections.synchronizedList(new ArrayList<ServerCommand>()); q = Collections.synchronizedList(((List) (new ArrayList())));
new ThreadSleepForever(this); new ThreadSleepForever(this);
this.options = options; // CraftBukkit this.options = options; // CraftBukkit
@ -56,8 +58,8 @@ implements ICommandListener, Runnable {
private boolean d() throws UnknownHostException { private boolean d() throws UnknownHostException {
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this); ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
threadcommandreader.setDaemon(true); ((Thread) (threadcommandreader)).setDaemon(true);
threadcommandreader.start(); ((Thread) (threadcommandreader)).start();
ConsoleLogManager.a(); ConsoleLogManager.a();
a.info("Starting minecraft server version Beta 1.1_02"); a.info("Starting minecraft server version Beta 1.1_02");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { 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.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }
a.info("Loading properties"); a.info("Loading properties");
d = new PropertyManager(options); // Craftbukkit d = new PropertyManager(new File("server.properties"));
String s = d.a("server-ip", ""); String s = d.a("server-ip", "");
l = d.a("online-mode", true); 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("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."); a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
} }
f = new ServerConfigurationManager(this); f = new ServerConfigurationManager(this);
k = new EntityTracker(this); k = new EntityTracker(this);
String s1 = d.a("level-name", "world"); String s1 = d.a("level-name", "world");
@ -108,7 +109,7 @@ implements ICommandListener, Runnable {
private void c(String s) { private void c(String s) {
a.info("Preparing start region"); a.info("Preparing start region");
e = new WorldServer(this, new File("."), s, d.a("hellworld", false) ? -1 : 0); 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; e.k = d.a("spawn-monsters", true) ? 1 : 0;
f.a(e); f.a(e);
byte byte0 = 10; byte byte0 = 10;
@ -121,7 +122,6 @@ implements ICommandListener, Runnable {
} }
e.A.d((e.m >> 4) + i1, (e.o >> 4) + j1); e.A.d((e.m >> 4) + i1, (e.o >> 4) + j1);
} }
} }
e(); e();
@ -137,12 +137,12 @@ implements ICommandListener, Runnable {
i = null; i = null;
j = 0; j = 0;
server.loadPlugins(); server.loadPlugins(); // CraftBukkit
} }
private void f() { private void f() {
a.info("Saving chunks"); a.info("Saving chunks");
e.a(true, null); e.a(true, ((IProgressUpdate) (null)));
} }
private void g() { private void g() {
@ -197,7 +197,7 @@ implements ICommandListener, Runnable {
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
a.log(Level.SEVERE, "Unexpected exception", exception); a.log(Level.SEVERE, "Unexpected exception", ((Throwable) (exception)));
while (o) { while (o) {
b(); b();
try { try {
@ -214,28 +214,28 @@ implements ICommandListener, Runnable {
} }
private void h() { 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(); String s = (String) iterator.next();
int k1 = ((Integer) b.get(s)).intValue(); int k1 = ((Integer) b.get(((s)))).intValue();
if (k1 > 0) { if (k1 > 0) {
b.put(s, Integer.valueOf(k1 - 1)); b.put(((s)), ((Integer.valueOf(k1 - 1))));
} else { } else {
arraylist.add(s); ((List) (arraylist)).add(((s)));
} }
} }
for (int i1 = 0; i1 < arraylist.size(); i1++) { for (int i1 = 0; i1 < ((List) (arraylist)).size(); i1++) {
b.remove(arraylist.get(i1)); b.remove(((List) (arraylist)).get(i1));
} }
AxisAlignedBB.a(); AxisAlignedBB.a();
Vec3D.a(); Vec3D.a();
h++; h++;
if (h % 20 == 0) { if (h % 20 == 0) {
f.a(new Packet4UpdateTime(e.e)); f.a(((Packet) (new Packet4UpdateTime(e.e))));
} }
e.f(); e.f();
while (e.d()) { while (e.d()) {
@ -252,12 +252,12 @@ implements ICommandListener, Runnable {
try { try {
b(); b();
} catch (Exception exception) { } 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) { public void a(String s, ICommandListener icommandlistener) {
q.add(new ServerCommand(s, icommandlistener)); q.add(((new ServerCommand(s, icommandlistener))));
} }
public void b() { public void b() {
@ -298,7 +298,7 @@ implements ICommandListener, Runnable {
o = false; o = false;
} else if (s.toLowerCase().startsWith("save-all")) { } else if (s.toLowerCase().startsWith("save-all")) {
a(s1, "Forcing save.."); a(s1, "Forcing save..");
e.a(true, null); e.a(true, ((IProgressUpdate) (null)));
a(s1, "Save complete."); a(s1, "Save complete.");
} else if (s.toLowerCase().startsWith("save-off")) { } else if (s.toLowerCase().startsWith("save-off")) {
a(s1, "Disabling level saving.."); a(s1, "Disabling level saving..");
@ -418,7 +418,7 @@ implements ICommandListener, Runnable {
} else if (s.toLowerCase().startsWith("say ")) { } else if (s.toLowerCase().startsWith("say ")) {
s = s.substring(s.indexOf(" ")).trim(); s = s.substring(s.indexOf(" ")).trim();
a.info((new StringBuilder()).append("[").append(s1).append("] ").append(s).toString()); 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 ")) { } else if (s.toLowerCase().startsWith("tell ")) {
String as2[] = s.split(" "); 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()); 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(); s = (new StringBuilder()).append("\2477").append(s1).append(" whispers ").append(s).toString();
a.info(s); 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."); icommandlistener.b("There's no player by that name online.");
} }
} }
@ -454,20 +454,20 @@ implements ICommandListener, Runnable {
} }
public void a(IUpdatePlayerListBox iupdateplayerlistbox) { public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
p.add(iupdateplayerlistbox); p.add(((iupdateplayerlistbox)));
} }
// Craftbukkit start - replaces main(String args[]) // Craftbukkit start - replaces main(String args[])
public static void main(final OptionSet options) { public static void main(final OptionSet options) {
try { try {
// CraftBukkit - remove gui
MinecraftServer minecraftserver = new MinecraftServer(options); MinecraftServer minecraftserver = new MinecraftServer(options);
(new ThreadServerApplication("Server thread", minecraftserver)).start(); (new ThreadServerApplication("Server thread", minecraftserver)).start();
} catch (Exception exception) { } 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) { public File a(String s) {
return new File(s); return new File(s);
@ -484,5 +484,4 @@ implements ICommandListener, Runnable {
public static boolean a(MinecraftServer minecraftserver) { public static boolean a(MinecraftServer minecraftserver) {
return minecraftserver.o; return minecraftserver.o;
} }
} }

View file

@ -1,10 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.PrintStream;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.BlockDamageLevel;
// CraftBukkit start
import org.bukkit.BlockFace; import org.bukkit.BlockFace;
import org.bukkit.BlockDamageLevel;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftItemStack; 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.PlayerChatEvent;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
// CraftBukkit end
public class NetServerHandler extends NetHandler public class NetServerHandler extends NetHandler implements ICommandListener {
implements ICommandListener {
public static Logger a = Logger.getLogger("Minecraft"); public static Logger a = Logger.getLogger("Minecraft");
public NetworkManager b; public NetworkManager b;
@ -30,19 +32,25 @@ public class NetServerHandler extends NetHandler
private double h; private double h;
private double i; private double i;
private boolean j; private boolean j;
private Map<Integer, Short> k; private Map k;
// CraftBukkit - next 2 lines
// CraftBukkit start - next 2 lines
private final CraftServer server; private final CraftServer server;
private final CraftPlayer player; private final CraftPlayer player;
public CraftPlayer getPlayer() {
return player;
}
// CraftBukkit end
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayerMP entityplayermp) { public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayerMP entityplayermp) {
c = false; c = false;
f = 0; f = 0;
j = true; j = true;
k = new HashMap<Integer, Short>(); k = ((Map) (new HashMap()));
d = minecraftserver; d = minecraftserver;
b = networkmanager; b = networkmanager;
networkmanager.a(this); networkmanager.a(((NetHandler) (this)));
e = entityplayermp; e = entityplayermp;
entityplayermp.a = this; entityplayermp.a = this;
@ -51,23 +59,17 @@ public class NetServerHandler extends NetHandler
player = new CraftPlayer(server, e); player = new CraftPlayer(server, e);
} }
// CraftBukkit start
public CraftPlayer getPlayer() {
return player;
}
// CraftBukkit end
public void a() { public void a() {
b.a(); b.a();
if (f++ % 20 == 0) { if (f++ % 20 == 0) {
b.a(new Packet0KeepAlive()); b.a(((Packet) (new Packet0KeepAlive())));
} }
} }
public void a(String s) { public void a(String s) {
b.a(new Packet255KickDisconnect(s)); b.a(((Packet) (new Packet255KickDisconnect(s))));
b.c(); 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); d.f.c(e);
c = true; c = true;
} }
@ -135,7 +137,7 @@ public class NetServerHandler extends NetHandler
g = e.p; g = e.p;
h = e.q; h = e.q;
i = e.r; i = e.r;
d.e.f(e); d.e.f(((Entity) (e)));
return; return;
} }
double d2 = e.q; double d2 = e.q;
@ -175,7 +177,7 @@ public class NetServerHandler extends NetHandler
double d13 = d6 - e.q; double d13 = d6 - e.q;
double d14 = d8 - e.r; double d14 = d8 - e.r;
float f5 = 0.0625F; 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); e.c(d12, d13, d14);
d12 = d4 - e.p; 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()); 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); 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)) { if (flag && (flag1 || !flag2)) {
a(g, h, i, f3, f4); 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, public void a(double d1, double d2, double d3, float f1, float f2) {
float f2) {
// CraftBukkit start // CraftBukkit start
Location from = player.getLocation(); Location from = player.getLocation();
Location to = new Location(player.getWorld(), d1, d2, d3, f1, f2); Location to = new Location(player.getWorld(), d1, d2, d3, f1, f2);
@ -230,7 +230,7 @@ public class NetServerHandler extends NetHandler
h = d2; h = d2;
i = d3; i = d3;
e.b(d1, d2, d3, f1, f2); 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 // CraftBukkit start
@ -238,7 +238,7 @@ public class NetServerHandler extends NetHandler
private int lastX; private int lastX;
private int lastY; private int lastY;
private int lastZ; private int lastZ;
// Craftbukkit stop // CraftBukkit end
public void a(Packet14BlockDig packet14blockdig) { public void a(Packet14BlockDig packet14blockdig) {
if (packet14blockdig.e == 4) { if (packet14blockdig.e == 4) {
@ -280,7 +280,7 @@ public class NetServerHandler extends NetHandler
i2 = l1; i2 = l1;
} }
// Craftbukkit start // CraftBukkit start
CraftBlock block = (CraftBlock) player.getWorld().getBlockAt(l, i1, j1); CraftBlock block = (CraftBlock) player.getWorld().getBlockAt(l, i1, j1);
int blockID = block.getTypeID(); int blockID = block.getTypeID();
float damage = 0; float damage = 0;
@ -306,7 +306,7 @@ public class NetServerHandler extends NetHandler
} }
} }
} else if (packet14blockdig.e == 2) { } 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) // Otherwise the block is a Bedrock @(0,0,0)
block = (CraftBlock) player.getWorld().getBlockAt(lastX, lastY, lastZ); block = (CraftBlock) player.getWorld().getBlockAt(lastX, lastY, lastZ);
BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player); BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
@ -314,8 +314,10 @@ public class NetServerHandler extends NetHandler
if (!event.isCancelled()) { if (!event.isCancelled()) {
e.c.a(); e.c.a();
} }
// CraftBukkit end
} else if (packet14blockdig.e == 1) { } else if (packet14blockdig.e == 1) {
if (i2 > 16 || flag) { if (i2 > 16 || flag) {
// CraftBukkit start
BlockDamagedEvent event; BlockDamagedEvent event;
// If the amount of damage going to the block plus the current amount // 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. // of damage is greater than 1, the block is going to break.
@ -330,6 +332,7 @@ public class NetServerHandler extends NetHandler
} else { } else {
e.c.d = 0; // Reset the amount of damage if stopping break. e.c.d = 0; // Reset the amount of damage if stopping break.
} }
// CraftBukkit end
} }
} else if (packet14blockdig.e == 3) { } else if (packet14blockdig.e == 3) {
double d6 = e.p - ((double) l + 0.5D); 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; double d9 = d6 * d6 + d7 * d7 + d8 * d8;
if (d9 < 256D) { 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; lastX = l;
lastY = i1; lastY = i1;
lastZ = j1; lastZ = j1;
// Craftbukkit stop // CraftBukkit end
d.e.B = false; 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; CraftBlock lastRightClicked;
int lastMaterial; int lastMaterial;
public void a(Packet15Place packet15place) { public void a(Packet15Place packet15place) {
ItemStack itemstack = e.an.e(); 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; CraftBlock blockClicked = null;
BlockFace blockFace = null; BlockFace blockFace = null;
if (packet15place.d == 255) { 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) { if (packet15place.e != null && packet15place.e.c == lastMaterial) {
blockClicked = lastRightClicked; blockClicked = lastRightClicked;
} else if (lastMaterial == 0) { } else if (lastMaterial == 0) {
@ -370,7 +376,7 @@ public class NetServerHandler extends NetHandler
lastRightClicked = null; lastRightClicked = null;
lastMaterial = 0; lastMaterial = 0;
} else { } 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); blockClicked = (CraftBlock) d.e.getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c);
lastRightClicked = blockClicked; lastRightClicked = blockClicked;
lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.c; lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.c;
@ -382,21 +388,23 @@ public class NetServerHandler extends NetHandler
blockFace = BlockFace.Self; blockFace = BlockFace.Self;
} }
// Craftbukkit if rightclick decremented the item, always send the update packet. // 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 // this is not here for CraftBukkit's own functionality; rather it is to fix
// a notch bug where the item doesn't update correctly. // a notch bug where the item doesn't update correctly.
boolean always = false; boolean always = false;
// CraftBukkit end
if (packet15place.d == 255) { if (packet15place.d == 255) {
if (itemstack == null) { if (itemstack == null) {
return; return;
} }
// CraftBukkit start
CraftItemStack craftItem = new CraftItemStack(itemstack); CraftItemStack craftItem = new CraftItemStack(itemstack);
CraftPlayer player = new CraftPlayer(server, e); CraftPlayer player = new CraftPlayer(server, e);
PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, player, craftItem, blockClicked, blockFace); 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 // Don't call this event if using Buckets / signs
switch (craftItem.getType()) { switch (craftItem.getType()) {
case Sign: case Sign:
@ -410,12 +418,13 @@ public class NetServerHandler extends NetHandler
if (!pie.isCancelled()) { if (!pie.isCancelled()) {
int itemstackAmount = itemstack.a; int itemstackAmount = itemstack.a;
e.c.a(e, d.e, itemstack); e.c.a(((EntityPlayer) (e)), ((World) (d.e)), itemstack);
// Craftbukkit notch decrements the counter by 1 in the above method with food, // 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 // snowballs and so forth, but he does it in a place that doesnt cause the
// inventory update packet to get sent // inventory update packet to get sent
always = (itemstack.a != itemstackAmount); always = (itemstack.a != itemstackAmount);
} }
// CraftBukkit end
} else { } else {
int l = packet15place.a; int l = packet15place.a;
int i1 = packet15place.b; int i1 = packet15place.b;
@ -427,19 +436,16 @@ public class NetServerHandler extends NetHandler
if (l1 > i2) { if (l1 > i2) {
i2 = l1; i2 = l1;
} }
// CraftBukkit start - spawn proection moved to ItemBlock!!!
// Craftbukkit start
CraftItemStack craftItem = new CraftItemStack(itemstack); CraftItemStack craftItem = new CraftItemStack(itemstack);
CraftPlayer player = new CraftPlayer(server, e); CraftPlayer player = new CraftPlayer(server, e);
// boolean canBuild = (i2 > 16) || flag;
BlockRightClickedEvent brce = new BlockRightClickedEvent(Type.BLOCK_RIGHTCLICKED, blockClicked, blockFace, craftItem, player); BlockRightClickedEvent brce = new BlockRightClickedEvent(Type.BLOCK_RIGHTCLICKED, blockClicked, blockFace, craftItem, player);
server.getPluginManager().callEvent(brce); server.getPluginManager().callEvent(brce);
// Craftbukkit WE HAVE MOVED THE SPAWN PROTECTION CHECK DOWN INTO CLASS ItemBlock!!! e.c.a(((EntityPlayer) (e)), ((World) (d.e)), itemstack, l, i1, j1, k1);
e.c.a(e, d.e, itemstack, l, i1, j1, k1); // CraftBukkit end
// These are the response packets back to the client e.a.b(((Packet) (new Packet53BlockChange(l, i1, j1, ((World) (d.e))))));
e.a.b(new Packet53BlockChange(l, i1, j1, d.e));
if (k1 == 0) { if (k1 == 0) {
i1--; i1--;
} }
@ -458,32 +464,33 @@ public class NetServerHandler extends NetHandler
if (k1 == 5) { if (k1 == 5) {
l++; 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) { if (itemstack != null && itemstack.a == 0) {
e.an.a[e.an.c] = null; e.an.a[e.an.c] = null;
} }
e.am = true; e.am = true;
e.an.a[e.an.c] = ItemStack.a(e.an.a[e.an.c]); 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.ap.a();
e.am = false; e.am = false;
if (always || !ItemStack.a(e.an.e(), packet15place.e)) { // CraftBukkit - Boolean flag
b(new Packet103(e.ap.f, slot.c, e.an.e())); 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; d.e.B = false;
} }
public void a(String s, Object aobj[]) { public void a(String s, Object aobj[]) {
a.info((new StringBuilder()).append(e.aw).append(" lost connection: ").append(s).toString()); 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); d.f.c(e);
c = true; c = true;
} }
public void a(Packet packet) { 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"); a("Protocol error, unexpected packet");
} }
@ -504,7 +511,7 @@ public class NetServerHandler extends NetHandler
} }
s = s.trim(); s = s.trim();
for (int l = 0; l < s.length(); l++) { 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"); a("Illegal characters in chat");
return; return;
} }
@ -520,10 +527,10 @@ public class NetServerHandler extends NetHandler
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
// CraftBukkit stop // CraftBukkit end
a.info(s); 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 ")) { if (s.toLowerCase().startsWith("/me ")) {
s = (new StringBuilder()).append("* ").append(e.aw).append(" ").append(s.substring(s.indexOf(" ")).trim()).toString(); s = (new StringBuilder()).append("* ").append(e.aw).append(" ").append(s.substring(s.indexOf(" ")).trim()).toString();
a.info(s); a.info(s);
d.f.a(new Packet3Chat(s)); d.f.a(((Packet) (new Packet3Chat(s))));
} else if (s.toLowerCase().startsWith("/kill")) { } else if (s.toLowerCase().startsWith("/kill")) {
e.a(null, 1000); e.a(((Entity) (null)), 1000);
} else if (s.toLowerCase().startsWith("/tell ")) { } else if (s.toLowerCase().startsWith("/tell ")) {
String as[] = s.split(" "); String as[] = s.split(" ");
@ -553,15 +560,15 @@ public class NetServerHandler extends NetHandler
s = s.substring(s.indexOf(" ")).trim(); s = s.substring(s.indexOf(" ")).trim();
s = (new StringBuilder()).append("\2477").append(e.aw).append(" whispers ").append(s).toString(); 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()); a.info((new StringBuilder()).append(s).append(" to ").append(as[1]).toString());
if (!d.f.a(as[1], new Packet3Chat(s))) { if (!d.f.a(as[1], ((Packet) (new Packet3Chat(s))))) {
b(new Packet3Chat("\247cThere's no player by that name online.")); b(((Packet) (new Packet3Chat("\247cThere's no player by that name online."))));
} }
} }
} else if (d.f.g(e.aw)) { } else if (d.f.g(e.aw)) {
String s1 = s.substring(1); String s1 = s.substring(1);
a.info((new StringBuilder()).append(e.aw).append(" issued server command: ").append(s1).toString()); a.info((new StringBuilder()).append(e.aw).append(" issued server command: ").append(s1).toString());
d.a(s1, this); d.a(s1, ((ICommandListener) (this)));
} else { } else {
String s2 = s.substring(1); String s2 = s.substring(1);
@ -622,35 +629,35 @@ public class NetServerHandler extends NetHandler
} }
public void a(Packet102 packet102) { public void a(Packet102 packet102) {
if (e.ap.f == packet102.a && e.ap.c(e)) { if (e.ap.f == packet102.a && e.ap.c(((EntityPlayer) (e)))) {
ItemStack itemstack = e.ap.a(packet102.b, packet102.c, e); ItemStack itemstack = e.ap.a(packet102.b, packet102.c, ((EntityPlayer) (e)));
if (ItemStack.a(packet102.e, itemstack)) { 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.am = true;
e.ap.a(); e.ap.a();
e.J(); e.J();
e.am = false; e.am = false;
} else { } else {
k.put(Integer.valueOf(e.ap.f), Short.valueOf(packet102.d)); k.put(((Integer.valueOf(e.ap.f))), ((Short.valueOf(packet102.d))));
e.a.b(new Packet106(packet102.a, packet102.d, false)); e.a.b(((Packet) (new Packet106(packet102.a, packet102.d, false))));
e.ap.a(e, false); e.ap.a(((EntityPlayer) (e)), false);
ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); ArrayList arraylist = new ArrayList();
for (int l = 0; l < e.ap.e.size(); l++) { 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) { 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)) { if (short1 != null && packet106.b == short1.shortValue() && e.ap.f == packet106.a && !e.ap.c(((EntityPlayer) (e)))) {
e.ap.a(e, true); e.ap.a(((EntityPlayer) (e)), true);
} }
} }
@ -665,7 +672,7 @@ public class NetServerHandler extends NetHandler
flag = false; flag = false;
} else { } else {
for (int k1 = 0; k1 < packet130.d[l].length(); k1++) { 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; flag = false;
} }
} }

View file

@ -1,12 +1,11 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.*; import java.io.*;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import joptsimple.OptionSet;
import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager { public class PropertyManager {
@ -14,25 +13,25 @@ public class PropertyManager {
private Properties b; private Properties b;
private File c; private File c;
private OptionSet options = null; // Craftbukkit
public PropertyManager(File file) { public PropertyManager(File file) {
b = new Properties(); b = new Properties();
c = file; c = file;
if (file.exists()) { if (file.exists()) {
try { try {
b.load(new FileInputStream(file)); b.load(((java.io.InputStream) (new FileInputStream(file))));
} catch (Exception exception) { } 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(); a();
} }
} else { } 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(); a();
} }
} }
// Craftbukkit start // Craftbukkit start
private OptionSet options = null;
public PropertyManager(final OptionSet options) { public PropertyManager(final OptionSet options) {
this((File)options.valueOf("config")); this((File)options.valueOf("config"));
@ -55,15 +54,15 @@ public class PropertyManager {
public void b() { public void b() {
try { try {
b.store(new FileOutputStream(c), "Minecraft server properties"); b.store(((java.io.OutputStream) (new FileOutputStream(c))), "Minecraft server properties");
} catch (Exception exception) { } 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(); a();
} }
} }
public String a(String s, String s1) { public String a(String s, String s1) {
if (!b.containsKey(s)) { if (!b.containsKey(((s)))) {
b.setProperty(s, getOverride(s, s1)); // Craftbukkit b.setProperty(s, getOverride(s, s1)); // Craftbukkit
b(); b();
} }
@ -87,6 +86,4 @@ public class PropertyManager {
} }
return getOverride(s, flag); // Craftbukkit return getOverride(s, flag); // Craftbukkit
} }
} }

View file

@ -3,38 +3,41 @@ package net.minecraft.server;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.logging.Logger; 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.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
// CraftBukkit end
public class ServerConfigurationManager { public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft"); public static Logger a = Logger.getLogger("Minecraft");
public List<EntityPlayerMP> b; public List b;
private MinecraftServer c; private MinecraftServer c;
private PlayerManager d; private PlayerManager d;
private int e; private int e;
private Set<String> f; private Set f;
private Set<String> g; private Set g;
private Set<String> h; private Set h;
private File i; private File i;
private File j; private File j;
private File k; private File k;
private PlayerNBTManager l; private PlayerNBTManager l;
private CraftServer server; // Craftbukkit
private CraftServer server; // CraftBukkit
public ServerConfigurationManager(MinecraftServer minecraftserver) { public ServerConfigurationManager(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this); // CraftBukkit // CraftBukkit 2 lines!
server = minecraftserver.server; // Craftbukkit minecraftserver.server = new CraftServer(minecraftserver, this);
server = minecraftserver.server;
b = new ArrayList<EntityPlayerMP>(); b = ((List) (new ArrayList()));
f = new HashSet<String>(); f = ((Set) (new HashSet()));
g = new HashSet<String>(); g = ((Set) (new HashSet()));
h = new HashSet<String>(); h = ((Set) (new HashSet()));
c = minecraftserver; c = minecraftserver;
i = minecraftserver.a("banned-players.txt"); i = minecraftserver.a("banned-players.txt");
j = minecraftserver.a("banned-ips.txt"); j = minecraftserver.a("banned-ips.txt");
@ -58,16 +61,16 @@ public class ServerConfigurationManager {
} }
public void a(EntityPlayerMP entityplayermp) { public void a(EntityPlayerMP entityplayermp) {
b.add(entityplayermp); b.add(((entityplayermp)));
l.b(entityplayermp); l.b(entityplayermp);
c.e.A.d((int) entityplayermp.p >> 4, (int) entityplayermp.r >> 4); 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); d.a(entityplayermp);
// Craftbukkit // CraftBukkit
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayermp))); server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayermp)));
} }
@ -77,27 +80,29 @@ public class ServerConfigurationManager {
public void c(EntityPlayerMP entityplayermp) { public void c(EntityPlayerMP entityplayermp) {
l.a(entityplayermp); l.a(entityplayermp);
c.e.d(entityplayermp); c.e.d(((Entity) (entityplayermp)));
b.remove(entityplayermp); b.remove(((entityplayermp)));
d.b(entityplayermp); d.b(entityplayermp);
// Craftbukkit // CraftBukkit
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayermp))); server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayermp)));
} }
public EntityPlayerMP a(NetLoginHandler netloginhandler, String s, String s1) { 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 // 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 // in the event, check with plugins to see if it's ok, and THEN kick
// depending on the outcome. // depending on the outcome.
EntityPlayerMP entity = new EntityPlayerMP(c, ((World) (c.e)), s, new ItemInWorldManager(((World) (c.e))));
EntityPlayerMP entity = new EntityPlayerMP(c, c.e, s, new ItemInWorldManager(c.e));
PlayerLoginEvent event = new PlayerLoginEvent(Type.PLAYER_LOGIN, new CraftPlayer(server, entity)); 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(s2.indexOf("/") + 1);
s2 = s2.substring(0, s2.indexOf(":")); s2 = s2.substring(0, s2.indexOf(":"));
// CraftBukkit start
if (f.contains(s.trim().toLowerCase())) { if (f.contains(s.trim().toLowerCase())) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!"); event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
} else if (g.contains(s2)) { } else if (g.contains(s2)) {
@ -111,7 +116,7 @@ public class ServerConfigurationManager {
netloginhandler.a(event.getKickMessage()); netloginhandler.a(event.getKickMessage());
return null; return null;
} }
// CraftBukkit end
for (int i1 = 0; i1 < b.size(); i1++) { for (int i1 = 0; i1 < b.size(); i1++) {
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1); EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
@ -120,28 +125,29 @@ public class ServerConfigurationManager {
} }
} }
// CraftBukkit
return entity; return entity;
} }
public EntityPlayerMP d(EntityPlayerMP entityplayermp) { public EntityPlayerMP d(EntityPlayerMP entityplayermp) {
c.k.a(entityplayermp); c.k.a(entityplayermp);
c.k.b(entityplayermp); c.k.b(((Entity) (entityplayermp)));
d.b(entityplayermp); d.b(entityplayermp);
b.remove(entityplayermp); b.remove(((entityplayermp)));
c.e.e(entityplayermp); c.e.e(((Entity) (entityplayermp)));
EntityPlayerMP entityplayermp1 = new EntityPlayerMP(c, c.e, entityplayermp.aw, new ItemInWorldManager(c.e)); EntityPlayerMP entityplayermp1 = new EntityPlayerMP(c, ((World) (c.e)), entityplayermp.aw, new ItemInWorldManager(((World) (c.e))));
entityplayermp1.g = entityplayermp.g; entityplayermp1.g = entityplayermp.g;
entityplayermp1.a = entityplayermp.a; entityplayermp1.a = entityplayermp.a;
c.e.A.d((int) entityplayermp1.p >> 4, (int) entityplayermp1.r >> 4); 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); entityplayermp1.a.a(entityplayermp1.p, entityplayermp1.q, entityplayermp1.r, entityplayermp1.v, entityplayermp1.w);
d.a(entityplayermp1); d.a(entityplayermp1);
c.e.a(entityplayermp1); c.e.a(((Entity) (entityplayermp1)));
b.add(entityplayermp1); b.add(((entityplayermp1)));
entityplayermp1.k(); entityplayermp1.k();
return entityplayermp1; return entityplayermp1;
} }
@ -160,7 +166,6 @@ public class ServerConfigurationManager {
entityplayermp.a.b(packet); entityplayermp.a.b(packet);
} }
} }
public String c() { public String c() {
@ -177,127 +182,127 @@ public class ServerConfigurationManager {
} }
public void a(String s) { public void a(String s) {
f.add(s.toLowerCase()); f.add(((s.toLowerCase())));
f(); f();
} }
public void b(String s) { public void b(String s) {
f.remove(s.toLowerCase()); f.remove(((s.toLowerCase())));
f(); f();
} }
private void e() { private void e() {
try { try {
f.clear(); 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;) { for (String s = ""; (s = bufferedreader.readLine()) != null;) {
f.add(s.trim().toLowerCase()); f.add(((s.trim().toLowerCase())));
} }
bufferedreader.close(); bufferedreader.close();
} catch (Exception exception) { } 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() { private void f() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(i, false)); PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(i, false))));
String s; 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(); s = (String) iterator.next();
} }
printwriter.close(); printwriter.close();
} catch (Exception exception) { } 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) { public void c(String s) {
g.add(s.toLowerCase()); g.add(((s.toLowerCase())));
h(); h();
} }
public void d(String s) { public void d(String s) {
g.remove(s.toLowerCase()); g.remove(((s.toLowerCase())));
h(); h();
} }
private void g() { private void g() {
try { try {
g.clear(); 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;) { for (String s = ""; (s = bufferedreader.readLine()) != null;) {
g.add(s.trim().toLowerCase()); g.add(((s.trim().toLowerCase())));
} }
bufferedreader.close(); bufferedreader.close();
} catch (Exception exception) { } 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() { private void h() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(j, false)); PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(j, false))));
String s; 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(); s = (String) iterator.next();
} }
printwriter.close(); printwriter.close();
} catch (Exception exception) { } 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) { public void e(String s) {
h.add(s.toLowerCase()); h.add(((s.toLowerCase())));
j(); j();
} }
public void f(String s) { public void f(String s) {
h.remove(s.toLowerCase()); h.remove(((s.toLowerCase())));
j(); j();
} }
private void i() { private void i() {
try { try {
h.clear(); 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;) { for (String s = ""; (s = bufferedreader.readLine()) != null;) {
h.add(s.trim().toLowerCase()); h.add(((s.trim().toLowerCase())));
} }
bufferedreader.close(); bufferedreader.close();
} catch (Exception exception) { } 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() { private void j() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(k, false)); PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(k, false))));
String s; 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(); s = (String) iterator.next();
} }
printwriter.close(); printwriter.close();
} catch (Exception exception) { } 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) { public boolean g(String s) {
return h.contains(s.trim().toLowerCase()); return h.contains(((s.trim().toLowerCase())));
} }
public EntityPlayerMP h(String s) { public EntityPlayerMP h(String s) {
@ -316,7 +321,7 @@ public class ServerConfigurationManager {
EntityPlayerMP entityplayermp = h(s); EntityPlayerMP entityplayermp = h(s);
if (entityplayermp != null) { 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); entityplayermp.a.b(packet);
} }
} }
} }
public void i(String s) { public void i(String s) {
@ -341,10 +345,9 @@ public class ServerConfigurationManager {
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1); EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
if (g(entityplayermp.aw)) { if (g(entityplayermp.aw)) {
entityplayermp.a.b(packet3chat); entityplayermp.a.b(((Packet) (packet3chat)));
} }
} }
} }
public boolean a(String s, Packet packet) { public boolean a(String s, Packet packet) {
@ -362,9 +365,7 @@ public class ServerConfigurationManager {
for (int i1 = 0; i1 < b.size(); i1++) { for (int i1 = 0; i1 < b.size(); i1++) {
l.a((EntityPlayerMP) b.get(i1)); l.a((EntityPlayerMP) b.get(i1));
} }
} }
public void a(int i1, int j1, int k1, TileEntity tileentity) {} public void a(int i1, int j1, int k1, TileEntity tileentity) {}
} }

View file

@ -1,6 +1,5 @@
package net.minecraft.server; package net.minecraft.server;
public class Slot { public class Slot {
public final int a; // CraftBukkit: private -> public public final int a; // CraftBukkit: private -> public

View file

@ -1,8 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory {
public class TileEntityChest extends TileEntity
implements IInventory {
private ItemStack e[]; private ItemStack e[];
@ -70,7 +68,6 @@ public class TileEntityChest extends TileEntity
e[j] = new ItemStack(nbttagcompound1); e[j] = new ItemStack(nbttagcompound1);
} }
} }
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -83,11 +80,11 @@ public class TileEntityChest extends TileEntity
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
e[i].a(nbttagcompound1); e[i].a(nbttagcompound1);
nbttaglist.a(nbttagcompound1); nbttaglist.a(((NBTBase) (nbttagcompound1)));
} }
} }
nbttagcompound.a("Items", nbttaglist); nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
} }
public int c() { public int c() {

View file

@ -1,8 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
public class TileEntityFurnace extends TileEntity implements IInventory {
public class TileEntityFurnace extends TileEntity
implements IInventory {
private ItemStack h[]; private ItemStack h[];
public int e; public int e;
@ -74,8 +72,8 @@ public class TileEntityFurnace extends TileEntity
} }
} }
e = nbttagcompound.c("BurnTime"); e = ((int) (nbttagcompound.c("BurnTime")));
g = nbttagcompound.c("CookTime"); g = ((int) (nbttagcompound.c("CookTime")));
f = a(h[1]); f = a(h[1]);
} }
@ -91,11 +89,11 @@ public class TileEntityFurnace extends TileEntity
nbttagcompound1.a("Slot", (byte) j); nbttagcompound1.a("Slot", (byte) j);
h[j].a(nbttagcompound1); h[j].a(nbttagcompound1);
nbttaglist.a(nbttagcompound1); nbttaglist.a(((NBTBase) (nbttagcompound1)));
} }
} }
nbttagcompound.a("Items", nbttaglist); nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
} }
public int c() { public int c() {

View file

@ -1,17 +1,16 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.File; import java.io.File;
import java.util.Random; import java.util.*;
import java.util.ArrayList;
import java.util.List;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end
public class WorldServer extends World { public class WorldServer extends World {
@ -20,8 +19,6 @@ public class WorldServer extends World {
public boolean C; public boolean C;
private MinecraftServer D; private MinecraftServer D;
private MCHashTable E; private MCHashTable E;
private final CraftWorld world; // CraftBukkit
private final CraftServer server; // CraftBukkit
public WorldServer(MinecraftServer minecraftserver, File file, String s, int i) { public WorldServer(MinecraftServer minecraftserver, File file, String s, int i) {
super(file, s, (new Random()).nextLong(), WorldProvider.a(i)); super(file, s, (new Random()).nextLong(), WorldProvider.a(i));
@ -32,7 +29,83 @@ public class WorldServer extends World {
server = minecraftserver.server; // CraftBukkit 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 // CraftBukkit start
private final CraftWorld world;
private final CraftServer server;
@Override @Override
public boolean c(int i1, int j1, int k1, int l1) { public boolean c(int i1, int j1, int k1, int l1) {
boolean result = super.c(i1, j1, k1, l1); boolean result = super.c(i1, j1, k1, l1);
@ -60,8 +133,10 @@ public class WorldServer extends World {
public CraftServer getServer() { public CraftServer getServer() {
return server; return server;
} }
// CraftBukkit end
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! // 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 @Override
public void g(int i1, int j1, int k1, int l1) { public void g(int i1, int j1, int k1, int l1) {
k(i1 - 1, j1, k1, l1); k(i1 - 1, j1, k1, l1);
@ -94,22 +169,21 @@ public class WorldServer extends World {
} }
} }
@Override
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED! // 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) { public boolean a(int i1, int j1, int k1, int l1, boolean flag) {
int i2 = a(j1, k1, l1); int i2 = a(j1, k1, l1);
Block block = Block.m[i2]; Block block = Block.m[i2];
Block block1 = Block.m[i1]; Block block1 = Block.m[i1];
AxisAlignedBB axisalignedbb = block1.d(this, j1, k1, l1); AxisAlignedBB axisalignedbb = block1.d(this, j1, k1, l1);
// Craftbukkit - We dont want to allow the user to override the bounding box check
if (flag) { if (flag) {
axisalignedbb = null; axisalignedbb = null;
} }
if (axisalignedbb != null && !a(axisalignedbb)) { if (axisalignedbb != null && !a(axisalignedbb)) {
return false; return false;
} }
// Craftbukkit start - We dont want to allow the user to override the bounding box check
boolean defaultReturn; boolean defaultReturn;
if (block == Block.A || block == Block.B || block == Block.C || block == Block.D || block == Block.ar || block == Block.aS) { if (block == Block.A || block == Block.B || block == Block.C || block == Block.D || block == Block.ar || block == Block.aS) {
@ -127,81 +201,6 @@ public class WorldServer extends World {
} else { } else {
return defaultReturn; return defaultReturn;
} }
} // CraftBukkit end
// 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;
}
}

View file

@ -23,7 +23,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public boolean isOnline() { public boolean isOnline() {
for (EntityPlayerMP player : server.getHandle().b) { for (Object obj: server.getHandle().b) {
EntityPlayerMP player = (EntityPlayerMP) obj;
if (player.aw.equalsIgnoreCase(getName())) { if (player.aw.equalsIgnoreCase(getName())) {
return true; return true;
} }

View file

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import org.bukkit.Entity; import org.bukkit.Entity;
import org.bukkit.Vector;
import org.bukkit.Vehicle; import org.bukkit.Vehicle;
/** /**