fancynpcs: Fix horse pose attribute forcing the rearing animation - #330
Open
ThoriaDevelopment wants to merge 1 commit into
Open
ThoriaDevelopment wants to merge 1 commit into
ThoriaDevelopment wants to merge 1 commit into
Conversation
ThoriaDevelopment
force-pushed
the
fix/fancynpcs-horse-pose-rearing
branch
from
September 11, 2026 22:33
71076ae to
58a1de1
Compare
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.
📋 Description
Fixes #312.
A horse, donkey, mule, skeleton horse or zombie horse NPC shows the rearing pose whichever
posevalue is set.standingandeatingboth end up rearing, which matches the report that the pose attribute appears to do nothing.The cause is in
HorseAttributes#setPose. Thestandingandeatingbranches callhorse.setStanding(0), and onAbstractHorsethat method always sets theFLAG_STANDING(rearing) flag:setStanding(0)stores a counter of zero, andAbstractHorse#tickonly clears the flag while that counter runs down:With a counter of zero the flag is never cleared, so the NPC keeps the rearing pose. NPC entities are packet only and are never ticked, so nothing else clears it either.
clearStanding()is the method that resets the flag.✅ Checklist
Fixes #issue_numbermainbranch🔍 Changes
In
HorseAttributes#setPose, thestandingandeatingbranches now callhorse.clearStanding()instead ofhorse.setStanding(0). Therearingbranch (setStanding(20)) is unchanged.Applied to every implementation that had the bug:
plugins/fancynpcs-v2/implementation_26_3plugins/fancynpcs-v2/implementation_26_2plugins/fancynpcs-v2/implementation_26_1_2plugins/fancynpcs-v2/implementation_1_21_11plugins/fancynpcs-v2/implementation_1_21_9plugins/fancynpcs-v2/implementation_1_21_6implementation_1_21_5is deliberately untouched. It already usessetForceStanding(boolean)for the same three states, and 1.21.5 does not haveclearStanding(): the 1.21.5 mappings listsetStanding(boolean), whilesetStanding(int)andclearStanding()first appear in 1.21.7.🧪 How to Test
/npc create horse, then/npc attribute <npc> set pose standing.pose eating(it eats, no rearing) andpose rearing(it rears, as before).What I tested
:plugins:fancynpcs-v2:implementation_1_21_11:compileJava,:plugins:fancynpcs-v2:implementation_26_1_2:compileJava,:plugins/fancynpcs-v2:implementation_26_2:compileJavaand:plugins/fancynpcs-v2:implementation_26_3:compileJavaall succeed with this change, which confirmsclearStanding()resolves in those dev bundles.implementation_1_21_6andimplementation_1_21_9build against the 1.21.7 and 1.21.9 dev bundles.clearStanding()is present in the official Mojang mappings for both versions, but I could not compile those two modules locally. The reason is in the notes below.isStanding()isEating()setEating(false); setStanding(0)(oldstanding)setStanding(0); setEating(true)(oldeating)setEating(false); clearStanding()(newstanding)clearStanding(); setEating(true)(neweating)setStanding(20); setEating(false)(unchangedrearing)What I did not test
/fancynpcs run_tests. The harness needs a player, and I worked on a headless test server. Please run it before merging.Notes
Two things I noticed while working on this, neither of them part of the change.
poseattribute from an already spawned NPC does not reset the flags it set, so an NPC left inrearingkeeps rearing until it is recreated. Fixing that properly needs an attribute reset path, which is a larger change than this bug report.:plugins:fancynpcs-v2:shadowJarfrom scratch fails in this repo, on an unmodified checkout as well. On a machine with a cold Paperweight cache,paperweightUserdevSetupfails for the 1.21.5, 1.21.6 and 1.21.9 modules withUnsupported class file major version 69fromio.papermc.codebook. Paperweight 2.0.0-beta.23 resolves codebook-cli 1.0.14, whose bundled ASM 9.6 cannot read Java 25 class files, and every module here sets a Java 25 toolchain. CI stays green because~/.gradleis cached: the Paperweight work directories are restored and those setup tasks report up to date. Happy to open a separate issue for it if that is useful.