Skip to content

mcutils:sapling

Vanilla sapling block behavior.

Registering

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

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

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

Component

Options

NameTypeDefaultDescription
growth_statestring
max_stagestring2
featurestringminecraft:oak_tree_feature

Examples

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