Skip to content

Custom Components

Registering Components

Before you can use @lpsmods/mc-utils components in your block or item JSON, they must first be registered with Minecraft’s component registries. This is done during the startup event.

ts
import { system } from "@minecraft/server";
import { BushComponent, AxeComponent } from "@lpsmods/mc-utils";

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

  event.itemComponentRegistry.registerCustomComponent(AxeComponent.typeId, new AxeComponent());
});

Not associated with or approved by Mojang Studios or Microsoft