Skip to content

mcutils:farmland

Vanilla farmland block behavior.

Registering

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

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

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

Component

Options

NameTypeDefaultDescription
moisture_statestringmcutils:moisture
blockstringdirt
max_moisturenumber7
moist_blockstringwater

Examples

Farmland

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_farmland",
      "states": {
        "mcutils:moisture": { "values": { "min": 0, "max": 7 } }
      }
    },
    "components": {
      "mcutils:farmland": {
        "moisture_state": "mcutils:moisture"
      }
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft