Villagers can pathfind and move towards items while sleeping in a bed
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards that item before entirely waking up. This causes an incorrect visual for the player where the villager appears to still be asleep (laying down horizontally) while it pathfinds towards any applicable item(s).
Steps to Reproduce:
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1
Observed Behavior:
The villager will move across the ground as if it is still asleep to pick up items.
Expected Behavior:
The villager should first wake up entirely (standing upright) before walking to the dropped item, or not detect items while asleep in the first place.
Video:
Code Analysis:
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }
Two Possible Solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;
This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4![]()
Linked Issues
is duplicated by36
relates to3
- Unresolved
[Mod] Jiingy
Jack Davies- 40
- 19
- Confirmed
Normal
- Gameplay
- Mob behaviour
- ai mob sleeping villager
1.14.4 - 1.21.3
1.14.4 1.15 1.15.2 20w09a 20w13b 20w15a 20w16a 20w17a 20w18a 20w19a 20w22a 1.16.1 1.16.4 20w51a 1.16.5 21w13a 21w18a 1.17 1.17.1 21w41a 1.18.1 1.18.2 1.19 1.19.2 1.19.3 1.19.4 23w18a 1.20.1 1.20.2-pre2 1.20.2 23w40a 23w42a 23w46a 1.20.3 1.20.4-rc1 1.20.4 24w10a 1.20.6 24w19b 1.21-rc1 1.21 24w38a 1.21.3
Created Issue:
Villagers move around in bed when food is thrown at them
When Villagers are sleeping, most of them will slide around the beds when food is thrown at them.
Environment
On the top floor of my base.
On the top floor of my base.
is duplicated by
Villagers move around in bed or even leave the bed when food is thrown at them
is duplicated by
is duplicated by
is duplicated by
MC-161086
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
relates to
is duplicated by
is duplicated by
is duplicated by
relates to
relates to
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
relates to
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
is duplicated by
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [~JingyBreadMan]
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [~JingyBreadMan]
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [~JingyBreadMan]
Villagersmove around in bed or even leave the bed when food is thrown at themVillagers can pathfind towards wanted items without properly waking up first
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [~JingyBreadMan]
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [~JingyBreadMan]
is duplicated by
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [
~JingyBreadMan]The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [Mod] Jiingy
Villagers can pathfindtowards wanted items without properly waking up firstVillagers can pathfind and move towards items while sleeping in a bed
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed behavior
The villager will move across the ground as if it is still asleep to pick up items.
Expected behavior
The villager should first wake up entirely (standing upright) before walking to the dropped item, or not detect items while asleep in the first place.
Screenshots/Videos
Code analysis
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two possible solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [Mod] Jiingy
relates to
is duplicated by
is duplicated by
The bug
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards th
eitem beforeproperly waking up, whichcauses an incorrect visualof the villager appearingto still be asleepwhile it pathfinds to items it wants to pick up.Steps to
reproduce
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed
behaviorThe villager will move across the ground as if it is still asleep to pick up items.
Expected
behaviorThe villager should first wake up entirely (standing upright) before walking to the dropped item, or not detect items while asleep in the first place.
Screenshots/VideosCode
analysisHere in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two
possiblesolutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )
- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4Description by [Mod] Jiingy
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards that item before entirely waking up. This causes an incorrect visual for the player where the villager appears to still be asleep (laying down horizontally) while it pathfinds towards any applicable item(s).
Steps to Reproduce:
- Place down one or more beds
- Spawn in one or more villagers
- Drop an item on the ground that entice villagers
/give @p minecraft:carrot 1Observed Behavior:
The villager will move across the ground as if it is still asleep to pick up items.
Expected Behavior:
The villager should first wake up entirely (standing upright) before walking to the dropped item, or not detect items while asleep in the first place.
Video:
Code Analysis:
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
- The item pickup cooldown is empty
- It can start to pickup the item
- The desired item is close enough to the villager
- The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
public static <E extends LivingEntity> BehaviorControl<E> create(Predicate<E> startCondition, float speed, boolean requiresWalkTarget, int radius) { return BehaviorBuilder.create((context) -> { BehaviorBuilder<E, ? extends MemoryAccessor<? extends K1, WalkTarget>> behaviorbuilder = requiresWalkTarget ? context.registered(MemoryModuleType.WALK_TARGET) : context.absent(MemoryModuleType.WALK_TARGET); return context.group(context.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder, context.present(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM), context.registered(MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS)).apply(context, (lookTarget, walkTarget, nearestVisibleWantedItem, itemPickupCooldownTicks) -> { return (level, entity, time) -> { ItemEntity itementity = context.get(nearestVisibleWantedItem); if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) ) { WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true; } else { return false; } }; }); }); } }Two Possible Solutions:
- If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for whether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
if ( context.tryGet(itemPickupCooldownTicks).isEmpty() && startCondition.test(entity) && itementity.closerThan(entity, (double)radius) && entity.level().getWorldBorder().isWithinBounds(itementity.blockPosition()) //Fix && !entity.isSleeping() //Fix end )- If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
//Fix if (entity.isSleeping()) { entity.stopSleeping(); } //Fix end WalkTarget walktarget = new WalkTarget(new EntityTracker(itementity, false), speed, 0); lookTarget.set(new EntityTracker(itementity, true)); walkTarget.set(walktarget); return true;This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4
is duplicated by
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're already tracking this issue at MC-157464, so I will resolve and link this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Thank you for your report!
We're actually already tracking this issue in MC-157464, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Duplicate of MC-157464
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki
Thank you for your report!
However, we are already tracking this issue, and this report is a Duplicate of MC-157464, which is a report that has not been resolved yet.
If you want, you can upvote the parent ticket, and enable watching to receive any updates about it - if you believe you have any information that may be important for this issue, please leave a comment on the parent. Please also use the search function in the future to prevent duplicate reports.
Quick Links:
📓 Issue Guidelines – 🛠 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki
💬 Mojira Subreddit – 💬 Mojira Discord
Thank you for your report!
However, we are already tracking this issue, and this report is a Duplicate of MC-157464, which is a report that has not been resolved yet.
If you want, you can upvote the parent ticket, and enable watching to receive any updates about it - if you believe you have any information that may be important for this issue, please leave a comment on the parent. Please also use the search function in the future to prevent duplicate reports.
Quick Links:
📓 Issue Guidelines – 🛠 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki
💬 Mojira Subreddit – 💬 Mojira Discord
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Potentially a duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Duplicates MC-157464
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Duplicate of MC-157464.
Duplicate of MC-157464.
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Thank you for your report!
We're tracking this issue in MC-157464, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Still present in 20w16a
Still a problem in the latest snapshot...
Still present in 20w17a
still present in 20w18a
still present in 20w19a
still present in 20w20a
still present in 20w22a
still present in 1.16 Pre-release 3
Happens in 1.16.2 release.
Can confirm in 20w51a.
I've seen this in bedrock edition as well. A villager was just levitating out the wall, 2 blocks off the ground.
This can be reproduced in 21w18a.
reproducible on 1.17
Can confirm in 21w41a.
Can confirm in 1.18.1.
Affects 1.19
Can confirm in 1.19.4 and 23w18a
Issue description
When a villager detects a desired item while sleeping (such as carrots, bread, or beetroot), it will move towards the item before properly waking up, which causes an incorrect visual of the villager appearing to still be asleep while it pathfinds to items it wants to pick up.
Steps to Reproduce:
1. Place down one or more beds
2. Spawn in one or more villagers
3. Drop an item on the ground that entise villagers
Observed Results:
The villager will move across the ground as if it is still asleep to pick up items.
Expected Results:
The villager should first wake up entirely (standing upright) before walking to the dropped item.
Screenshots/Videos:
2019-07-19 22-58-59.mp4
Code analysis & Suggested fixes:
Here in the create() method of the GoToWantedItem class (which handles a villagers ai behavior to pathfind to desired items) it checks the following conditions for the villager and/or the desired item:
1. The item pickup cooldown is empty
2. It can start to pickup the item
3. The desired item is close enough to the villager
4. The villager and desired item are both within the level's world border
However, it does not check for whether the villager is asleep. The villager waking up is only ever executed from create() in WakeUp.
Two possible solutions:
1. If the villager should not be able to pathfind/collect the desired item until it has been woken up via the time turning to day, or being manually woken by a player input on it's bed, a check could be added for wether the villager is currently sleeping. If it is, do not try and pathfind. Like so:
2. If the villager should still be able to wake up as it does currently while sleeping, the villager should first properly and entirely wake up before pathfinding to collect the item. This could be done by adding a check to see if the villager is sleeping. If it is, wake up the villager first before executing the rest of the code.
This is how it looks compared with the new behavior in suggestion 2:
2023-07-19_20-02-36.mp4
Requesting ownership of this issue as the original poster "Jack Davies" has not updated the issue in 4 years, and this is their only post.
Can confirm in 1.20.1.
When I saw it happen I laughed so hard.
VillagerBread.mov
my sollution is get brightness
el aldeano se mueve estando dormido.