You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes player item drops being rejected when Main.item[Main.maxItems] is somehow active. I couldn't replicate this myself, but I have seen it can occur after a long play time without restarting the server. Appears to be a vanilla issue we now have to work around.
Clients always drop items in slot 400 (Main.maxItems) and then allow the server to assign it a slot, so this item slot being active caused the Bouncer to reject them when it shouldn't have.
I considered if I should also have the Bouncer reject new items being dropped outside of slot 400, but I worry this may have other unknown issues. Feedback appreciated on this decision.
Text for the changelog:
Fixed item drops sometimes being incorrectly rejected after extended server uptime (lost-werewolf)
This PR adds a single guard condition (id < Main.maxItems) to the item-drop type-change check in Bouncer.OnItemDrop to prevent legitimate drops from being incorrectly rejected when Terraria's vanilla bug causes slot 400 (Main.maxItems) to become active after extended uptime.
Clients always initiate drops using slot Main.maxItems (400), then receive an assigned slot from the server; when that placeholder slot is erroneously active, the prior check would read Main.item[400].active == true and wrongly reject the drop.
The fix is minimal and surgical: it preserves all existing type-change enforcement for slots 0–399 while skipping the check only for the new-drop placeholder slot.
Confidence Score: 5/5
Safe to merge; the change is a one-line guard that fixes an observable drop-rejection regression without weakening any other Bouncer check.
The fix adds id < Main.maxItems before the existing Main.item[id].active test, correctly isolating the vanilla slot-400 bug without touching any other enforcement path. All other type-change, range, stack, and ban checks are unchanged. The author's acknowledged trade-off — that slot 400 now bypasses the type-change guard — is the intended behaviour and is consistent with how Terraria's drop protocol works.
No files require special attention.
Important Files Changed
Filename
Overview
TShockAPI/Bouncer.cs
One-line guard added to OnItemDrop; correctly prevents false rejections when the vanilla game bug leaves slot 400 active, with no impact to existing type-change enforcement for all other item slots.
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
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.
Fixes player item drops being rejected when
Main.item[Main.maxItems]is somehow active. I couldn't replicate this myself, but I have seen it can occur after a long play time without restarting the server. Appears to be a vanilla issue we now have to work around.Clients always drop items in slot 400 (Main.maxItems) and then allow the server to assign it a slot, so this item slot being active caused the Bouncer to reject them when it shouldn't have.
I considered if I should also have the Bouncer reject new items being dropped outside of slot 400, but I worry this may have other unknown issues. Feedback appreciated on this decision.
Text for the changelog: