WingedSeal / jmc

A compiler for JMC (JavaScript-like Minecraft Function), a mcfunction extension language for making Minecraft Datapack
https://jmc.wingedseal.com
MIT License
64 stars 7 forks source link

Adding multiple timers to a single target causes problems #85

Open w00tyd00d opened 5 months ago

w00tyd00d commented 5 months ago

Describe the bug

The Timer.add() allows the user to add multiple timers to a single entity, which causes buggy and unintended behavior.

image

In __load__.mcfunction:

image

In __private__/timer_add/main.mcfunction:

image

To Reproduce

  1. Use Timer.add() to add a timer to the same target twice

Expected behavior

Should probably throw an exception, telling the user the timer already existed prior and should use Timer.set() instead.

Desktop

Additional context

Timer.add() also adds an additional scoreboard to the datapack, even when the scoreboard has already been created. This only occurs in the first instance of using the scoreboard within a Timer.add() call, so it seems Timer properly caches previously scoreboard its created but doesn't recognize scoreboards created by other means.