Add Display Jar tile rect match and placement validation#3233
Add Display Jar tile rect match and placement validation#3233ACaiCat wants to merge 7 commits intoPryaxis:general-develfrom
Conversation
Greptile SummaryThis PR implements comprehensive support for Dead Cells Display Jar tile entities in TShock. The changes add packet handling, permission checks, and tile rect matching to properly handle Display Jar item placement and removal. Key Changes:
The implementation follows established patterns from similar tile entities like Food Platter and Item Frame, ensuring consistency with the existing codebase. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant GetDataHandlers
participant Bouncer
participant Player
Client->>GetDataHandlers: TEDeadCellsDisplayJar packet
GetDataHandlers->>GetDataHandlers: HandleDisplayJar()
GetDataHandlers->>GetDataHandlers: Parse packet (tileX, tileY, itemID, prefix, stack)
GetDataHandlers->>GetDataHandlers: OnDisplayJarTryPlacing()
GetDataHandlers->>Bouncer: Invoke DisplayJarTryPlacing event
Bouncer->>Bouncer: Validate tile placement position
alt Invalid position
Bouncer->>Client: Reject (handled=true)
end
Bouncer->>Bouncer: Check item in hand matches itemID
alt Item mismatch
Bouncer->>Client: SendTileSquareCentered + Reject
end
Bouncer->>Player: Check IsBeingDisabled()
alt Player disabled
Bouncer->>Player: GiveItemCheck (return item)
Bouncer->>Client: SendTileSquareCentered + Reject
end
Bouncer->>Player: HasBuildPermission()
alt No permission
Bouncer->>Player: GiveItemCheck (return item)
Bouncer->>Client: SendTileSquareCentered + Reject
end
Bouncer->>Player: IsInRange(range: 13)
alt Out of range
Bouncer->>Client: SendTileSquareCentered + Reject
end
Bouncer->>GetDataHandlers: Return (not handled)
GetDataHandlers->>Client: Allow placement
Last reviewed commit: 81993b3 |
|
This seems good. Could you also fix the Bouncer rejecting item removal from the jar when not using a pickaxe before I approve? This is about the same case as torches, right clicking removes the item without pickaxing the jar. Feel it would be good to squash here along with this match. Double edit: attached clip: |
If every packet sent by clients had a handler AND a hook to subscribe to, it would be great. Noticed once when making a plugin that I couldn't subscribe to the SpawnBoss handler, so I had to manually do so through OnGetData. Perhaps good for another PR. |
|
@greptile-apps review |


Fix Display Jar placement