Skip to content

server/player: Resync the inventory when a released item consumes nothing - #1289

Open
root-nat wants to merge 1 commit into
df-mc:masterfrom
root-nat:fix/release-item-resync
Open

server/player: Resync the inventory when a released item consumes nothing#1289
root-nat wants to merge 1 commit into
df-mc:masterfrom
root-nat:fix/release-item-resync

Conversation

@root-nat

Copy link
Copy Markdown

Reworked fix for #1001 (the previous attempt, #1281, was closed after review).

Problem

When a bow is released the client predicts removing an arrow. Server-side the arrow is consumed through inventory.RemoveItem, whose slot-change callback already resends the affected slot on every successful shot. The desync happens only on the paths that consume nothing — the release is cancelled, drawn for < 3 ticks, force < 0.1, or there are no arrows — where no slot changes and the client's predicted removal is never reverted.

Fix

Resync the inventory (main + off-hand) only on those no-consume paths in Player.ReleaseItem, leaving a successful release to the existing slot-change callback. This avoids the redundant full resend / one-frame flicker that resending before the release caused on every shot (the concern raised on #1281 by @FDUTCH).

Closes #1001.

🤖 Generated with Claude Code

…hing

When a player releases an item such as a bow, the client predicts the result
and removes the arrow it expects to be fired. If the release consumes nothing
(it is cancelled, the bow is not drawn long enough, or there are no arrows) no
inventory slot changes server-side, so the client is never corrected and shows
a phantom missing item.

Resend the inventory only on those no-consume paths in ReleaseItem. A
successful release already updates the client through the inventory slot change
of the consumed item, so the common path is untouched and does not flicker.

Closes df-mc#1001.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Canceling HandleItemRelease when using a Bow will decrease arrows in the player inventory (client-side)

1 participant