Skip to content

Plant Registry and Crop Types

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

๐ŸŒฟ Plant Registry & Universal Crop Auto-Population

Agrarian Reform features a zero-configuration Universal Crop Auto-Population Engine (AgrarianCropRules.java) powered by an $O(1)$ fast-fail identity cache. Any vanilla or third-party modded crop is automatically discovered, registered for offline Continuum simulation, and granted dedicated GameRule multiplier tuning without requiring manual datapack configuration.


๐Ÿ” Dynamic Crop Discovery & Classification Engine

Whenever a block is ticked, loaded, or inspected, AgrarianCropRules evaluates the block using a 3-tier inspection pipeline:

                              BLOCK INSPECTION
                                     โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ–ผ                                 โ–ผ
         Known Cached Crop (O(1))            Uncached Block Type
                    โ”‚                                 โ”‚
                    โ–ผ                                 โ–ผ
           Return Multiplier              3-Tier Discovery Pipeline
                                          1. Class Hierarchy: CropBlock, SaplingBlock, BonemealableBlock
                                          2. Tag Membership: #c:crops, #minecraft:crops, #farmersdelight:wild_crops
                                          3. Property Inspection: BlockState with "age" IntegerProperty
                                                      โ”‚
                                                      โ–ผ (If Match Found)
                                          DYNAMIC REGISTRATION
                                          - Cache in DYNAMIC_CROPS Set
                                          - Register GameRule: agrarian_reform:crop_growth_multiplier_<id>
                                          - Mark AgrarianConfig dirty = true

๐Ÿ“Š Supported Plant Index & Mathematical Growth Stages

Category Java Class Target / Tag Vanilla Examples Average Ticks / Stage Continuum Catch-up Universal Bone Meal
Standard Crops CropBlock, #c:crops Wheat, Carrots, Potatoes, Beetroots $\sim 6,241\text{ ticks}$ โœ… Yes (Throttled Queue) Vanilla Native
Tall Stalks SugarCaneBlock, CactusBlock Sugar Cane, Cactus $1,365\text{ ticks}$ โœ… Yes (Height capped 3) โœ… Extended Support
Nether Flora NetherWartBlock Nether Wart $13,650\text{ ticks}$ โœ… Yes (Stage 0 $\to$ 3) โœ… Extended Support
Stem & Pod Crops CocoaBlock, SweetBerryBushBlock Cocoa Beans, Sweet Berries $6,825\text{ ticks}$ โœ… Yes (Stage 0 $\to$ 2/3) โœ… Extended Support
Vines & Foliage VineBlock Vines Variable โœ… Yes (Downward spread) โœ… Extended Support
Trees & Saplings SaplingBlock Oak, Spruce, Birch, Cherry Saplings $95,550\text{ ticks}$ โœ… Yes (Tree advance) Vanilla Native
Modded Agriculture Any #c:crops or AgeBlock Farmer's Delight, Mystical Agriculture Configurable โœ… Yes (Scaled delta) Dynamic / Extended

๐ŸŒพ Multiplier Resolution & Frozen State Hierarchy

Every crop's effective growth speed is calculated on-demand:

public static int getEffectiveGrowthMultiplier(Level level, Block block) {
    Identifier id = BuiltInRegistries.BLOCK.getKey(block);
    // 1. Check world-specific GameRule
    GameRule<Integer> dynamicRule = DYNAMIC_GAMERULES.get(id);
    if (dynamicRule != null && level instanceof ServerLevel serverLevel) {
        int val = DynamicGameRuleManager.getInt(serverLevel, dynamicRule);
        if (val > 0) return val;       // Positive override
        if (val == -1) return 0;       // -1 = Frozen (0% growth)
    }
    // 2. Fall back to Global Multiplier
    if (level instanceof ServerLevel serverLevel) {
        return DynamicGameRuleManager.getInt(serverLevel, AgrarianGameRules.GLOBAL_GROWTH_MULTIPLIER);
    }
    return 100;
}

๐Ÿ”„ Runtime Discovery & Mod Removal Resilience

  1. Mid-Game Dynamic Discovery:

    • AgrarianCropRules hooks into random ticks, Continuum chunk loading sweeps, and block interaction events.
    • When a previously unregistered modded crop is loaded or interacted with mid-session, it is discovered on-the-fly, registered into the $O(1)$ block cache, and given a dynamic GameRule with zero reload latency.
  2. Mod Removal & Zero-Crash Safety:

    • Dynamic crop rules and caches rely strictly on standard Minecraft Identifier strings (namespace:path) rather than direct compiled class types.
    • When a crop mod is uninstalled, AgrarianCropRules.isCropBlock safely ignores missing blocks, producing 0 ClassNotFoundException or NoClassDefFoundError crashes.
    • If missing blocks exist in saved chunk palettes, Vanilla replaces them with air/fallback blocks, while the corresponding GameRule remains dormant until the mod is re-added.

๐Ÿท๏ธ Datapack Tag Integration (AgrarianTags)

Datapack creators can also explicitly declare custom crops via standard conventional tags (#c:crops / #minecraft:crops) or the dedicated #agrarian_reform:continuum_plants tag:

{
  "replace": false,
  "values": [
    "#minecraft:crops",
    "#c:crops",
    "farmersdelight:cabbage",
    "farmersdelight:tomatoes",
    "farmersdelight:onions"
  ]
}

See also: The Continuum (Offline Growth), Global Growth Multiplier, and Configuration.

Clone this wiki locally