Suppress hit-limit spam from natural breeding and add breed-path tests - #291
Merged
Conversation
Follow-up to #290: - A natural breed attempt (null/non-player breeder) at the limit no longer notifies nearby players — an auto-breeder at its limit would otherwise message everyone within range on every attempt. Player-fed breeding still notifies, since the player needs to know why no baby appeared. - Verified villagers are covered by the setBreed(false) cooldown branch: AbstractVillager extends Breedable in the targeted Paper API, so no code change was needed — a regression test now locks this in. - New tests: natural breeding at/under limit, non-op player breeding at limit (with notification), villager breed cooldown, and Player exclusion from the entity-island map on EntityAddToWorldEvent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyA5AKzK44TXSxXQbR6DNc
|
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Follow-up to #290, addressing the review notes.
Notification suppression for natural breeding
BREEDINGis not intellPlayers' suppressed-reason list, so after #290 an automated breeder (e.g. a villager breeder at its limit) would notify every nearby player — and callupdateInventory()— on every breed attempt. The limit check now threads anotifyflag throughcheckLimit/processIsland: natural (null/non-player breeder) breeding cancels silently, while player-fed breeding still notifies so the player knows why no baby appeared and their food was kept.Villager cooldown — verified, no code change needed
The review flagged that villagers at the limit might retry every tick because "Villager isn't Breedable". That turned out to be outdated for the targeted API:
AbstractVillager extends Breedablein Paper 1.21.11, so the existinginstanceof Breedablebranch already appliessetBreed(false)(a breeding-age cooldown, which vanilla villager breeding also respects since it requires age == 0). A regression test now locks this in.New tests (45 → 50)
setBreed(false)applied via the Breedable branchEntityAddToWorldEventfor aPlayer→ not added toentityIslandMap, no island lookup (guards the leak fix from Fix entity overcount from natural breeding and recount gaps #290)Also extracted
mockChicken()/mockVillager()test helpers (the op-bypass test built the same three mocks inline).Not covered: a
RecountCalculatortest for the boat fix —scanEntitiesis private inside the chunk-scanning pipeline and has no existing test scaffolding; building that is out of proportion for a one-lineinstanceofchange.Full suite: 305 tests, all green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UyA5AKzK44TXSxXQbR6DNc