Skip to content

fix: stop goats crashing the ram behavior mixin - #603

Open
KostiaFed wants to merge 1 commit into
CardboardPowered:ver/26.1from
KostiaFed:fix/goat-ram-mixin-target
Open

fix: stop goats crashing the ram behavior mixin#603
KostiaFed wants to merge 1 commit into
CardboardPowered:ver/26.1from
KostiaFed:fix/goat-ram-mixin-target

Conversation

@KostiaFed

@KostiaFed KostiaFed commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Every goat fails to load or spawn on 26.1.2. PrepareRamNearestTargetMixin selects its target method by the old Yarn intermediary name method_36270, but this build runs on unobfuscated names and loads no refMap, so the selector matches nothing and the mixin fails to apply — taking the whole class down with it:

Critical injection failure: @Inject annotation on targetEvent could not find any targets
matching 'method_36270' in net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.
No refMap loaded.
...
at net.minecraft.world.entity.animal.goat.GoatAi.initRamActivity(GoatAi.java:132)

Fix

The real target is the lambda in start() that calls chooseRamPosition, confirmed against minecraft-merged-deobf-26.1.2.jar:

private void lambda$start$2(PathfinderMob, LivingEntity)
    ...
    3: invokevirtual chooseRamPosition:(LPathfinderMob;LLivingEntity;)V

Its descriptor already matches the handler, so the change is just the selector: method_36270lambda$start$2.

Also removed the line after ci.cancel():

mob = ((CraftLivingEntity) event.getTarget()).getHandle();

ci.cancel() does not return, so this threw a NullPointerException on exactly the branch where event.getTarget() == null — and it was dead code anyway, since assigning a local in an @Inject handler cannot change the target in the injected method.

Scope

Cancelling EntityTargetEvent now works. Retargeting via event.setTarget(...) still does not apply — that needs a @Redirect/@ModifyArg on the chooseRamPosition call plus an @Invoker (the method is private), which is left for a follow-up.

AssignProfessionFromJobSiteMixin has the same stale-selector problem (method_46891), but its body is commented out so it does not fail. Its current target is lambda$create$6(Villager, ServerLevel, Holder$Reference), for whenever VillagerCareerChangeEvent gets enabled.

Testing

gradlew compileJava passes.

PrepareRamNearestTargetMixin selected its target method by the old Yarn
intermediary name method_36270. This build runs on unobfuscated names and
loads no refMap, so the selector matched nothing and the mixin failed to
apply, making every goat fail to load or spawn.

Point the injector at lambda$start$2, the lambda in start() that calls
chooseRamPosition, and drop the line that reassigned the local mob after
ci.cancel(): it threw a NullPointerException on the cancelled path and had
no effect on the actual target.

Co-Authored-By: Claude Opus 5 <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.

1 participant