Skip to content

server: fix items being destroyed when a stack larger than its maximum is dropped - #1418

Open
schphe wants to merge 3 commits into
df-mc:masterfrom
oriumgames:fix/drop-oversized-stack
Open

server: fix items being destroyed when a stack larger than its maximum is dropped#1418
schphe wants to merge 3 commits into
df-mc:masterfrom
oriumgames:fix/drop-oversized-stack

Conversation

@schphe

@schphe schphe commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What happens and why

An item entity holds at most a maximum sized stack: entity.ItemBehaviourConfig
shrinks anything larger when it is built, so everything above the maximum is
destroyed without an error. Player.Drop nevertheless returned the count of the
whole stack it was given, reporting items it had not dropped, and dropItem
lost the remainder in the same way.

Both now drop a stack larger than the maximum as several item entities, and
Player.Drop returns the number of items that actually reached the world. This
matches what a player sees when a stack that big is dropped in a vanilla game.

Nothing in dragonfly drops such a stack once the decorated pot is kept within
its maximum count, but Player.Drop is part of the public API and silently lost
items for anyone passing it a larger stack.

Verification

Regression test fails without the fix: dropped 64 items, want 200: 136 were destroyed and dropped 1 item entities, want 4.

Nothing in dragonfly drops such a stack once the decorated pot is kept within its maximum count, so this is a fix to the public API rather than to a reachable path.

@schphe
schphe force-pushed the fix/drop-oversized-stack branch 4 times, most recently from c688725 to dfd3bba Compare August 18, 2026 00:45
schphe added 3 commits August 20, 2026 02:47
…m is dropped

An item entity holds at most a maximum sized stack: entity.ItemBehaviourConfig
shrinks anything larger when it is built, so everything above the maximum is
destroyed without an error. Player.Drop nevertheless returned the count of the
whole stack it was given, reporting items it had not dropped, and dropItem
lost the remainder in the same way.

Both now drop a stack larger than the maximum as several item entities, and
Player.Drop returns the number of items that actually reached the world. This
matches what a player sees when a stack that big is dropped in a vanilla game.

Nothing in dragonfly drops such a stack once the decorated pot is kept within
its maximum count, but Player.Drop is part of the public API and silently lost
items for anyone passing it a larger stack.
@schphe
schphe force-pushed the fix/drop-oversized-stack branch from dfd3bba to 27e15ca Compare August 20, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant