minicraft-plus-revived
minicraft-plus-revived copied to clipboard
Fix issues regarding entity movement methods
Main issue fixed:
Entity#move
still returned true
even when not moved as either x or y delta is zero. The boolean result should indicate whether the entity is moved (false
whenever completely not moved), when any non-zero argument is passed. (This issue was found when doing #592)
Furthermore, the line
if (d == 0) return true; // Was not stopped
was kept just because the original method contains the check, but was for when both x and y delta are zero. The code is then checked somehow to be logically incorrect, and the actual logically correct line already exists in #move
as
if (Updater.saving || (xd == 0 && yd == 0)) return true; // Pretend that it kept moving
Minor (potential) issues in FireSpark
(mostly fixed):
-
Entity#x
andEntity#y
used in#moveX
and#moveY
were not taken into account when calculating distance of movement, which may lead to potential increasing gap between "real coordinates" and "virutal coordinates". - Superclass
#move
is not called, which may lead to inconsistent operations between overriding code and original method. - Suppose this made just negligible effect to the current system, this issue is not fixed to simplify the situation. As real movement handled by
#move
depends on integral real coordinates, it would still return as "not moved" when the movement (from virtual double coordinates) made less than a unit/"pixel" of movement (no "movement" in integral floored coordinates), leading to unexpected result. However, at the moment, no obvious impact is found.