diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-10-24 22:53:23 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-27 22:19:03 -0400 |
commit | 60819c6693daf19dde68b04af38a4fee8c7da988 (patch) | |
tree | e7bd96a07f0e9d9f1f6b2721ddd1bb5dd71eaf48 /src/main/java/net/minecraft/server/BlockCommand.java | |
parent | b9a72531b6e2ccc84bd021bca421255a957d96f7 (diff) | |
download | craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.gz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.lz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.xz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.zip |
Update CraftBukkit to Minecraft 1.4(.2).
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockCommand.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockCommand.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java new file mode 100644 index 00000000..c43ba944 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockCommand.java @@ -0,0 +1,53 @@ +package net.minecraft.server; + +import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit + +public class BlockCommand extends BlockContainer { + + public BlockCommand(int i) { + super(i, 184, Material.ORE); + } + + public TileEntity a(World world) { + return new TileEntityCommand(); + } + + public void doPhysics(World world, int i, int j, int k, int l) { + if (!world.isStatic) { + boolean flag = world.isBlockIndirectlyPowered(i, j, k); + int i1 = world.getData(i, j, k); + boolean flag1 = (i1 & 1) != 0; + + // CraftBukkit start + org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); + int old = flag1 ? 1 : 0; + int current = flag ? 1 : 0; + + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); + world.getServer().getPluginManager().callEvent(eventRedstone); + // CraftBukkit end + + if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit + TileEntity tileentity = world.getTileEntity(i, j, k); + + if (tileentity != null && tileentity instanceof TileEntityCommand) { + ((TileEntityCommand) tileentity).a(world); + } + + world.setRawData(i, j, k, i1 | 1); + } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit + world.setRawData(i, j, k, i1 & -2); + } + } + } + + public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { + TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k); + + if (tileentitycommand != null) { + entityhuman.a((TileEntity) tileentitycommand); + } + + return true; + } +} |