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

50 Zeilen
1.4 KiB
Java

2011-01-08 14:33:54 +01:00
package net.minecraft.server;
// CraftBukkit start
2011-01-08 14:33:54 +01:00
import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
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
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-08 14:33:54 +01:00
((WorldServer) world).getServer().getPluginManager().callEvent(bie);
2011-01-08 14:33:54 +01:00
if (bie.isCancelled()) return true;
// CraftBukkit end
2011-01-08 14:33:54 +01:00
entityplayer.a(i, j, k);
return true;
}
}
}