From 5e8683d8bf136d7850501300227a0f758f065812 Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Sun, 7 Jul 2024 20:49:36 -0400 Subject: [PATCH] Fix beacon interactions taking priority over item interactions --- .../game/phase/BeaconBreakersActivePhase.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/haykam821/beaconbreakers/game/phase/BeaconBreakersActivePhase.java b/src/main/java/io/github/haykam821/beaconbreakers/game/phase/BeaconBreakersActivePhase.java index fb62f85..9350090 100644 --- a/src/main/java/io/github/haykam821/beaconbreakers/game/phase/BeaconBreakersActivePhase.java +++ b/src/main/java/io/github/haykam821/beaconbreakers/game/phase/BeaconBreakersActivePhase.java @@ -445,16 +445,18 @@ private void afterBlockPlace(BlockPos pos, World world, ServerPlayerEntity playe } private ActionResult onUseBlock(ServerPlayerEntity player, Hand hand, BlockHitResult hitResult) { - BlockPos pos = hitResult.getBlockPos(); - BlockState state = this.world.getBlockState(pos); + if (!player.shouldCancelInteraction() || (player.getMainHandStack().isEmpty() && player.getOffHandStack().isEmpty())) { + BlockPos pos = hitResult.getBlockPos(); + BlockState state = this.world.getBlockState(pos); - if (state.isIn(Main.RESPAWN_BEACONS)) { - for (TeamEntry team : this.teams) { - if (team.getBeacon().isAt(pos)) { - PlayerEntry entry = this.getEntryFromPlayer(player); - player.sendMessage(team.getTattleMessageFor(entry), true); + if (state.isIn(Main.RESPAWN_BEACONS)) { + for (TeamEntry team : this.teams) { + if (team.getBeacon().isAt(pos)) { + PlayerEntry entry = this.getEntryFromPlayer(player); + player.sendMessage(team.getTattleMessageFor(entry), true); - return ActionResult.FAIL; + return ActionResult.FAIL; + } } } }