-
Notifications
You must be signed in to change notification settings - Fork 0
The Continuum Offline Persistence
The Continuum is Agrarian Reform's flagship simulation engine. In vanilla Minecraft, crop growth stops completely the instant a chunk unloads or a server shuts down. The Continuum bridges this gap by persisting chunk unload timestamps and simulating real-time offline growth upon chunk reload without causing server lag spikes.
| Component | Specification |
|---|---|
| Engine Class | net.instantgratification.agrarianreform.continuum.ContinuumManager |
| Data Handler | net.instantgratification.agrarianreform.continuum.ContinuumData |
| Scanner Helper | net.instantgratification.agrarianreform.continuum.CropScanner |
| Saved Data ID |
agrarian_reform_continuum (Dimension-scoped SavedDataType) |
| Update Budget |
CROPS_PER_TICK = 5 (Global queue throttled) |
| Palette Pre-Filter |
section.hasOnlyAir() & section.maybeHas(AgrarianCropRules::isCropBlock)
|
| Stale Timestamp Ceiling | 30 Real Days ( |
| Supported Plants | Universal Crops, Sugar Cane, Cactus, Nether Wart, Cocoa, Vines, Saplings, Sweet Berries |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHUNK UNLOAD EVENT โ
โ ServerChunkEvents.CHUNK_UNLOAD records server game time pos โ
โ Saved to world storage via ContinuumData (SavedDataType) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ (Offline / World Unloaded Time Delta)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHUNK LOAD EVENT โ
โ ServerChunkEvents.CHUNK_LOAD retrieves unload timestamp โ
โ Calculates timeDelta = currentTick - unloadTick โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SUB-CHUNK PALETTE-GATED SCANNER โ
โ CropScanner skips empty air & non-crop sections (O(1)) โ
โ Queues matching plants into ConcurrentLinkedQueue โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ THROTTLED PER-CROP TICK PROCESSOR โ
โ ServerTickEvents.END_SERVER_TICK processes 5 crops/tick โ
โ Scales delta per-crop via AgrarianCropRules & updates state โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When a chunk loads, the raw time delta
Standard crop growth speed
The average game ticks required for a crop stage advancement
The simulated growth stages
Sugar cane and cacti tick at an average rate of 1,365 game ticks per age stage (
New block columns build upward up to the vanilla height limit of 3 blocks, resetting the apex block's age property to
| Plant Type | Ticks per Stage | Random Tick Probability | Max Stage / Limit |
|---|---|---|---|
| Nether Wart | 13,650 ticks (~11.37 min) | 10% per random tick | Age 3 |
| Cocoa Pods | 6,825 ticks (~5.68 min) | 20% per random tick | Age 2 |
| Sweet Berry Bush | 6,825 ticks (~5.68 min) | 20% per random tick | Age 3 |
| Vines | 13,650 ticks (~11.37 min) | 10% per random tick | Downward propagation |
| Saplings | 95,550 ticks (~79.6 min) | 1.4% per random tick | Stage 2 (Triggers tree growth) |
Rather than traversing every 3D block coordinate in loaded chunks (CropScanner executes palette-level filtering on each LevelChunkSection:
-
section.hasOnlyAir(): Skips completely empty sub-chunks in$0.0001\mu\text{s}$ . -
section.maybeHas(AgrarianCropRules::isCropBlock): Queries the sub-chunk's palette array directly. If no crop blocks exist in the palette, the entire 4,096-block volume is skipped immediately. This rejects 85% to 95% of non-agricultural sub-chunk sections with zero voxel iteration overhead.
To prevent unbounded growth of ContinuumData in massive, long-running multiplayer worlds where players explore millions of chunks, ContinuumData enforces a 30-day retention ceiling:
During periodic autosaves (ServerLifecycleEvents.BEFORE_SAVE), entries older than 30 real-time days are automatically pruned from memory and storage.
A core architectural strength of Agrarian Reform is that it operates in 100% harmony with Minecraft's native chunk saving optimization.
-
Decoupled World-Level Timestamping:
- Chunk unload timestamps are stored in
ContinuumData(see Architecture & Mixins), which is a dimension-levelSavedDataType(data/agrarian_reform_continuum.dat). - Unloading a chunk never touches or modifies chunk NBT, leaving the
LevelChunk.unsavedflag asfalse.
- Chunk unload timestamps are stored in
-
100% Read-Only Chunk Load Scanning:
- When a chunk loads,
CropScannerinspects block states usingsection.getBlockState(x, y, z)via palette pre-filters. - These queries are strictly read-only and never mark the chunk dirty.
- When a chunk loads,
-
Conditional Block Mutations:
- In
ContinuumManager.processCropUpdate,level.setBlock()is only invoked when a crop actually advances ($\Delta \text{age} > 0$ , or a tree grows, or cactus/sugar cane adds height). - If a chunk has no crops or the elapsed time delta was insufficient for a stage change,
setBlockis never called, and Minecraft completely skips writing the chunk to disk ($0\text{ Disk I/O}$ ).
- In
See also: Performance & Queue Throttling, Plant Registry & Universal Crops, and Architecture & Mixins.
๐ 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.
Agrarian Reform: The Living Earth | Instant Gratification & Vanilla Outsider Collections
Developed with โค๏ธ by Dasik (Rifaditya) | Licensed under GPLv3
๐พ Agrarian Reform Wiki
- The Continuum (Offline Growth)
- Plant Registry & Universal Crops
- Hydro-Dynamics & Irrigation
- Soil Resilience & Trample Logic
- Right-Click Harvest & Replant
- Polyculture & Biodiversity
- Seed Sowing & Grass Cultivation
- Universal Bone Meal
- Global Growth Multiplier
- Performance & Queue Throttling
- GameRules
- Commands
- Configuration
- Aesthetics & Ambient Feedback
- Advancements