Villagers seemingly still walking/pathfinding while asleep
CDAGaming opened this issue ยท 7 comments
Hard to say, though I have never seen normal villagers crawl out of bed without them being interacted with first
From what I remember it's a greet pathfinder? Idk if that was fixed. Another thing it could be we rewrote the pathfind to beds and the whole vanilla sleeping mechanic, so maybe that could be something wrong.
For the Greet task, thats normally acomponied with dialogue, in this case it is not. As for the reworking, despite refactors, the logic is still nearly identical to Mojangs, so its unlikely that would be a probable cause.
It does seem there are conditions in the Greet task that are not checking for a sleeping villager. I am unsure if this check may occur elsewhere.
You said that usually this is accompanied by dialogue: https://github.com/Luke100000/minecraft-comes-alive/blob/1.18.2/common/src/main/java/mca/entity/ai/brain/tasks/GreetPlayerTask.java#L73
In this case it wasn't so this line was executed: https://github.com/Luke100000/minecraft-comes-alive/blob/1.18.2/common/src/main/java/mca/entity/ai/brain/tasks/GreetPlayerTask.java#L78
Looking at shouldRun as a reference maybe this is as easy as ensuring no greet logic tries to run while sleeping? This is assuming that Greet is the actual cause of the unintended movement:
@Override
protected boolean shouldRun(ServerWorld world, VillagerEntityMCA villager) {
if (villager.isSleeping()) {
return false;
}
if (cooldown > 0) {
cooldown--;
return false;
}
[...]