-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture and Mixins
🌐 Languages: 🇺🇸 English | 🇨🇳 简体中文 | 🇭🇰 繁體中文 | 🇷🇺 Русский | 🇪🇸 Español | 🇩🇪 Deutsch | 🇫🇷 Français | 🇧🇷 Português | 🇯🇵 日本語 | 🇮🇩 Bahasa Indonesia | 🇰🇷 한국어
📌 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.
True Sleep operates by intercepting the vanilla sleep lifecycle at the server level, replacing the immediate time leap with a synchronized tick acceleration loop governed by TimeWarpManager.
[ Player Enters Bed ]
│
▼
[ BedRule.Rule.test() Intercept ]
(Check truesleep:sleep_threshold)
│
▼
[ ServerLevel.tick() Sleep Check ]
(SleepStatus.areEnoughDeepSleeping())
│
+------------+------------+
│ │
[ Not All Sleeping ] [ All Sleeping (Enough) ]
│ │
▼ ▼
[ Initiate Wind-Down ] [ Engage Time Warp Engine ]
(15-tick Deceleration) │
├─► Set Physical Rate (ENGINE_TPS: 50 TPS)
├─► Compute Stride: round(VIRTUAL_TPS / ENGINE_TPS)
├─► Scale RANDOM_TICK_SPEED by Stride
├─► Multi-Tick Machines & Coupled Hoppers
├─► Freeze Mob AI / Age Farm Biology
├─► Apply Sleep Hunger Exhaustion
└─► Smooth Celestial Sun/Moon (Client Lerp)
│
▼
[ Destination Arrival ]
(Cycle Dist < 20 Ticks)
│
▼
[ Snap Monotonic Clock ]
(Set Time to WAKE_TIME: 0)
│
▼
[ Wake Up All Players ]
| Mixin Class | Target Class | Injection Point | Method Hook | Purpose |
|---|---|---|---|---|
BedRuleMixin |
net.minecraft.world.attribute.BedRule$Rule |
@At("HEAD") (Cancellable) |
test(Level) |
Overrides WHEN_DARK bed check against truesleep:sleep_threshold. |
ServerLevelMixin |
net.minecraft.server.level.ServerLevel |
@At("INVOKE") (Redirect) |
areEnoughSleeping / areEnoughDeepSleeping
|
Returns false to suppress vanilla instant skip. |
ServerLevelMixin |
net.minecraft.server.level.ServerLevel |
@At("TAIL") |
tick(BooleanSupplier) |
Checks sleep conditions and drives TimeWarpManager.tick(). |
LevelMixin |
net.minecraft.world.level.Level |
@At("INVOKE") (Redirect) |
TickingBlockEntity.tick() |
Multi-ticks accelerated machines and coupled hoppers by stride. |
MobMixin |
net.minecraft.world.entity.Mob |
@At("HEAD") (Cancellable) |
tick() |
Cancels mob movement/AI if frozen; executes biological aging. |
EntityMixin |
net.minecraft.world.entity.Entity |
@At("HEAD") |
baseTick() |
Refills air supply to prevent drowning when drown_immunity is active. |
LivingEntityMixin |
net.minecraft.world.entity.LivingEntity |
@At("HEAD") |
baseTick() |
Ages active potion effects by stride - 1 ticks. |
MobEffectInstanceMixin |
net.minecraft.world.effect.MobEffectInstance |
Interface Injection | truesleep$ageEffect(int) |
Recursively ages hidden potion effects without recursion bugs. |
VibrationSystemListenerMixin |
net.minecraft.world.level.gameevent.vibrations.VibrationSystem$Listener |
@At("HEAD") (Cancellable) |
handleGameEvent(...) |
Suppresses Warden acoustic vibrations during time warp. |
client.HudMixin |
net.minecraft.client.gui.Hud |
@At("HEAD") (Cancellable) |
extractSleepOverlay(...) |
Cancels the vanilla black fade screen overlay during sleep. |
client.SkyRendererMixin |
net.minecraft.client.renderer.SkyRenderer |
@At("TAIL") |
extractRenderState(...) |
Lerps sunAngle with factor |
During high-speed time warps (
True Sleep utilizes static concurrent lock-free caches across all hot paths:
-
truesleep$unfreezeCache: Caches dynamic GameRule instances perEntityType<?>to eliminate string allocations. -
truesleep$WORKER_CACHE: Caches tag containment results for#truesleep:worker_mobs. -
truesleep$PRODUCTION_MACHINE_CACHE: Caches block entity type matching for#truesleep:accelerated_machines. -
TimeWarpManagerGameRule field caching: Fetches GameRule boolean states once per server tick rather than querying rules inside entity loops.
Vanilla Outsider: True Sleep is open source software licensed under the GNU General Public License v3.0 (GPLv3).
Authored by Dasik (Rifaditya). Designed under the Vanilla Outsider (VO) philosophy.
> 📌 **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.
- Home
- Version Compatibility
- Developer Setup & Building
- Architecture & Mixins
- Time Warp & Acceleration
- Machine & Hopper Acceleration
- Mob Stasis & Biological Aging
- Sleep Hunger & Drown Immunity
- Celestial Sky & Cinematics
- GameRules Reference
- Brigadier Commands
- Configuration & GUI
- Troubleshooting & FAQ
- API & Data Tags
🇨🇳 简体中文 (Simplified Chinese)
🇭🇰 繁體中文 (Traditional Chinese)
🇷🇺 Русский (Russian)
- Главная и Обзор
- Совместимость версий и Матрица жизненного цикла
- Руководство для разработчиков и Сборка
- Архитектура и Анализ Mixin
- Искривление времени и Ускорение тиков
- Ускорение машин и воронок
- Стазис мобов и Биологическое старение
- Расход голода во сне и Иммунитет к утоплению
- Плавность небесных тел и Кинематографичное небо
- Справочник игровых правил GameRules
- Набор команд Brigadier (/truesleep)
- Конфигурация и Графический интерфейс (GUI)
- Устранение неполадок и Частые вопросы (FAQ)
- API и Теги данных
🇪🇸 Español (Spanish)
- Inicio y Visión General
- Compatibilidad de versiones y Ciclo de vida
- Guía de desarrollo y Compilación
- Arquitectura y Análisis de Mixins
- Motor de Curvatura Temporal y Aceleración de Ticks
- Aceleración de Máquinas y Tolvas
- Éxtasis de Mobs y Envejecimiento Biológico
- Hambre al Dormir e Inmunidad al Ahogamiento
- Suavizado Celestial y Cielo Cinemático
- Referencia de Reglas de Juego GameRules
- Comandos Brigadier (/truesleep)
- Configuración e Interfaz Gráfica (GUI)
- Resolución de Problemas y Preguntas Frecuentes
- API y Etiquetas de Datos
🇩🇪 Deutsch (German)
- Startseite & Übersicht
- Versionskompatibilität & Lebenszyklus-Matrix
- Entwickler-Setup & Build-Anleitung
- Architektur & Mixin-Analyse
- Zeitraffer-Engine & Tick-Beschleunigung
- Maschinen- & Trichter-Beschleunigung
- Mob-Stasis & Biologische Farmalterung
- Schlaf-Hunger & Ertrinkungsimmunität
- Himmelskörper-Glättung & Kinematik
- GameRules-Referenz
- Brigadier-Befehlssuite (/truesleep)
- Konfiguration & Grafische Benutzeroberfläche (GUI)
- Fehlerbehebung & Häufige Fragen (FAQ)
- API & Datengesteuerte Tags
🇫🇷 Français (French)
- Accueil et Aperçu
- Compatibilité des versions et Cycle de vie
- Configuration développeur et Compilation
- Architecture et Analyse des Mixins
- Moteur Temporel et Accélération des Ticks
- Accélération des Machines et Entonnoirs
- Stase des Créatures et Vieillissement Biologique
- Faim du Sommeil et Immunité à la Noyade
- Lissage Céleste et Ciel Cinématique
- Référence des Règles de Jeu GameRules
- Commandes Brigadier (/truesleep)
- Configuration et Interface Graphique (GUI)
- Dépannage et Foire Aux Questions (FAQ)
- API et Balises de Données
🇧🇷 Português do Brasil (Portuguese)
- Início e Visão Geral
- Compatibilidade de Versões e Ciclo de Vida
- Guia de Desenvolvimento e Compilação
- Arquitetura e Análise de Mixins
- Motor de Dobra Temporal e Aceleração de Ticks
- Aceleração de Máquinas e Funis
- Estase de Mobs e Envelhecimento Biológico
- Fome ao Dormir e Imunidade a Afogamento
- Suavização Celeste e Céu Cinemático
- Referência de Regras de Jogo GameRules
- Comandos Brigadier (/truesleep)
- Configuração e Interface Gráfica (GUI)
- Solução de Problemas e Perguntas Frequentes (FAQ)
- API e Tags de Dados
🇯🇵 日本語 (Japanese)
🇮🇩 Bahasa Indonesia (Indonesian)
- Beranda & Ringkasan
- Kompatibilitas Versi & Matriks Siklus Hidup
- Panduan Pengembang & Kompilasi Gradle
- Arsitektur & Analisis Mixin
- Mesin Time Warp & Akselerasi Tick
- Akselerasi Mesin & Hopper
- Stasis Mob & Penuaan Biologis Peternakan
- Pengurasan Lapar Tidur & Imunitas Tenggelam
- Penghalusan Langit & Sinematik Klien
- Referensi GameRules Bernamespace
- Rangkaian Perintah Brigadier (/truesleep)
- Konfigurasi & Antarmuka Grafis (GUI)
- Pemecahan Masalah & Tanya Jawab (FAQ)
- API & Tag Berbasis Data