Fix AI and sleep positioning: stuck detection, cooldown, movement tracking, bed break handling, double rotation, sleep restore on load

This commit is contained in:
2026-06-14 01:23:20 +03:00
parent 15a31b1aec
commit dcd402eebf
13 changed files with 613 additions and 39 deletions
@@ -106,14 +106,18 @@ public class EllieSleepGoal extends Goal {
public boolean canContinueToUse() {
if (ellie.isSleeping()) {
if (sleepTimer >= MAX_SLEEP_TICKS) return false;
if (ellie.level().isDay()) return false;
if (ellie.hurtTime > 10) return false;
if (bedPos != null) {
BlockState state = ellie.level().getBlockState(bedPos);
if (!state.isBed(ellie.level(), bedPos, null)) return false;
if (ellie.distanceToSqr(Vec3.atCenterOf(bedPos)) > 16.0) return false;
}
return true;
}
if (bedPos == null) return false;
if (ellie.hurtTime > 10) return false;
if (ellie.level().isDay() && !ellie.isTired()) return false;
if (!ellie.level().isNight() && !ellie.isTired()) return false;
return true;
}