summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemBlock.java
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2013-01-27 10:44:32 -0600
committerfeildmaster <admin@feildmaster.com>2013-01-27 10:44:32 -0600
commit899b9c17cc469851cbc42c5a326869e97b492de4 (patch)
tree1192ebe54aa2e95be9823254bb7cda06bdf634d9 /src/main/java/net/minecraft/server/ItemBlock.java
parent528bbbdcd896e67067bcf53b95cadb9dc0081ebf (diff)
downloadcraftbukkit-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/ItemBlock.java')
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index e6d54bb1..b335b151 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -15,6 +15,7 @@ public class ItemBlock extends Item {
}
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;
int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SNOW.id) {
@@ -68,7 +69,7 @@ public class ItemBlock extends Item {
--itemstack.count;
}
*/
- return processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, k1);
+ return processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, k1, clickedX, clickedY, clickedZ);
// CraftBukkit end
} else {
return false;
@@ -76,14 +77,14 @@ public class ItemBlock extends Item {
}
// CraftBukkit start - add method to process block placement
- static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data) {
+ static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
world.suppressPhysics = true;
world.callingPlaceEvent = true;
world.setRawTypeIdAndData(x, y, z, id, data);
- org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, x, y, z);
+ org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, clickedX, clickedY, clickedZ);
if (event.isCancelled() || !event.canBuild()) {
blockstate.update(true);
world.suppressPhysics = false;