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.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit
|
||||
|
||||
public class ItemBed extends Item {
|
||||
|
||||
public ItemBed(int i) {
|
||||
@@ -10,6 +8,7 @@ public class ItemBed 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; // CraftBukkit
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else if (l != 1) {
|
||||
@@ -40,8 +39,8 @@ public class ItemBed extends Item {
|
||||
if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i + b0, j, k + b1, l, itemstack)) {
|
||||
if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.v(i, j - 1, k) && world.v(i + b0, j - 1, k + b1)) {
|
||||
// CraftBukkit start
|
||||
//world.setTypeIdAndData(i, j, k, blockbed.id, i1);
|
||||
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed.id, i1)) {
|
||||
// world.setTypeIdAndData(i, j, k, blockbed.id, i1);
|
||||
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed.id, i1, clickedX, clickedY, clickedZ)) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user