fix: synchronize item entity hitting ground to stop bouncing (#2544)

This commit is contained in:
Leon 2024-12-29 16:10:32 +00:00 committed by GitHub
parent 719e14bd79
commit 698af959c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,7 @@ public class ItemEntity extends Entity {
private boolean pickable = true;
private boolean mergeable = true;
private float mergeRange = 1;
private boolean previousOnGround = false;
private long spawnTime;
private long pickupDelay;
@ -94,6 +95,18 @@ public class ItemEntity extends Entity {
}
}
@Override
public void movementTick() {
super.movementTick();
if (!previousOnGround && onGround) {
synchronizePosition();
sendPacketToViewers(getVelocityPacket());
}
previousOnGround = onGround;
}
@Override
public void spawn() {
this.spawnTime = System.currentTimeMillis();