From 3c646fb0003843f290feb04b9ac9e6170079c70e Mon Sep 17 00:00:00 2001 From: Frost-ZX Date: Tue, 29 Apr 2025 23:41:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kubejs/constants.d.ts | 3 +++ kubejs/startup_scripts/wheat_plus.js | 26 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) 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({