From 7bb3acfd35a889d48a51d6f01e45218569c97a68 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sat, 2 Nov 2024 11:57:55 -0400 Subject: [PATCH] Fix double event firing with offhand --- .../ithundxr/createnumismatics/events/CommonEvents.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/events/CommonEvents.java b/common/src/main/java/dev/ithundxr/createnumismatics/events/CommonEvents.java index f203be9e..7cd633ea 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/events/CommonEvents.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/events/CommonEvents.java @@ -69,8 +69,11 @@ public static InteractionResult onUseBlock(Player player, Level level, Interacti BlockPos pos = hitResult.getBlockPos(); BlockState state = level.getBlockState(pos); - if (!level.isClientSide() && !player.getOffhandItem().isEmpty() && !(player.getOffhandItem().getItem() instanceof BlockItem) && - hand.equals(InteractionHand.MAIN_HAND) && state.getBlock() instanceof VendorBlock vb) { + boolean offhandFix = !level.isClientSide() + && !player.getOffhandItem().isEmpty() + && !(player.getOffhandItem().getItem() instanceof BlockItem) && + hand.equals(InteractionHand.MAIN_HAND); + if ((offhandFix || player.isShiftKeyDown()) && state.getBlock() instanceof VendorBlock vb) { return vb.use(state, level, pos, player, hand, hitResult); }