🏗️ Architecture et référence des injections Mixin
Ce document présente l'architecture des paquets, les tests unitaires et la liste exhaustive des injections Mixin de Agrarian Reform.
📦 Hiérarchie des packages et du code
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 collectionsArchitecture de tests automatisés sans interface (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🎯 Tableau complet des cibles Mixin
| Classe Mixin | Classe cible Minecraft | Annotation et point d'injection | Rôle |
|---|---|---|---|
FarmlandBlockMixin | net.minecraft.world.level.block.FarmlandBlock | @Inject(method = "fallOn", at = @At("HEAD"), cancellable = true) | Intercepte le piétinement avec vérification de pieds nus, Pas feutré et règles d'immunité. |
FarmlandBlockMixin | net.minecraft.world.level.block.FarmlandBlock | @Inject(method = "isNearWater", at = @At("HEAD"), cancellable = true) | Remplace la détection standard par des cercles de Tchebychev ($r=1 \to \text{maxRange}$) et eau pure. |
CropBlockMixin | net.minecraft.world.level.block.CropBlock | @ModifyReturnValue(method = "getGrowthSpeed", at = @At("RETURN")) | Applique un bonus de croissance de +10% pour la polyculture et biodiversité adjacente. |
CropBlockMixin | net.minecraft.world.level.block.CropBlock | @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) | Accélération de la croissance sous la pluie avant le tick standard. |
CropBlockMixin | net.minecraft.world.level.block.CropBlock | @Inject(method = "randomTick", at = @At("RETURN")) | Émission d'étincelles vertes de villageois heureux après changement de stade. |
CropBlockMixin | net.minecraft.world.level.block.CropBlock | @Inject(method = "entityInside", at = @At("HEAD")) | Déclenche des bruits de froissement avec délai de récupération par entité. |
BlockStateBaseMixin | net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase | @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) | Intercepte les ticks pour moduler la vitesse et s'arrête à pleine maturité. |
BlockColorsMixin | net.minecraft.client.color.block.BlockColors | @Inject(method = "createDefault", at = @At("RETURN")) | Teinte la terre labourée le matin pour simuler la rosée (ticks 23000 à 2000). |
💾 Stockage du monde vs architecture NBT des chunks
Agrarian Reform découple totalement l'enregistrement des horodatages des fichiers de chunks :
┌─────────────────────────────────────────────────────────────┐
│ 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: Le Continuum (Croissance hors-ligne), Performances et régulation de file d'attente, and Environnement de développement et compilation.
