2011-01-08 14:33:54 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start
|
2011-01-23 13:23:13 +01:00
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
2011-01-15 22:40:18 +01:00
|
|
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
2011-01-23 13:23:13 +01:00
|
|
|
import org.bukkit.entity.LivingEntity;
|
2011-01-08 14:33:54 +01:00
|
|
|
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) {
|
2011-01-29 22:50:29 +01:00
|
|
|
super(i, Material.WOOD);
|
|
|
|
this.textureId = 59;
|
2011-01-08 14:33:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i) {
|
2011-01-29 22:50:29 +01:00
|
|
|
return i == 1 ? this.textureId - 16 : (i == 0 ? Block.WOOD.a(0) : (i != 2 && i != 4 ? this.textureId : this.textureId + 1));
|
2011-01-08 14:33:54 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
|
|
|
if (world.isStatic) {
|
2011-01-08 14:33:54 +01:00
|
|
|
return true;
|
|
|
|
} else {
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start - Interact Workbench
|
2011-01-23 13:23:13 +01:00
|
|
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
|
|
|
CraftServer server = ((WorldServer) world).getServer();
|
|
|
|
Type eventType = Type.BLOCK_INTERACT;
|
|
|
|
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
2011-01-29 22:50:29 +01:00
|
|
|
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
|
|
|
|
|
|
|
|
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
|
|
|
server.getPluginManager().callEvent(event);
|
2011-01-23 13:23:13 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (event.isCancelled()) {
|
2011-01-23 13:23:13 +01:00
|
|
|
return true;
|
|
|
|
}
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit end
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
entityhuman.a(i, j, k);
|
2011-01-08 14:33:54 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|