Fix things using wall time running too fast. Fixes BUKKIT-4155

When converting things in Minecraft to use wall time instead of ticks I
realized we'd run into integer division rounding issues and could have
updates that end up counting as zero ticks. To compensate for this the
code ensures we always process at least one tick. However, every time we
end up with zero ticks the next time we have an extra tick due to rounding
the other way with the leftovers. This means we are going far too fast and
should not have this at least one tick logic at all.

On top of this some potions rely on the number of ticks they run and not
just the amount of time they last and so potions were put back to running
with ticks entirely.
This commit is contained in:
Travis Watkins
2013-04-27 04:50:37 -05:00
parent 799779e4b1
commit 3bbfb41798
5 changed files with 4 additions and 154 deletions

View File

@@ -121,7 +121,7 @@ public class EntityZombie extends EntityMonster {
int i = this.q();
// CraftBukkit start - Use wall time instead of ticks for villager conversion
int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick);
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
this.lastTick = MinecraftServer.currentTick;
i *= elapsedTicks;
// CraftBukkit end