Help fix an annoying procedure loop?

Started by ChainmailPickaxe on Mon, 06/28/2021 - 00:51

Topic category: Help with modding (Java Edition)

Last seen on 17:48, 12. Sep 2021
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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