Skip to content

SaplingComponent Class

Makes this block behave like a Sapling

Extends

Parameters

NameTypeDefaultDescription
generatorSaplingGeneratorThe feature to generate a tree
stateNameStringmorefood:stageThe name of the growth state

Methods

onPlayerInteract

onRandomTick

generate

canGrow

grow

Example

js
var generator = new SaplingGenerator(
  undefined,
  undefined,
  undefined,
  new ConfiguredFeature("morefoodtree:apple_tree"),
  undefined,
  undefined,
  undefined
);
new SaplingComponent(generator, "stage");
json
{
  "format_version": "1.21.20",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_sapling_block"
    },
    "component": {
      "minecraft:custom_components": ["wiki:custom_sapling"]
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft