server: fix items being destroyed when a stack larger than its maximum is dropped - #1418
Open
schphe wants to merge 3 commits into
Open
server: fix items being destroyed when a stack larger than its maximum is dropped#1418schphe wants to merge 3 commits into
schphe wants to merge 3 commits into
Conversation
schphe
force-pushed
the
fix/drop-oversized-stack
branch
4 times, most recently
from
August 18, 2026 00:45
c688725 to
dfd3bba
Compare
…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
force-pushed
the
fix/drop-oversized-stack
branch
from
August 20, 2026 07:51
dfd3bba to
27e15ca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 destroyedanddropped 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.