Skip to content

mcutils:leaves

Vanilla leaves block behavior.

Registering

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

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

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

Requirements

Component

Options

NameTypeDefaultDescription
distance_statestringmcutils:distance
persistent_statestringmcutils:persistent
delaynumber0

Examples

Leaves

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_leaves",
      "states": {
        "mcutils:distance": [1, 2, 3, 4, 5, 6, 7],
        "mcutils:persistent": [false, true]
      },
      "traits": {
        "minecraft:placement_position": {
          "enabled_states": ["minecraft:vertical_half"]
        }
      }
    },
    "components": {
      "minecraft:tick": {
        "interval_range": [0, 0],
        "looping": true
      },
      "mcutils:leaves": {
        "distance_state": "mcutils:distance",
        "persistent_state": "mcutils:persistent",
        "delay": 60
      }
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft