-
Notifications
You must be signed in to change notification settings - Fork 0
Performance and Queue Throttling
Agrarian Reform is engineered for high-performance servers, handling massive agricultural mega-farms without inducing lag spikes, watchdog timeouts, or tick drops.
| Property | Value |
|---|---|
| Global Throttling Budget | CROPS_PER_TICK = 5 |
| Queue Implementation | java.util.concurrent.ConcurrentLinkedQueue |
| Sub-Chunk Palette Filter |
hasOnlyAir() & maybeHas(AgrarianCropRules::isCropBlock)
|
| Hydration Search | Concentric Chebyshev shells ( |
| Footwear Optimization | Bare-foot fast-fail ( |
| Diagnostics Logging | Static SLF4J loggers gated behind transient agrarian_reform:debug_mode GameRule |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHUNK LOAD SCAN EVENT โ
โ Palette Pre-Filter: section.hasOnlyAir() & maybeHas() โ
โ Rejects 85%+ empty non-crop sub-chunks in O(1) time โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ConcurrentLinkedQueue<CropUpdateTask> โ
โ Lock-free thread-safe task buffer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ServerTickEvents.END_SERVER_TICK โ
โ Polls at most 5 tasks per tick โ
โ Updates block states smoothly across consecutive game ticks โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
If a player unloads a farm containing 10,000 crops for 24 hours, applying 10,000 instant block updates in a single tick would trigger a severe server freeze (1000+ ms tick latency).
By distributing updates at a lock-free 5 crops per tick:
- The server maintains a rock-solid 20 TPS during chunk loading.
- The 10,000 crops update smoothly across 2,000 ticks (~100 seconds) in the background without affecting gameplay or causing network lag spikes.
-
Sub-Chunk Palette Gating:
- Instead of scanning
$98,304$ block coordinates per chunk,CropScannerqueries sub-chunk palettes directly. If a 4,096-block sub-chunk contains no agricultural blocks, the entire section is skipped in$0.0001\mu\text{s}$ .
- Instead of scanning
-
Concentric Chebyshev Hydration Sweeps:
- Farmland hydration evaluates outward square shells (
$r = 1 \to \text{maxRange}$ ). Since most farmland has water immediately adjacent ($r=1$ ), the check fast-fails immediately on the first shell instead of evaluating all$17 \times 17$ positions.
- Farmland hydration evaluates outward square shells (
-
Bare-Foot Trample Fast-Fail:
- When an entity steps on farmland,
GrowthHelper.hasSoftStep()first verifies if the feet equipment slot is empty. If empty, expensive NBT enchantment iterations are completely bypassed.
- When an entity steps on farmland,
-
Max-Age Early-Break:
- During high-multiplier growth loops, ticks immediately break the moment a crop reaches maximum age, eliminating wasted block state mutations.
Beyond tick CPU budgets, Agrarian Reform protects disk I/O bandwidth and SSD storage wear:
-
Read-Only Chunk Surface Sweeps:
- Initial chunk load scans are 100% read-only and never call
LevelChunk.setBlockState(), keeping the chunk's internalunsavedflag asfalse.
- Initial chunk load scans are 100% read-only and never call
-
Selective Block Mutation:
- In
ContinuumManager.processCropUpdate,level.setBlock()is only executed when the calculated stage advancement$\Delta \text{age} > 0$ . - Chunks where no crops advanced (e.g. fully grown crops, empty fields, or insufficient offline time) never execute a block update.
- In
-
Vanilla Fast-Fail Save Protection:
- Because untouched chunks remain
unsaved == false, Minecraft's internalChunkMap.save()fast-fails and skips NBT serialization, zlib compression, and.mcasector writes completely ($0\text{ Disk I/O}$ ).
- Because untouched chunks remain
See also: The Continuum (Offline Growth), Hydro-Dynamics & Irrigation, 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