Skip to content

Commit

Permalink
Fix beacon interactions taking priority over item interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
haykam821 committed Jul 8, 2024
1 parent b15f2a7 commit 5e8683d
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down

0 comments on commit 5e8683d

Please sign in to comment.