Match vanilla llama caravans, trader llamas, breeding and wolves

A lead gives its mob a home at the holder (PathfinderMob.whenLeashedTo)
and every random position helper honours homes (generateRandomPos-
TowardDirection's lean back and GoalUtils.isRestricted), as the happy
ghast's float area now does too. LlamaFollowCaravanGoal keeps 2.1F, a
llama's baby and the breeding experience are drawn from the parent's
random, wolves run from llamas by strength (WolfAvoidEntityGoal), a
growing mob refits its box (fudgePositionAfterSizeChange) and a happy
ghast's new controls want nothing. Scenarios can lead mobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-12 17:45:09 +02:00
parent 2edae5746a
commit c90cd5f072
17 changed files with 389 additions and 106 deletions
@@ -480,6 +480,9 @@ public final class VanillaMobAiOracle {
else if (flag.startsWith("age=")) ((AgeableMob) mob).setAge(Integer.parseInt(flag.substring(4)));
else if (flag.startsWith("strength=")) method(net.minecraft.world.entity.animal.equine.Llama.class, "setStrength", int.class)
.invoke(mob, Integer.parseInt(flag.substring(9)));
else if (flag.equals("leashed") || flag.startsWith("leashto=")) {
// Leashed once every mob exists (below).
}
else throw new IllegalArgumentException(flag);
}
level.addFreshEntity(mob);
@@ -493,6 +496,14 @@ public final class VanillaMobAiOracle {
brains.add(brain);
seeds.add(spec.seed);
}
// Leads: to the player ("leashed") or to the n-th mob ("leashto=n").
for (int i = 0; i < s.mobs.size(); i++) {
for (String flag : s.mobs.get(i).flags) {
if (flag.equals("leashed")) ((net.minecraft.world.entity.Leashable) mobs.get(i)).setLeashedTo(player, true);
else if (flag.startsWith("leashto=")) ((net.minecraft.world.entity.Leashable) mobs.get(i))
.setLeashedTo(mobs.get(Integer.parseInt(flag.substring(8))), true);
}
}
level.getRandom().setSeed(s.levelSeed);
SOUNDS.clear();
Method tickTime = method(ServerLevel.class, "tickTime");