mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
SPIGOT-989: Cap assignment of pickup delays to Short.MAX_VALUE due to storage implementation constraints.
Changed assignment of pickup delays in such a way that they may not be larger than the value actually stored inside the NBT format that is Short.MAX_VALUE. Did not change method signature in order not to produce any shortening cast warnings in existing code. All values larger than 32767 are generally used to indicate that an item should never be picked up. Shortening this to 32767 will actually cause the pickup delay to never decrease, thus resulting in non-pickupable item stacks.
This commit is contained in:
parent
62a216966f
commit
8cc1683e83
@ -34,7 +34,7 @@ public class CraftItem extends CraftEntity implements Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPickupDelay(int delay) {
|
public void setPickupDelay(int delay) {
|
||||||
item.pickupDelay = delay;
|
item.pickupDelay = Math.min(delay, Short.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user