MCA Reborn [Fabric/Forge]

MCA Reborn [Fabric/Forge]

6M Downloads

Villagers seemingly still walking/pathfinding while asleep

CDAGaming opened this issue ยท 7 comments

commented

Causes them to quite literally fall out of bed

commented

Is this pathing that we have created or original Minecraft logic?

commented

Hard to say, though I have never seen normal villagers crawl out of bed without them being interacted with first

commented

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.

commented

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.

commented

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;
        }
        [...]    
commented

Resolved from Wild's Suggestion :)

commented

Under further investigation, its tied to them auto pathing to you while your near them. This shouldnt occur while they are asleep