Skip to content

Log chested horse inventory transactions - #1006

Open
CheekyNox wants to merge 6 commits into
PlayPro:masterfrom
CheekyNox:fix/chested-horse-inventory
Open

CheekyNox wants to merge 6 commits into
PlayPro:masterfrom
CheekyNox:fix/chested-horse-inventory

Conversation

@CheekyNox

@CheekyNox CheekyNox commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Log item changes in chest-equipped donkeys, mules, llamas, and trader llamas, attributed to the player performing each click or drag.
  • Normalize horse inventory snapshots across platforms exposing zero, one, or two leading equipment slots. Read and write saddle/decor through their inventory APIs, with chest storage mapped back to the native layout during rollback/restore.
  • Use the horse GUI's equipment-and-storage size for drag capture, including raw slots 15 and 16 on a Spigot 26.1.1 donkey.
  • Flush pending transfers on inventory close, damage/removal, invalidation, and shutdown; release identity-promotion claims when container transactions are permanently discarded.
  • Create the tracking identity from the first container transaction independently of player-interactions, support direct inspection, and document the additional container types in the v13 API notes.
  • Remove the four files under src/test and restore its .gitignore entry as requested; tests are maintained in a separate repository.

Root cause

InventoryChangeListener originally only recognized entity containers accepted by EntitySpawnTracking.isPlacedEntity(), excluding chested horses. A first transaction also needs to promote a natural entity into the persisted identity table before its container rows can be written.

The earlier implementation then assumed getContents() always exposed saddle/decor at indices 0 and 1. Spigot can expose one leading equipment slot or storage alone, while the GUI retains both equipment slots. Capture, saved state, and replay now share normalized snapshots and convert to the native layout when applying changes. Previously saved arrays with zero, one, or two leading slots are normalized when read.

Validation

  • Maven package build with JDK 25: BUILD SUCCESS; shaded target/CoreProtect-24.1.jar verified. Repository tests are skipped by the existing POM configuration.
  • An isolated local probe checked 36 simulated layouts across donkey, mule, llama, and trader llama: snapshot capture, replay, first/last storage slots, separate equipment, GUI boundaries, and normalization of saved arrays. The probe is not included in this PR.
  • git diff --check.

A live Paper/Spigot server test was not performed.

Fixes #3

@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for coreprotect failed. Why did it fail? →

Name Link
🔨 Latest commit df9c2c3
🔍 Latest deploy log https://app.netlify.com/projects/coreprotect/deploys/6ab3e098fba780000822e4c6

@CheekyNox
CheekyNox force-pushed the fix/chested-horse-inventory branch from de15e94 to df9c2c3 Compare September 23, 2026 14:22
@Intelli

Intelli commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution! Automated review is requesting the following:

  • Make rollback/restore respect horse chest-storage and equipment slots. The existing generic replay can insert ordinary items into an empty saddle/equipment slot.
  • Replace the independent per-player open/close deltas with actor-aware transaction capture. Two players viewing the same animal can currently both be credited with one player’s removal.
  • Integrate pending horse transactions with lifecycle and shutdown flushing so completed transfers aren’t lost when the animal becomes invalid before inventory close.
  • Release identity-promotion claims when container transactions are permanently discarded, including failed entries marked retryRequired.

@Intelli

Intelli commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for the updates! Automated review found a few remaining compatibility issues:

  • Please handle the actual horse inventory layout across supported platforms and versions in both capture and replay. getContents() does not universally include saddle/decor at indices 0 and 1. Spigot 1.21.4 has one leading saddle slot, while Spigot 26.1.1 exposes chest storage starting at index 0 with equipment separate. The current replay skips valid chest slots and can report success without applying the item change.
  • Please fix drag capture’s raw-slot boundary check. On Spigot 26.1.1, a donkey’s 15 storage slots occupy GUI raw slots 2–16, so drags exclusively into slots 15–16 are currently missed.
  • Please remove the four files under src/test and restore its .gitignore entry, since we maintain tests in a separate repository. No additional tests are requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Donkey Chest

3 participants