Mob AI: vanilla parity pass on the existing goals - #3095
Open
TheDarkSword wants to merge 7 commits into
Open
Conversation
Target conditions ignored their selector, goals could not stay non-interruptible, target searches hid valid targets, and a few timers ran at half or double speed.
Turtle egg breaking, blaze attacks, skeleton strafing, villager trading and panic were all incomplete or stubbed out.
Small logic differences found going through each ported goal against the vanilla source.
Strolling, panic, fleeing and raid pathing now pick a destination the navigation can actually reach instead of any random offset.
Also moves the triangular sampling onto the rng, where it belongs, instead of a helper in the blaze goal.
A shapeless block was treated as a full cube, so every raycast reported a hit on its own origin and nothing could ever see anything.
Several goals ask about the same target every tick, so they were each paying for their own raycast.
TheDarkSword
requested review from
QuantumSegfault,
Snowiiii and
vyPal
as code owners
August 28, 2026 10:48
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.
Went through every goal we already have against the vanilla sources and fixed what diverged. No new goals here, that's a follow up.
Goal framework.
TargetingConditionsnever ran its selector, the combat check only had the "no targeter" branch (so peaceful applied to every target, andcanAttack/isAlliedTowere missing),WrappedGoaldid not forwardisInterruptable,canContinueToUsedefaulted to false instead ofcanUse(), target searches filtered the nearest candidate instead of picking the nearest matching one, andTargetGoalhad notargetMobfallback. Teams are now readable for any entity and not just players, so the ally checks work.Goals that did nothing. Turtle egg breaking, blaze movement and fireballs, skeleton strafing, villager trading and panic were stubbed or structurally wrong, and the ranged goals had line of sight hardcoded to true.
Timers. A few goals ran at half or double the vanilla duration, mostly
reducedTickDelayvsadjustedTickDelay, or overridingrequiresUpdateEveryTickwhere vanilla does not.Everything else. Small differences found one goal at a time: selector ordering,
FollowParentGoalpicking the wrong parent,MoveToBlockGoalmeasuring from the block corner,SwellGoalreading a live target,OpenDoorGoal,TemptGoalscare handling,HurtByTargetGoalalerting, mobGriefing on sheep, breeding experience.RandomPos and GoalUtils. Ported those two plus
DefaultRandomPosandLandRandomPos, so strolling, panic, fleeing and raid pathing pick a destination the navigation can reach instead of any random offset. Line of sight results are cached per tick likeSensingdoes.Why the raycast fix is in here.
World::raycasttreated a shapeless block as a full cube, so it always reported a hit on the block the ray starts in, normally air, and never got past the origin. It regressed in 0d55aa5. I only found it because it makes every line of sight check in this PR silently do nothing, so splitting it out made no sense.