2011-01-08 14:33:54 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start
|
2011-01-08 14:33:54 +01:00
|
|
|
import org.bukkit.craftbukkit.CraftBlock;
|
|
|
|
import org.bukkit.craftbukkit.CraftPlayer;
|
|
|
|
import org.bukkit.event.Event.Type;
|
|
|
|
import org.bukkit.event.block.BlockInteractEvent;
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit end
|
2011-01-08 14:33:54 +01:00
|
|
|
|
|
|
|
public class BlockWorkbench extends Block {
|
|
|
|
|
|
|
|
protected BlockWorkbench(int i) {
|
|
|
|
super(i, Material.c);
|
|
|
|
bg = 59;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i) {
|
|
|
|
if (i == 1) {
|
|
|
|
return bg - 16;
|
|
|
|
}
|
|
|
|
if (i == 0) {
|
|
|
|
return Block.x.a(0);
|
|
|
|
}
|
|
|
|
if (i == 2 || i == 4) {
|
|
|
|
return bg + 1;
|
|
|
|
} else {
|
|
|
|
return bg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
|
|
|
if (world.z) {
|
|
|
|
return true;
|
|
|
|
} else {
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start - Interact Workbench
|
2011-01-08 14:33:54 +01:00
|
|
|
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
|
|
|
CraftPlayer player = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
|
|
|
|
BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, player);
|
2011-01-11 09:25:13 +01:00
|
|
|
|
2011-01-08 14:33:54 +01:00
|
|
|
((WorldServer) world).getServer().getPluginManager().callEvent(bie);
|
2011-01-11 09:25:13 +01:00
|
|
|
|
2011-01-08 14:33:54 +01:00
|
|
|
if (bie.isCancelled()) return true;
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit end
|
|
|
|
|
2011-01-08 14:33:54 +01:00
|
|
|
entityplayer.a(i, j, k);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|