diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-04-11 18:28:15 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-04-13 00:31:08 -0500 |
commit | 1c18834b7d25fdd79ff8481da94437b4073400e0 (patch) | |
tree | 685152d10566294a805e6e165c048ad3922861f5 /src/main/java/net/minecraft/server/TileEntityBrewingStand.java | |
parent | 94f43d8c361295fabea3f3375f488336b66b57c2 (diff) | |
download | craftbukkit-1c18834b7d25fdd79ff8481da94437b4073400e0.tar craftbukkit-1c18834b7d25fdd79ff8481da94437b4073400e0.tar.gz craftbukkit-1c18834b7d25fdd79ff8481da94437b4073400e0.tar.lz craftbukkit-1c18834b7d25fdd79ff8481da94437b4073400e0.tar.xz craftbukkit-1c18834b7d25fdd79ff8481da94437b4073400e0.zip |
Use wall time instead of ticks for several things. Fixes BUKKIT-4059
Currently furnace smelting and the item pickup delay timer use wall time
(aka actual time passed) to emulate a constant tick rate so run at the
same speed regardless of the server's actual tick rate. There are several
other places this makes sense so this commit converts them.
The item despawn timer is converted so now always takes 5 minutes. Users
know this 5 minute number well so keeping this constant helps to avoid
confusion. This also helps alleviate lag because if a large number of item
drops is the reason your server is running slowly having them stay around
longer just means your server is slow longer.
Potion brewing and the zombie villager conversion timer are now constant.
These match the furnace criteria of being useful for hiding lag and not
having a detrimental effect on gameplay.
Potion effects are now also using wall time. The client is told about effect
times in ticks and displays this information to the user as minutes and
seconds assuming a solid 20 ticks per second. The server does have
code for updating the client with the current time remaining to help
avoid skew due to differing tick rates but making this a constant makes
sense due to this display.
Diffstat (limited to 'src/main/java/net/minecraft/server/TileEntityBrewingStand.java')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntityBrewingStand.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java index be1145f7..e362c26d 100644 --- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java +++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java @@ -17,6 +17,7 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor private int e; private int f; private String g; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit public TileEntityBrewingStand() {} @@ -62,9 +63,14 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor } public void h() { + // CraftBukkit start - Use wall time instead of ticks for brewing + int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick); + this.lastTick = MinecraftServer.currentTick; + if (this.brewTime > 0) { - --this.brewTime; - if (this.brewTime == 0) { + this.brewTime -= elapsedTicks; + if (this.brewTime <= 0) { // == -> <= + // CraftBukkit end this.u(); this.update(); } else if (!this.l()) { |