Right clicking activates both items in offhand and main hand, but I don't want that

Started by Deadly_Golem on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Right clicking activates both items in offhand and main hand, but I don't want that

I can think of some ways to fix this, but are there any quicker ones that I'm just missing?

My current idea is:
- Create tag that is applied to items that use right click
- During offhand item's right click procedures detect if item is in main hand
- Is the item in main hand listed in Right Click Item Tag? 
- If yes, do nothing. If no, do offhand's right click activity.

Main issue with this is that it wont be compatible with other mods, and I'm pretty sure they will either still activate if you place a block... that, or I have to add every block to the tag. I don't want to do that.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You may want to try just…
Thu, 10/12/2023 - 21:46

You may want to try just ignoring the item's built in right click procedure, and making a procedure with a global 'player right clicks' trigger, that checks if the item in their main hand is your custom item. This is how I generally deal with this issue. Checking if the item is in the player's man hand will sort of work, unless the player is dual wielding the item.