mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 06:53:44 +01:00
Prevent effects of tickrate degradation on item pickups
This commit is contained in:
parent
ce6524d453
commit
029ca3e2f6
@ -13,6 +13,7 @@ public class EntityItem extends Entity {
|
|||||||
public int pickupDelay;
|
public int pickupDelay;
|
||||||
private int f = 5;
|
private int f = 5;
|
||||||
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
|
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) {
|
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
|
||||||
super(world);
|
super(world);
|
||||||
@ -40,9 +41,11 @@ public class EntityItem extends Entity {
|
|||||||
|
|
||||||
public void o_() {
|
public void o_() {
|
||||||
super.o_();
|
super.o_();
|
||||||
if (this.pickupDelay > 0) {
|
// CraftBukkit start
|
||||||
--this.pickupDelay;
|
int currentTick = (int) (System.currentTimeMillis() / 50);
|
||||||
}
|
this.pickupDelay -= (currentTick - this.lastTick);
|
||||||
|
this.lastTick = currentTick;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
this.lastX = this.locX;
|
this.lastX = this.locX;
|
||||||
this.lastY = this.locY;
|
this.lastY = this.locY;
|
||||||
@ -119,7 +122,7 @@ public class EntityItem extends Entity {
|
|||||||
int i = this.itemStack.count;
|
int i = this.itemStack.count;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.pickupDelay == 0) {
|
if (this.pickupDelay <= 0) { // <-- == to <=
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity());
|
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity());
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||||
|
Loading…
Reference in New Issue
Block a user