diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-04-30 22:51:47 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-06-07 23:09:48 +0200 |
commit | 029ca3e2f6ff2000861094c4b5a3b5dfc6919665 (patch) | |
tree | 63df24e496559416014cb2ee65cb12604df3c947 | |
parent | ce6524d453506ca64323eecca49c00812f8be71d (diff) | |
download | craftbukkit-029ca3e2f6ff2000861094c4b5a3b5dfc6919665.tar craftbukkit-029ca3e2f6ff2000861094c4b5a3b5dfc6919665.tar.gz craftbukkit-029ca3e2f6ff2000861094c4b5a3b5dfc6919665.tar.lz craftbukkit-029ca3e2f6ff2000861094c4b5a3b5dfc6919665.tar.xz craftbukkit-029ca3e2f6ff2000861094c4b5a3b5dfc6919665.zip |
Prevent effects of tickrate degradation on item pickups
-rw-r--r-- | src/main/java/net/minecraft/server/EntityItem.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index c61ab3e0..9b15397f 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -13,6 +13,7 @@ public class EntityItem extends Entity { public int pickupDelay; private int f = 5; public float d = (float) (Math.random() * 3.141592653589793D * 2.0D); + private int lastTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) { super(world); @@ -40,9 +41,11 @@ public class EntityItem extends Entity { public void o_() { super.o_(); - if (this.pickupDelay > 0) { - --this.pickupDelay; - } + // CraftBukkit start + int currentTick = (int) (System.currentTimeMillis() / 50); + this.pickupDelay -= (currentTick - this.lastTick); + this.lastTick = currentTick; + // CraftBukkit end this.lastX = this.locX; this.lastY = this.locY; @@ -119,7 +122,7 @@ public class EntityItem extends Entity { int i = this.itemStack.count; // CraftBukkit start - if (this.pickupDelay == 0) { + if (this.pickupDelay <= 0) { // <-- == to <= Player player = (Player) entityhuman.getBukkitEntity(); PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity()); ((WorldServer) world).getServer().getPluginManager().callEvent(event); |