diff --git a/kubejs/constants.d.ts b/kubejs/constants.d.ts index 188a2dc..771a4fd 100644 --- a/kubejs/constants.d.ts +++ b/kubejs/constants.d.ts @@ -165,6 +165,9 @@ declare global { /** 方块注册事件 */ type _RegistryBlock = $Block; + /** 配置选项 */ + type _SetBlockPropsOpts = SetBlockPropsOpts; + const global: { /** diff --git a/kubejs/startup_scripts/wheat_plus.js b/kubejs/startup_scripts/wheat_plus.js index 83c975d..5380b87 100644 --- a/kubejs/startup_scripts/wheat_plus.js +++ b/kubejs/startup_scripts/wheat_plus.js @@ -1194,8 +1194,8 @@ function regBlockCommon(event) { let isType1 = ['', 'cardinal'].indexOf(blockType > -1); let isType2 = ['fence', 'slab', 'stairs', 'wall'].indexOf(blockType) > -1; - // 设置基础属性(通用) - setBlockProps(block, { + /** @type {_SetBlockPropsOpts} */ + let commonProps = { displayName: blockLabel, modelPath: modelPath1 ? { blockName: blockName, @@ -1205,31 +1205,37 @@ function regBlockCommon(event) { textureAll: textureAllPath1, textureSide: textureSidePath1, textureUpDown: textureUpDownPath1, - }); + }; - // 设置基础属性(特殊) + /** @type {_SetBlockPropsOpts} */ + let specialProps = {}; + + // 处理基础属性 if (isType1) { if (blockBox) { - setBlockProps(block, { + specialProps = { boxConfig: blockBox, boxType: 'custom', isSolid: false, renderType: 'cutout', - }); + }; } else { - setBlockProps(block, { + specialProps = { boxConfig: null, boxType: 'full', isSolid: true, renderType: 'solid', - }); + }; } } else if (isType2) { - setBlockProps(block, { + specialProps = { renderType: 'cutout_mipped', - }); + }; } + // 设置基础属性 + setBlockProps(block, Object.assign(commonProps, specialProps)); + // 生成方块状态 if (blockState) { JSON_ASSETS.push({