UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

46 lines (45 loc) 1.49 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.CropBlockTrait = void 0; const ContentTraits_1 = require("./ContentTraits"); /** * Crop - can grow over time. */ class CropBlockTrait extends ContentTraits_1.BlockContentTrait { get id() { return "crop"; } getData(config) { const growthStages = config?.growthStages ?? 7; return { id: "crop", displayName: "Crop", description: "Can grow over time", category: "special", components: { "minecraft:collision_box": false, "minecraft:tick": { interval_range: [10, 20], looping: true, }, "minecraft:random_ticking": { on_tick: { event: "grow", }, }, }, properties: { "custom:growth_stage": Array.from({ length: growthStages + 1 }, (_, i) => i), }, permutations: Array.from({ length: growthStages + 1 }, (_, i) => ({ condition: `q.block_state('custom:growth_stage') == ${i}`, components: { "minecraft:geometry": `geometry.crop_stage_${i}`, }, })), }; } } exports.CropBlockTrait = CropBlockTrait;