fix: 优化方块属性设置逻辑
This commit is contained in:
3
kubejs/constants.d.ts
vendored
3
kubejs/constants.d.ts
vendored
@@ -165,6 +165,9 @@ declare global {
|
|||||||
/** 方块注册事件 */
|
/** 方块注册事件 */
|
||||||
type _RegistryBlock = $Block;
|
type _RegistryBlock = $Block;
|
||||||
|
|
||||||
|
/** 配置选项 */
|
||||||
|
type _SetBlockPropsOpts = SetBlockPropsOpts;
|
||||||
|
|
||||||
const global: {
|
const global: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1194,8 +1194,8 @@ function regBlockCommon(event) {
|
|||||||
let isType1 = ['', 'cardinal'].indexOf(blockType > -1);
|
let isType1 = ['', 'cardinal'].indexOf(blockType > -1);
|
||||||
let isType2 = ['fence', 'slab', 'stairs', 'wall'].indexOf(blockType) > -1;
|
let isType2 = ['fence', 'slab', 'stairs', 'wall'].indexOf(blockType) > -1;
|
||||||
|
|
||||||
// 设置基础属性(通用)
|
/** @type {_SetBlockPropsOpts} */
|
||||||
setBlockProps(block, {
|
let commonProps = {
|
||||||
displayName: blockLabel,
|
displayName: blockLabel,
|
||||||
modelPath: modelPath1 ? {
|
modelPath: modelPath1 ? {
|
||||||
blockName: blockName,
|
blockName: blockName,
|
||||||
@@ -1205,31 +1205,37 @@ function regBlockCommon(event) {
|
|||||||
textureAll: textureAllPath1,
|
textureAll: textureAllPath1,
|
||||||
textureSide: textureSidePath1,
|
textureSide: textureSidePath1,
|
||||||
textureUpDown: textureUpDownPath1,
|
textureUpDown: textureUpDownPath1,
|
||||||
});
|
};
|
||||||
|
|
||||||
// 设置基础属性(特殊)
|
/** @type {_SetBlockPropsOpts} */
|
||||||
|
let specialProps = {};
|
||||||
|
|
||||||
|
// 处理基础属性
|
||||||
if (isType1) {
|
if (isType1) {
|
||||||
if (blockBox) {
|
if (blockBox) {
|
||||||
setBlockProps(block, {
|
specialProps = {
|
||||||
boxConfig: blockBox,
|
boxConfig: blockBox,
|
||||||
boxType: 'custom',
|
boxType: 'custom',
|
||||||
isSolid: false,
|
isSolid: false,
|
||||||
renderType: 'cutout',
|
renderType: 'cutout',
|
||||||
});
|
};
|
||||||
} else {
|
} else {
|
||||||
setBlockProps(block, {
|
specialProps = {
|
||||||
boxConfig: null,
|
boxConfig: null,
|
||||||
boxType: 'full',
|
boxType: 'full',
|
||||||
isSolid: true,
|
isSolid: true,
|
||||||
renderType: 'solid',
|
renderType: 'solid',
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
} else if (isType2) {
|
} else if (isType2) {
|
||||||
setBlockProps(block, {
|
specialProps = {
|
||||||
renderType: 'cutout_mipped',
|
renderType: 'cutout_mipped',
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置基础属性
|
||||||
|
setBlockProps(block, Object.assign(commonProps, specialProps));
|
||||||
|
|
||||||
// 生成方块状态
|
// 生成方块状态
|
||||||
if (blockState) {
|
if (blockState) {
|
||||||
JSON_ASSETS.push({
|
JSON_ASSETS.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user