diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockButton.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockButton.java | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 9ed938e9..3a36bb9d 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -28,11 +28,11 @@ public class BlockButton extends Block { return false; } - public boolean a(World world, int i, int j, int k) { + public boolean canPlace(World world, int i, int j, int k) { return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : world.d(i, j, k + 1))); } - public void d(World world, int i, int j, int k, int l) { + public void postPlace(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); int j1 = i1 & 8; @@ -49,14 +49,14 @@ public class BlockButton extends Block { i1 = this.g(world, i, j, k); } - world.c(i, j, k, i1 + j1); + world.setData(i, j, k, i1 + j1); } private int g(World world, int i, int j, int k) { return world.d(i - 1, j, k) ? 1 : (world.d(i + 1, j, k) ? 2 : (world.d(i, j, k - 1) ? 3 : (world.d(i, j, k + 1) ? 4 : 1))); } - public void a(World world, int i, int j, int k, int l) { + public void doPhysics(World world, int i, int j, int k, int l) { if (this.h(world, i, j, k)) { int i1 = world.getData(i, j, k) & 7; boolean flag = false; @@ -79,15 +79,15 @@ public class BlockButton extends Block { if (flag) { this.a_(world, i, j, k, world.getData(i, j, k)); - world.e(i, j, k, 0); + world.setTypeId(i, j, k, 0); } } } private boolean h(World world, int i, int j, int k) { - if (!this.a(world, i, j, k)) { + if (!this.canPlace(world, i, j, k)) { this.a_(world, i, j, k, world.getData(i, j, k)); - world.e(i, j, k, 0); + world.setTypeId(i, j, k, 0); return false; } else { return true; @@ -119,10 +119,10 @@ public class BlockButton extends Block { } public void b(World world, int i, int j, int k, EntityHuman entityhuman) { - this.a(world, i, j, k, entityhuman); + this.interact(world, i, j, k, entityhuman); } - public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) { + public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) { int l = world.getData(i, j, k); int i1 = l & 7; int j1 = 8 - (l & 8); @@ -144,20 +144,20 @@ public class BlockButton extends Block { } // CraftBukkit end - world.c(i, j, k, i1 + j1); + world.setData(i, j, k, i1 + j1); world.b(i, j, k, i, j, k); - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); - world.h(i, j, k, this.id); + world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); + world.applyPhysics(i, j, k, this.id); if (i1 == 1) { - world.h(i - 1, j, k, this.id); + world.applyPhysics(i - 1, j, k, this.id); } else if (i1 == 2) { - world.h(i + 1, j, k, this.id); + world.applyPhysics(i + 1, j, k, this.id); } else if (i1 == 3) { - world.h(i, j, k - 1, this.id); + world.applyPhysics(i, j, k - 1, this.id); } else if (i1 == 4) { - world.h(i, j, k + 1, this.id); + world.applyPhysics(i, j, k + 1, this.id); } else { - world.h(i, j - 1, k, this.id); + world.applyPhysics(i, j - 1, k, this.id); } world.c(i, j, k, this.id, this.b()); @@ -165,27 +165,27 @@ public class BlockButton extends Block { } } - public void b(World world, int i, int j, int k) { + public void remove(World world, int i, int j, int k) { int l = world.getData(i, j, k); if ((l & 8) > 0) { - world.h(i, j, k, this.id); + world.applyPhysics(i, j, k, this.id); int i1 = l & 7; if (i1 == 1) { - world.h(i - 1, j, k, this.id); + world.applyPhysics(i - 1, j, k, this.id); } else if (i1 == 2) { - world.h(i + 1, j, k, this.id); + world.applyPhysics(i + 1, j, k, this.id); } else if (i1 == 3) { - world.h(i, j, k - 1, this.id); + world.applyPhysics(i, j, k - 1, this.id); } else if (i1 == 4) { - world.h(i, j, k + 1, this.id); + world.applyPhysics(i, j, k + 1, this.id); } else { - world.h(i, j - 1, k, this.id); + world.applyPhysics(i, j - 1, k, this.id); } } - super.b(world, i, j, k); + super.remove(world, i, j, k); } public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) { @@ -204,7 +204,7 @@ public class BlockButton extends Block { } } - public boolean c() { + public boolean isPowerSource() { return true; } @@ -217,28 +217,30 @@ public class BlockButton extends Block { CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftServer server = ((WorldServer) world).getServer(); CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0); server.getPluginManager().callEvent(eventRedstone); + if (eventRedstone.getNewCurrent() > 0) return; // CraftBukkit end - world.c(i, j, k, l & 7); - world.h(i, j, k, this.id); + world.setData(i, j, k, l & 7); + world.applyPhysics(i, j, k, this.id); int i1 = l & 7; if (i1 == 1) { - world.h(i - 1, j, k, this.id); + world.applyPhysics(i - 1, j, k, this.id); } else if (i1 == 2) { - world.h(i + 1, j, k, this.id); + world.applyPhysics(i + 1, j, k, this.id); } else if (i1 == 3) { - world.h(i, j, k - 1, this.id); + world.applyPhysics(i, j, k - 1, this.id); } else if (i1 == 4) { - world.h(i, j, k + 1, this.id); + world.applyPhysics(i, j, k + 1, this.id); } else { - world.h(i, j - 1, k, this.id); + world.applyPhysics(i, j - 1, k, this.id); } - world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); + world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); world.b(i, j, k, i, j, k); } } |