Skip to content

CropComponent Class

Makes this block behave like Crops

Extends

Parameters

NameTypeDefaultDescription
stateNameStringmorefood:stageThe name of the growth state
maxStageNumber7The max growth stage

Methods

onPlayerInteract

onRandomTick

canGrow

getGrowthAmount

applyGrowth

grow

Example

js
new CropComponent("stage", 7);
json
{
  "format_version": "1.21.20",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_crop"
    },
    "component": {
      "minecraft:custom_components": ["morefood:crop"]
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft