Help fix an annoying procedure loop?

Started by ChainmailPickaxe on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help fix an annoying procedure loop?
Mon, 06/28/2021 - 04:18 (edited)

I am attempting to make a procedure to swing the off hand of the player if the player is holding the same specific weapon in both hands, like when the player swings one weapon, the one in the offhand swings too (merely a visual tweak, the actual benefits of dual wielding the weapon are purely potion effects). Essentially the procedure works like this: In the weapon/tool's menus, I set this procedure to trigger when the weapon is swung. The procedure checks if the player has the same weapon in their offhand, and waits two ticks to then perform a visual off hand swing (making it swing at the same time crashes the game). The issue arises here, as now that the offhand swings, the procedure triggers again, as now the player has effectively swung the weapon again. The procedure then performs an infinite loop, the offhand swinging as if on repeat. Any idea how to fix this?

Edited by ChainmailPickaxe on Mon, 06/28/2021 - 04:18
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
in the item swung procedure,…
Mon, 06/24/2024 - 00:37

in the item swung procedure, surround the entire code block with "if item in main-hand of Event/target entity = Provided Itemstack" statement. procedure will not trigger if the item is in the off hand