🐑 Mob Stasis & Biological Aging
📌 Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
🛡️ Mob Stasis (Freezing)
During hyperspeed time warps, fast-moving hostile mobs (Zombies, Skeletons, Creepers) could overwhelm bases or attack sleeping players before they could react.
True Sleep introduces Mob Stasis: When truesleep:freeze_mobs is enabled (default: ON), the AI navigation, pathfinding, and attack goals of mobs are paused during sleep.
Worker Mob Exemption
Villagers and Allays are classified under #truesleep:worker_mobs. By default, truesleep:freeze_workers is set to OFF (false), allowing villagers to wander to bed or work stations smoothly during sunset.
🌾 Biological Farm Aging
Even while a mob's movement AI is frozen in stasis, its internal biological clock continues ticking via BiologicalStasisHelper:
1. Baby Animal Growth & Breeding Cooldown
Baby cows, sheep, pigs, chickens, and wolves age up during sleep:
if (mob instanceof AgeableMob ageable) {
int currentAge = ageable.getAge();
if (ageable.canAgeUp()) {
ageable.setAge(Math.min(0, currentAge + strideTicks));
} else if (currentAge > 0) {
ageable.setAge(Math.max(0, currentAge - strideTicks));
}
}2. Chicken Egg Laying Timers
Chicken egg timers decrement by strideTicks, allowing egg collection farms to operate seamlessly overnight: $$\text{eggTime} = \max(1, \text{eggTime} - \text{strideTicks})$$
3. Sheep Wool Regrowth (Natural Grazing Simulation)
Sheared sheep normally need to perform an eating animation on grass to regrow wool. In stasis, True Sleep simulates grass consumption mathematically:
$$\text{grazeChance} = \min\left(1.0, \frac{\text{strideTicks}}{1000.0}\right)$$
If a sheared sheep is standing on a minecraft:grass_block, it has a probability $\text{grazeChance}$ per stride to convert the block to minecraft:dirt and restore its wool coat (sheep.setSheared(false)).
🧪 Potion Effect Progression
Active potion effects on all living entities progress accurately during sleep:
- Positive buffs (Strength, Regeneration) and negative debuffs (Poison, Wither) decrement duration by
strideTicks. - True Sleep uses duck typing (
MobEffectInstanceExtensions) to ensure cascaded hidden effects (such as potion effect upgrades) expire cleanly without infinite loops.
🎛️ Controlling GameRules
truesleep:freeze_mobs(Default:true): Pauses hostile and ambient mob movement.truesleep:freeze_workers(Default:false): Pauses villagers and allays.truesleep:biological_aging(Default:true): Enables baby growth, egg timers, and wool regrowth.truesleep:unfreeze_<namespace>_<path>: Individual unfreeze toggle for any entity type.
