diff options
author | Tahg <tahgtahv@gmail.com> | 2011-03-07 13:52:25 -0500 |
---|---|---|
committer | Tahg <tahgtahv@gmail.com> | 2011-03-10 13:06:59 -0500 |
commit | 9428907e624aefaaaafa1e2d8704553f18d4c1e8 (patch) | |
tree | 803535e47f31e9230282cb3bc445c7aa80464fe3 /src/main/java/net/minecraft/server/BlockPumpkin.java | |
parent | 39acc5817ef7433062172c541964c814cfdb76f2 (diff) | |
download | craftbukkit-9428907e624aefaaaafa1e2d8704553f18d4c1e8.tar craftbukkit-9428907e624aefaaaafa1e2d8704553f18d4c1e8.tar.gz craftbukkit-9428907e624aefaaaafa1e2d8704553f18d4c1e8.tar.lz craftbukkit-9428907e624aefaaaafa1e2d8704553f18d4c1e8.tar.xz craftbukkit-9428907e624aefaaaafa1e2d8704553f18d4c1e8.zip |
Add redstone events to common blocks
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPumpkin.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPumpkin.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java new file mode 100644 index 00000000..937a03ba --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -0,0 +1,66 @@ +package net.minecraft.server; + +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.event.block.BlockRedstoneEvent; + +public class BlockPumpkin extends Block { + + private boolean a; + + protected BlockPumpkin(int i, int j, boolean flag) { + super(i, Material.PUMPKIN); + this.textureId = j; + this.a(true); + this.a = flag; + } + + public int a(int i, int j) { + if (i == 1) { + return this.textureId; + } else if (i == 0) { + return this.textureId; + } else { + int k = this.textureId + 1 + 16; + + if (this.a) { + ++k; + } + + return j == 0 && i == 2 ? k : (j == 1 && i == 5 ? k : (j == 2 && i == 3 ? k : (j == 3 && i == 4 ? k : this.textureId + 16))); + } + } + + public int a(int i) { + return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16)); + } + + public void e(World world, int i, int j, int k) { + super.e(world, i, j, k); + } + + public boolean a(World world, int i, int j, int k) { + int l = world.getTypeId(i, j, k); + + return (l == 0 || Block.byId[l].material.isLiquid()) && world.d(i, j - 1, k); + } + + public void a(World world, int i, int j, int k, EntityLiving entityliving) { + int l = MathHelper.b((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3; + + world.c(i, j, k, l); + } + + //Craftbukkit start + public void a(World world, int i, int j, int k, int l) { + if(net.minecraft.server.Block.byId[l].c()) { + CraftWorld craftWorld = ((WorldServer) world).getWorld(); + CraftServer server = ((WorldServer) world).getServer(); + org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k); + int power = block.getBlockPower(); + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); + server.getPluginManager().callEvent(eventRedstone); + } + } + //Craftbukkit end +} |