Skip to content

Commit

Permalink
Fix double event firing with offhand
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Nov 2, 2024
1 parent e96a388 commit 7bb3acf
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7bb3acf

Please sign in to comment.