diff options
7 files changed, 37 insertions, 17 deletions
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index ee775bf7..a28d233d 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -10,7 +10,7 @@ public class EntityItem extends Entity { public int pickupDelay; private int d; public float c; - private int lastTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit + private int lastTick = MinecraftServer.currentTick; // CraftBukkit public EntityItem(World world, double d0, double d1, double d2) { super(world); @@ -55,10 +55,11 @@ public class EntityItem extends Entity { public void l_() { super.l_(); - // CraftBukkit start - int currentTick = (int) (System.currentTimeMillis() / 50); - this.pickupDelay -= (currentTick - this.lastTick); - this.lastTick = currentTick; + // CraftBukkit start - Use wall time for pickup and despawn timers + int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick); + this.pickupDelay -= elapsedTicks; + this.age += elapsedTicks; + this.lastTick = MinecraftServer.currentTick; // CraftBukkit end this.lastX = this.locX; @@ -100,7 +101,7 @@ public class EntityItem extends Entity { this.motY *= -0.5D; } - ++this.age; + // ++this.age; // CraftBukkit - Moved up if (!this.world.isStatic && this.age >= 6000) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index b8a7c07e..0da473ba 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -10,6 +10,7 @@ import org.bukkit.event.entity.EntityCombustEvent; public class EntityZombie extends EntityMonster { private int d = 0; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit public EntityZombie(World world) { super(world); @@ -119,6 +120,12 @@ public class EntityZombie extends EntityMonster { if (!this.world.isStatic && this.o()) { int i = this.q(); + // CraftBukkit start - Use wall time instead of ticks for villager conversion + int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick); + this.lastTick = MinecraftServer.currentTick; + i *= elapsedTicks; + // CraftBukkit end + this.d -= i; if (this.d <= 0) { this.p(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 64d58825..3ee8ddc9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -78,7 +78,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public ConsoleReader reader; - public static int currentTick; + public static int currentTick = (int) (System.currentTimeMillis() / 50); public final Thread primaryThread; public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public int autosavePeriod; diff --git a/src/main/java/net/minecraft/server/MobEffect.java b/src/main/java/net/minecraft/server/MobEffect.java index 726a447a..2ba51cfe 100644 --- a/src/main/java/net/minecraft/server/MobEffect.java +++ b/src/main/java/net/minecraft/server/MobEffect.java @@ -7,6 +7,7 @@ public class MobEffect { private int amplification; private boolean splash; private boolean ambient; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit public MobEffect(int i, int j) { this(i, j, 0); @@ -81,7 +82,13 @@ public class MobEffect { } private int h() { - return --this.duration; + // CraftBukkit start - Use wall time instead of ticks for potion effects + int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick); + this.lastTick = MinecraftServer.currentTick; + this.duration -= elapsedTicks; + + return this.duration; + // CraftBukkit end } public void b(EntityLiving entityliving) { diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java index 91bed162..d03174b3 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -55,7 +55,7 @@ public class PlayerInteractManager { } public void a() { - this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit + this.currentTick = MinecraftServer.currentTick; // CraftBukkit int i; float f; int j; @@ -189,7 +189,7 @@ public class PlayerInteractManager { public void a(int i, int j, int k) { if (i == this.f && j == this.g && k == this.h) { - this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit + this.currentTick = MinecraftServer.currentTick; // CraftBukkit int l = this.currentTick - this.lastDigTick; int i1 = this.world.getTypeId(i, j, k); 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()) { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index e6cd7f9e..05a07b93 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -22,7 +22,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { private String h; // CraftBukkit start - private int lastTick = (int) (System.currentTimeMillis() / 50); + private int lastTick = MinecraftServer.currentTick; private int maxStack = MAX_STACK; public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); @@ -165,10 +165,9 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { boolean flag = this.burnTime > 0; boolean flag1 = false; - // CraftBukkit start - int currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - int elapsedTicks = currentTick - this.lastTick; - this.lastTick = currentTick; + // CraftBukkit start - Use wall time instead of ticks for cooking + int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick); + this.lastTick = MinecraftServer.currentTick; // CraftBukkit - moved from below if (this.isBurning() && this.canBurn()) { |