Commits
coll1234567 authored and md_5 committed 44a4b5649d9
285 285 | return EnumInteractionResult.FAIL; |
286 286 | } else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) { |
287 287 | ITileInventory itileinventory = iblockdata.getMenuProvider(world, blockposition); |
288 288 | + cancelledBlock = !(itileinventory instanceof ITileInventory); |
289 289 | + } |
290 290 | + |
291 291 | + if (entityplayer.getCooldowns().isOnCooldown(itemstack.getItem())) { |
292 292 | + cancelledBlock = true; |
293 293 | + } |
294 294 | + |
295 - | + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand); |
295 + | + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand, movingobjectpositionblock.getLocation()); |
296 296 | + firedInteract = true; |
297 297 | + interactResult = event.useItemInHand() == Event.Result.DENY; |
298 298 | + interactPosition = blockposition.immutable(); |
299 299 | + interactHand = enumhand; |
300 300 | + interactItemStack = itemstack.copy(); |
301 301 | + |
302 302 | + if (event.useInteractedBlock() == Event.Result.DENY) { |
303 303 | + // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. |
304 304 | + if (iblockdata.getBlock() instanceof BlockDoor) { |
305 305 | + boolean bottom = iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER; |