Skip to content

mcutils:fertilizable

Vanilla fertilizable block behavior.

Registering

Before you can use this component you need to register it.

js
import { system } from "@minecraft/server";
import { FertilizableComponent } from "@lpsmods/mc-utils";

system.beforeEvents.startup.subscribe((event) => {
  event.blockComponentRegistry.registerCustomComponent(FertilizableComponent.typeId, new FertilizableComponent());
});

Component

Options

NameTypeDefaultDescription
growth_statestring
max_stagenumber7
itemsstring[]["bone_meal"]

Examples

Crop

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_crop",
      "states": {
        "mcutils:growth": [0, 1, 2, 3, 4, 5, 6, 7]
      }
    },
    "components": {
      "mcutils:crop": {
        "growth_state": "mcutils:growth",
        "max_stage": 7
      },
      "mcutils:fertilizable": {
        "growth_state": "mcutils:growth",
        "max_stage": 7
      }
    }
  }
}

Bush

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_bush",
      "states": {
        "mcutils:growth": [0, 1, 2, 3]
      }
    },
    "components": {
      "minecraft:tick": {
        "interval_range": [0, 0]
      },
      "mcutils:bush": {
        "growth_state": "mcutils:growth",
        "loot_tables": ["2,lpsmods/harvest/bush_2", "3,lpsmods/harvest/bush_3"]
      },
      "mcutils:crop": {
        "growth_state": "mcutils:growth",
        "max_stage": 3
      },
      "mcutils:fertilizable": {
        "growth_state": "mcutils:growth",
        "max_stage": 3
      },
      "mcutils:viscosity": {
        "value":-5
      }
    }
  }
}

Sapling

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_sapling",
      "states": {
        "mcutils:age_bit": [0, 1]
      }
    },
    "components": {
      "mcutils:sapling": {
        "feature": "minecraft:oak_tree_feature"
      },
      "mcutils:fertilizable": {
        "growth_state": "mcutils:age_bit",
        "max_stage": 1
      }
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft