Summary:
When subscribing to world events in GameTest Framework -> mojang-minecraft, such as:
world.events.itemUseOn
The event fires several times whenever the thing in question happens.
Steps to Reproduce:
1. Create a simple js script (the example I used is screenshotted below) that subscribes to the "itemUseOn" world event.
2. Load into any world seed.
3. Connect the Visual Studio Code debugger.
4. Put a breakpoint inside of the subscribed event handle.
5. In the game, right-click on any block to cause the event to fire.
6. Go back to VS Code and observe that the breakpoint has been hit.
Observed Results:
When F5 is pressed, the breakpoint is hit again immediately (from my testing, up to as many as 11 times).
Expected Results:
When F5 is pressed, the breakpoint should not be hit again until you have right-clicked again in the game.
Screenshots/Videos:
Notes:
This issue was seen on every event subscription I attempted (Item events, Block events, & Entity events).
Attachments
Comments 7
Thank you for your report!
However, this issue is Working as Intended.
The report you have submitted is working as intended: This is working in line with current design. The item is "being used on" each tick (1/20 second) as long as the button (RMB for Mouse and Keyboard) is pressed. Holding a button (using the item) for two seconds will trigger the event 40 times. When used with the active debugger, the breakpoint will be hit after a short delay, which means the game had time to "register" additional triggers and are now "pending" to be resolved with the debugger.
Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.
Full Version History – Snapshot Version History – Feature Requests and Suggestions
Quick Links:
📓 Bug Tracker Guidelines – 📧 Mojang Support – 📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Tested on 1.19.0 and this is still an issue, updated the Affected Versions to reflect this.