Skip to content

Architecture and Mixins

Dasik (Rifaditya) edited this page Aug 25, 2026 · 1 revision

๐Ÿ—๏ธ Architecture & Mixin Target Reference

This document outlines package architecture, test suites, and provides an exhaustive breakdown of all Java Mixin injection targets in Agrarian Reform.


๐Ÿ“ฆ Package Architecture Hierarchy

net.instantgratification.agrarianreform
โ”œโ”€โ”€ AgrarianGameRules.java         # 15 static GameRules & transient debug mode
โ”œโ”€โ”€ AgrarianReformFabric.java      # ModInitializer entrypoint, lifecycle hooks, 6D use-block
โ”œโ”€โ”€ client
โ”‚   โ””โ”€โ”€ AgrarianReformClient.java  # ClientModInitializer & morning moisture tint
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ AgrarianConfig.java        # Global JSON config template (Schema v2) & dirty-tracking
โ”‚   โ”œโ”€โ”€ ModMenuIntegration.java    # ModMenu API integration
โ”‚   โ””โ”€โ”€ YaclScreenHelper.java      # Isolated 3-tab YACL v3 client GUI builder
โ”œโ”€โ”€ continuum
โ”‚   โ”œโ”€โ”€ ContinuumData.java         # SavedDataType dimension persistence & 30-day pruning
โ”‚   โ”œโ”€โ”€ ContinuumManager.java      # ServerChunkEvents listeners & 5-crops/tick queue
โ”‚   โ””โ”€โ”€ CropScanner.java           # Sub-chunk palette pre-filtering & speed estimator
โ”œโ”€โ”€ crop
โ”‚   โ””โ”€โ”€ AgrarianCropRules.java     # O(1) universal crop auto-population & dynamic GameRules
โ”œโ”€โ”€ mixin
โ”‚   โ”œโ”€โ”€ BlockColorsMixin.java      # Client block color provider intercept
โ”‚   โ”œโ”€โ”€ BlockStateBaseMixin.java   # Random tick speedup/slowdown & max-age early-break
โ”‚   โ”œโ”€โ”€ CropBlockMixin.java        # Growth speed, rain spurt, rustle sound mixin
โ”‚   โ””โ”€โ”€ FarmlandBlockMixin.java    # Soft Step trample & Chebyshev concentric hydration
โ”œโ”€โ”€ util
โ”‚   โ”œโ”€โ”€ AgrarianTags.java          # Datapack tag keys (#c:crops, #soft_step_boots)
โ”‚   โ”œโ”€โ”€ GrowthHelper.java          # Concentric Chebyshev math, bare-foot trample logic
โ”‚   โ”œโ”€โ”€ ModVersionGuard.java       # Startup API class check guard (Knot resolution)
โ”‚   โ””โ”€โ”€ SoundHelper.java           # Audio debouncing & primitive Int2Long collections

Headless Test Architecture (src/test/java)

net.instantgratification.agrarianreform
โ”œโ”€โ”€ config
โ”‚   โ””โ”€โ”€ AgrarianConfigTest.java    # Schema stability, multiplier hierarchy, dirty tracking
โ””โ”€โ”€ continuum
    โ””โ”€โ”€ ContinuumMathTest.java     # Delta math, frozen scaling, 30-day pruning, Chebyshev geometry

๐ŸŽฏ Complete Mixin Target Table

Mixin Class Target Minecraft Class Annotation & Injection Point Purpose
FarmlandBlockMixin net.minecraft.world.level.block.FarmlandBlock @Inject(method = "fallOn", at = @At("HEAD"), cancellable = true) Intercepts trample with bare-foot fast-fail, Soft Step, and trample_immunity_players_only gating.
FarmlandBlockMixin net.minecraft.world.level.block.FarmlandBlock @Inject(method = "isNearWater", at = @At("HEAD"), cancellable = true) Replaces 4-block water check with expanding Concentric Chebyshev shells ($r=1 \to \text{maxRange}$, 3D $y \in [-1, 1]$) and pure water gating.
CropBlockMixin net.minecraft.world.level.block.CropBlock @ModifyReturnValue(method = "getGrowthSpeed", at = @At("RETURN")) Applies +10% polyculture biodiversity growth bonus for adjacent diverse crops.
CropBlockMixin net.minecraft.world.level.block.CropBlock @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) Pre-tick rain spurt acceleration (advances stage during rainfall).
CropBlockMixin net.minecraft.world.level.block.CropBlock @Inject(method = "randomTick", at = @At("RETURN")) Post-tick vitality Happy Villager green sparkles when stage changes.
CropBlockMixin net.minecraft.world.level.block.CropBlock @Inject(method = "entityInside", at = @At("HEAD")) Triggers crop rustle sound effect with debounced entity cooldowns.
BlockStateBaseMixin net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) Intercepts plant random ticks to scale speed per-crop and breaks early upon reaching max age.
BlockColorsMixin net.minecraft.client.color.block.BlockColors @Inject(method = "createDefault", at = @At("RETURN")) Registers morning moisture soil tinting (ticks 23000 to 2000).

๐Ÿ’พ World Storage vs Chunk NBT Architecture

Agrarian Reform strictly decouples its persistent timestamp data from individual chunk files:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      STORAGE SEPARATION                     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1. DIMENSION STORAGE (data/agrarian_reform_continuum.dat)   โ”‚
โ”‚    โ”œโ”€โ”€ ContinuumData (SavedDataType)                        โ”‚
โ”‚    โ””โ”€โ”€ Stores Map<ChunkPos (Long), UnloadTimestamp (Long)>  โ”‚
โ”‚    โ””โ”€โ”€ Auto-prunes entries older than 30 days on save       โ”‚
โ”‚    โ””โ”€โ”€ Zero impact on chunk NBT or chunk dirty flags        โ”‚
โ”‚                                                             โ”‚
โ”‚ 2. CHUNK STORAGE (region/r.X.Z.mca)                         โ”‚
โ”‚    โ”œโ”€โ”€ LevelChunk NBT (Block States, Tile Entities)         โ”‚
โ”‚    โ””โ”€โ”€ ChunkAccess.unsaved flag                             โ”‚
โ”‚    โ””โ”€โ”€ Only marked TRUE when setBlock() changes a state     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

See also: The Continuum (Offline Growth), Performance & Queue Throttling, and Developer Setup & Building.

Clone this wiki locally