Paper/src/main/java/net/minecraft/server/BlockWorkbench.java

57 Zeilen
1.6 KiB
Java

2011-01-08 14:33:54 +01:00
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
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;
// CraftBukkit end
2011-01-08 14:33:54 +01:00
public class BlockWorkbench extends Block {
protected BlockWorkbench(int i) {
super(i, Material.c);
2011-01-14 14:31:10 +01:00
bh = 59;
2011-01-08 14:33:54 +01:00
}
public int a(int i) {
if (i == 1) {
2011-01-14 14:31:10 +01:00
return bh - 16;
2011-01-08 14:33:54 +01:00
}
if (i == 0) {
return Block.x.a(0);
}
if (i == 2 || i == 4) {
2011-01-14 14:31:10 +01:00
return bh + 1;
2011-01-08 14:33:54 +01:00
} else {
2011-01-14 14:31:10 +01:00
return bh;
2011-01-08 14:33:54 +01:00
}
}
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
if (world.z) {
return true;
} else {
// CraftBukkit start - Interact Workbench
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_INTERACT;
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
LivingEntity who = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(bie);
if (bie.isCancelled()) {
return true;
}
// CraftBukkit end
2011-01-08 14:33:54 +01:00
entityplayer.a(i, j, k);
return true;
}
}
}