mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-16 20:53:54 -07:00
Minor logic change and small cleanups
This commit is contained in:
@@ -195,16 +195,17 @@ public class ItemInWorldManager {
|
||||
boolean result = false;
|
||||
if (i1 > 0) {
|
||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
|
||||
if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
if (i1 == Block.WOODEN_DOOR.id) {
|
||||
boolean bottom = (world.getData(i, j, k) & 8) == 0;
|
||||
((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)));
|
||||
((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)));
|
||||
}
|
||||
} else {
|
||||
result = Block.byId[i1].a(world, i, j, k, entityhuman);
|
||||
}
|
||||
if (itemstack != null && event.useItemInHand() != Event.Result.DENY && (!result || event.useItemInHand() == Event.Result.ALLOW)) {
|
||||
// If we have 'true' and no explicit deny *or* an explicit allow -- run the item part of the hook
|
||||
if (itemstack != null && ((!result && event.useItemInHand() != Event.Result.DENY) || event.useItemInHand() == Event.Result.ALLOW)) {
|
||||
result = itemstack.a(entityhuman, world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user