diff options
author | feildmaster <admin@feildmaster.com> | 2013-01-27 10:44:32 -0600 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2013-01-27 10:44:32 -0600 |
commit | 899b9c17cc469851cbc42c5a326869e97b492de4 (patch) | |
tree | 1192ebe54aa2e95be9823254bb7cda06bdf634d9 /src/main/java/net/minecraft/server/ItemStep.java | |
parent | 528bbbdcd896e67067bcf53b95cadb9dc0081ebf (diff) | |
download | craftbukkit-899b9c17cc469851cbc42c5a326869e97b492de4.tar craftbukkit-899b9c17cc469851cbc42c5a326869e97b492de4.tar.gz craftbukkit-899b9c17cc469851cbc42c5a326869e97b492de4.tar.lz craftbukkit-899b9c17cc469851cbc42c5a326869e97b492de4.tar.xz craftbukkit-899b9c17cc469851cbc42c5a326869e97b492de4.zip |
Direct all BlockPlaceEvents to a singular location. Fixes BUKKIT-3438
By having a single function to process BlockPlacement logic, we make
it so that there is consistent behavior throughout all BlockPlace
events. This should allow for easier troubleshooting and less diffs
in source.
This also fixes BUKKIT-3463 by including the correct coordinates that
were clicked to the event.
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemStep.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemStep.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java index 7ef9a813..6c51282f 100644 --- a/src/main/java/net/minecraft/server/ItemStep.java +++ b/src/main/java/net/minecraft/server/ItemStep.java @@ -24,6 +24,7 @@ public class ItemStep extends ItemBlock { } public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) { + final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit if (this.a) { return super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2); } else if (itemstack.count == 0) { @@ -37,17 +38,12 @@ public class ItemStep extends ItemBlock { boolean flag = (j1 & 8) != 0; if ((l == 1 && !flag || l == 0 && flag) && i1 == this.b.id && k1 == itemstack.getData()) { - // CraftBukkit start - handle in processBlockPlace() - /* - if (world.b(this.c.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1)) { - world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F); + // CraftBukkit start - world.setTypeIdAndData -> processBlockPlace() + if (world.b(this.c.e(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) { + // world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F); + // CraftBukkit end --itemstack.count; } - */ - if (world.b(this.c.e(world, i, j, k))) { - processBlockPlace(world, entityhuman, itemstack, i, j, k, this.c.id, k1); - } - // CraftBukkit end return true; } else { return this.a(itemstack, entityhuman, world, i, j, k, l) ? true : super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2); @@ -56,6 +52,7 @@ public class ItemStep extends ItemBlock { } private boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { + final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit if (l == 0) { --j; } @@ -85,17 +82,12 @@ public class ItemStep extends ItemBlock { int k1 = j1 & 7; if (i1 == this.b.id && k1 == itemstack.getData()) { - // CraftBukkit start - handle in processBlockPlace() - /* - if (world.b(this.c.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1)) { - world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F); + // CraftBukkit start - world.setTypeIdAndData -> processBlockPlace() + if (world.b(this.c.e(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) { + // world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F, this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F); + // CraftBukkit end --itemstack.count; } - */ - if (world.b(this.c.e(world, i, j, k))) { - processBlockPlace(world, entityhuman, itemstack, i, j, k, this.c.id, k1); - } - // CraftBukkit end return true; } else { return false; |