@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
35 lines (34 loc) • 1.22 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariableLightBlockTrait = void 0;
const ContentTraits_1 = require("./ContentTraits");
/**
* Variable light - light level can change.
*/
class VariableLightBlockTrait extends ContentTraits_1.BlockContentTrait {
get id() {
return "variable_light";
}
getData(config) {
const maxLightLevel = config?.maxLightLevel ?? 15;
return {
id: "variable_light",
displayName: "Variable Light",
description: "Light level can change",
category: "special",
components: {
"minecraft:light_emission": 0,
},
properties: {
"custom:light_level": Array.from({ length: maxLightLevel + 1 }, (_, i) => i),
},
permutations: Array.from({ length: maxLightLevel + 1 }, (_, i) => ({
condition: `q.block_state('custom:light_level') == ${i}`,
components: { "minecraft:light_emission": i },
})),
};
}
}
exports.VariableLightBlockTrait = VariableLightBlockTrait;