Skip to content

fix: preserve player-kept horses on chunk load - #56

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/horse-cleanup-protection
Sep 29, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/horse-cleanup-protection

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem and fix

Cooking removed horses on chunk load when they had no Cooking owner or enrolled mount record, even if they were vanilla-tamed, named, or saddled. The live remove-unowned list includes horses.

Preserve tamed, named, or saddled AbstractHorse mounts and apply persistence flags even when no Cooking record exists. Existing enrollment, stats, ownership, and wild livestock cleanup remain in place. This prevents future removals; it does not restore previously lost entities.

Validation

  • Reviewed the diff and live cleanup configuration.
  • mvn -B --no-transfer-progress clean verify: 254 tests passed.
  • Eight new lifecycle regression tests; five fail against the original cleanup implementation.
  • CI passed; CodeRabbit approved with no review comments.
  • TFMCDev01 loaded Cooking DEV-20260929-2010 successfully and reached Paper Done.
  • Saved chunk unload/reload on dev: named+saddled, tamed, saddled horses and tamed llamas survived with PersistenceRequired set; wild horses were removed. The initial probe sampled after the chunk unloaded again; holding it loaded and inspecting entity NBT confirmed survival. Temporary test entities and force-load ticket were cleaned up.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2caa7bb5-3c0a-4978-b47e-30d3669120c8

📥 Commits

Reviewing files that changed from the base of the PR and between 6ee9e89 and 150873f.

📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/cooking/husbandry/HusbandryLifecycleListener.java
  • src/main/java/net/tfminecraft/cooking/husbandry/HusbandryMounts.java
  • src/test/java/net/tfminecraft/cooking/husbandry/HusbandryMountPersistenceTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The load listener now treats tamed, named, or saddled horses as player-kept mounts. It applies persistence flags to these mounts when they have no repository row. New tests cover horse, llama, and cow load scenarios.

Changes

Mount Persistence

Layer / File(s) Summary
Mount recognition and load handling
src/main/java/net/tfminecraft/cooking/husbandry/HusbandryMounts.java, src/main/java/net/tfminecraft/cooking/husbandry/HusbandryLifecycleListener.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryMountPersistenceTest.java
isPlayerKeptMount recognizes tamed, named, or saddled horses. handleLoad uses this check when deciding whether to wipe an unowned entity and applies persistence flags to qualifying mounts without repository rows. Tests cover horse, llama, and cow load scenarios.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: carolinebondhus

Merge Risk: ⚪ Minimal · up to 15087

No actionable issue remains in this review; the change is ready for normal merge checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 15087

The change intentionally preserves player-kept mounts without granting them Cooking ownership or mount-access privileges. No security issue was verified. Residual risk depends on who can mark mounts as kept and whether large numbers of retained mounts affect the server.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — An actor able to set a mount’s tame, name, or saddle state can influence whether that mount survives load-time cleanup without obtaining a Cooking ownership row. The identified outcome is entity retention, not access to another player’s recorded mount; actual marker-setting authority and scale are not established.

Trust Boundaries and Controls

  • observed — The new exemption trusts vanilla mount attributes for cleanup, while repository owner records remain the authority for Cooking ownership and restricted mount access. Tests distinguish protected horses from removable wild horses and named non-mount livestock.

Resilience and Maintainability Implications

  • observed — The handler returns without modifying the entity if the repository is unavailable. Repeated load handling evaluates the current marker and reapplies persistence flags for qualifying rowless mounts; the supplied tests do not exercise marker changes across loads or repository exceptions.

Hardening Proposals

  • proposed — If unowned cleanup is intended to limit server entity counts, validate in the deployment who can set qualifying mount attributes and monitor the resulting population of persistent rowless mounts.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the problem, fix, behavior impact, validation results, and deployment testing. It does not follow the repository template because it omits the required Summary, Documentation … Restructure the description using the repository template. Add the Summary, Documentation impact, Contract, and Notes sections. State the affected behavior, documentation status, Player wiki status, and any relevant configuration notes. Pre…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving player-kept horses during chunk loading.
Full details: Description check

Explanation

The description explains the problem, fix, behavior impact, validation results, and deployment testing. It does not follow the repository template because it omits the required Summary, Documentation impact, Contract, and Notes sections, including the affected behavior and Player wiki fields.

Resolution

Restructure the description using the repository template. Add the Summary, Documentation impact, Contract, and Notes sections. State the affected behavior, documentation status, Player wiki status, and any relevant configuration notes. Preserve the existing test and deployment validation details under the appropriate sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit watches horses stay,
Tamed or named, they’re here to stay.
A saddle marks the path they roam,
Persistence helps them keep a home.
The llama and cow tests join the play.

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX
XxFran10xX merged commit 857fff2 into main Sep 29, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the fix/horse-cleanup-protection branch September 29, 2026 20:22
ryanbarlow97 added a commit that referenced this pull request Sep 29, 2026
* fix: keep only Cooking-owned horses and explain claiming

Revert the #56 load exemption: vanilla-tamed, named or saddled horses
without a Cooking owner bypassed the max-animals cap. Unowned horses are
removed on chunk load again, apart from enrolled wild mounts (unchanged).

Players now get a hint when they tame or ride an unclaimed animal from
the remove-unowned list: it will disappear unless claimed with a named
Ownership Token, plus their owned/cap count or how to free a slot.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: only warn about animals the cleanup would remove

Riding enrolls horses, donkeys, mules and camels, and enrolled mounts survive
the chunk-load cleanup without an owner, so the mount hint told players a
horse would vanish when it would not. needsClaim now uses the cleanup's own
rule. The tame hint no longer says to tame an animal that was just tamed
(EntityTameEvent fires before taming). Wolves, cats and ocelots cannot be
claimed, so they are no longer sent to the Ownership Token. The release
instructions name the inspect menu's Remove ownership button, and removal
is described as happening when the area next loads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: XxFran10xX <318299142+XxFran10xX@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Ryan Barlow <7389646+ryanbarlow97@users.noreply.github.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.

1 participant