From a285a7b211b2601717f56a5ae97ed38bd9cbef03 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Wed, 8 Jun 2011 17:52:10 -0400 Subject: [PATCH] Added more control over block placement on interactable objects. Thanks Acru! Plugins can now allow placing a block on an interactable object, by DENYing the interact and ALLOWing the place. --- .../java/net/minecraft/server/ItemInWorldManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 2eeb9b8ec9..be652eb419 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -213,11 +213,13 @@ public class ItemInWorldManager { boolean bottom = (world.getData(i, j, k) & 8) == 0; ((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)); } + result = (event.useItemInHand() != Event.Result.ALLOW); } else { result = Block.byId[i1].interact(world, i, j, k, entityhuman); - if (itemstack != null && !result) { - result = itemstack.placeItem(entityhuman, world, i, j, k, l); - } + } + + if (itemstack != null && !result) { + result = itemstack.placeItem(entityhuman, world, i, j, k, l); } // If we have 'true' and no explicit deny *or* an explicit allow -- run the item part of the hook