1
0

feat: 添加黑色栅栏、白色栅栏方块

This commit is contained in:
2025-04-28 22:52:37 +08:00
parent b63e0ca390
commit 0bd0c855fb
7 changed files with 284 additions and 54 deletions

View File

@@ -248,6 +248,30 @@ function regBlockBuildingAndFurniture(event) {
texture: '',
type: 'cardinal',
},
{
name: 'building_fence_c_black',
label: '黑色栅栏',
blockstate: getFenceBlockstateJson(
`${P_BLOCK}/building/building_fence_c_black_post`,
`${P_BLOCK}/building/building_fence_c_black_side`,
),
box: null,
model: '',
texture: 'minecraft:block/black_concrete',
type: 'fence',
},
{
name: 'building_fence_c_white',
label: '白色栅栏',
blockstate: getFenceBlockstateJson(
`${P_BLOCK}/building/building_fence_c_white_post`,
`${P_BLOCK}/building/building_fence_c_white_side`,
),
box: null,
model: '',
texture: 'minecraft:block/white_concrete',
type: 'fence',
},
{
name: 'building_ground_a',
label: '地面(红色混凝土 + 磨制闪长岩)',
@@ -653,6 +677,7 @@ function regBlockBuildingAndFurniture(event) {
let blockLabel = config.label;
let blockName = config.name;
let blockId = `${MOD_ID}:${blockName}`;
let blockState = config.blockstate;
let blockType = config.type;
let block = null;
@@ -661,7 +686,11 @@ function regBlockBuildingAndFurniture(event) {
let modelPath1 = modelPath0 ? `${P_BLOCK}/${modelPath0}` : '';
let texturePath0 = config.texture;
let texturePath1 = texturePath0 ? `${P_BLOCK}/${texturePath0}` : '';
let texturePath1 = texturePath0 || '';
if (texturePath0 && !texturePath0.includes(':')) {
texturePath1 = `${P_BLOCK}/${texturePath0}`;
}
if (blockType) {
block = event.create(blockId, blockType);
@@ -672,41 +701,49 @@ function regBlockBuildingAndFurniture(event) {
TAB_BLOCKS_ITEMS.push(blockId);
// 设置基础属性
if (blockBox) {
if (blockType === '' || blockType === 'cardinal') {
if (blockBox) {
setBlockProps(block, {
boxConfig: blockBox,
boxType: 'custom',
displayName: blockLabel,
isSolid: false,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'cutout',
textureAll: texturePath1,
});
} else {
setBlockProps(block, {
boxConfig: null,
boxType: 'full',
displayName: blockLabel,
isSolid: true,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'solid',
textureAll: texturePath1,
});
}
} else if (blockType === 'fence') {
setBlockProps(block, {
boxConfig: blockBox,
boxType: 'custom',
displayName: blockLabel,
isSolid: false,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'cutout',
textureAll: texturePath1,
});
} else {
setBlockProps(block, {
boxConfig: null,
boxType: 'full',
displayName: blockLabel,
isSolid: true,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'solid',
renderType: 'cutout_mipped',
textureAll: texturePath1,
});
}
// 生成方块状态
if (config.blockstate) {
if (blockState) {
JSON_ASSETS.push({
path: `${P_BLOCK_STATE}/${blockName}`,
data: config.blockstate,
data: blockState,
});
}
@@ -1526,6 +1563,7 @@ function regBlockOtherBasic(event) {
let blockLabel = config.label;
let blockName = config.name;
let blockId = `${MOD_ID}:${blockName}`;
let blockState = config.blockstate;
let blockType = config.type;
let block = null;
@@ -1534,7 +1572,11 @@ function regBlockOtherBasic(event) {
let modelPath1 = modelPath0 ? `${P_BLOCK}/${modelPath0}` : '';
let texturePath0 = config.texture;
let texturePath1 = texturePath0 ? `${P_BLOCK}/${texturePath0}` : '';
let texturePath1 = texturePath0 || '';
if (texturePath0 && !texturePath0.includes(':')) {
texturePath1 = `${P_BLOCK}/${texturePath0}`;
}
if (blockType) {
block = event.create(blockId, blockType);
@@ -1545,41 +1587,49 @@ function regBlockOtherBasic(event) {
TAB_BLOCKS_ITEMS.push(blockId);
// 设置基础属性
if (blockBox) {
if (blockType === '' || blockType === 'cardinal') {
if (blockBox) {
setBlockProps(block, {
boxConfig: blockBox,
boxType: 'custom',
displayName: blockLabel,
isSolid: false,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'cutout',
textureAll: texturePath1,
});
} else {
setBlockProps(block, {
boxConfig: null,
boxType: 'full',
displayName: blockLabel,
isSolid: true,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'solid',
textureAll: texturePath1,
});
}
} else if (blockType === 'fence') {
setBlockProps(block, {
boxConfig: blockBox,
boxType: 'custom',
displayName: blockLabel,
isSolid: false,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'cutout',
textureAll: texturePath1,
});
} else {
setBlockProps(block, {
boxConfig: null,
boxType: 'full',
displayName: blockLabel,
isSolid: true,
modelPath: modelPath1 ? {
blockName: blockName,
blockNamespace: MOD_ID,
filePath: modelPath1,
} : null,
renderType: 'solid',
renderType: 'cutout_mipped',
textureAll: texturePath1,
});
}
// 生成方块状态
if (config.blockstate) {
if (blockState) {
JSON_ASSETS.push({
path: `${P_BLOCK_STATE}/${blockName}`,
data: config.blockstate,
data: blockState,
});
}

View File

@@ -0,0 +1,36 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"ambientocclusion": false,
"textures": {
"particle": "block/white_concrete",
"texture": "block/white_concrete"
},
"elements": [
{
"name": "top",
"from": [6.5, 0, 6.5],
"to": [9.5, 16, 9.5],
"faces": {
"north": {"uv": [6.5, 0, 9.5, 16], "texture": "#texture"},
"east": {"uv": [6.5, 0, 9.5, 16], "texture": "#texture"},
"south": {"uv": [6.5, 0, 9.5, 16], "texture": "#texture"},
"west": {"uv": [6.5, 0, 9.5, 16], "texture": "#texture"},
"up": {"uv": [6.5, 6.5, 9.5, 9.5], "texture": "#texture"},
"down": {"uv": [6.5, 6.5, 9.5, 9.5], "texture": "#texture"}
}
},
{
"name": "bottom",
"from": [6.5, -4, 6.5],
"to": [9.5, 0, 9.5],
"faces": {
"north": {"uv": [6.5, 12, 9.5, 16], "texture": "#texture"},
"east": {"uv": [6.5, 12, 9.5, 16], "texture": "#texture"},
"south": {"uv": [6.5, 12, 9.5, 16], "texture": "#texture"},
"west": {"uv": [6.5, 12, 9.5, 16], "texture": "#texture"},
"up": {"uv": [6.5, 6.5, 9.5, 9.5], "texture": "#texture"},
"down": {"uv": [6.5, 6.5, 9.5, 9.5], "texture": "#texture"}
}
}
]
}

View File

@@ -0,0 +1,120 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"ambientocclusion": false,
"textures": {
"particle": "block/white_concrete",
"texture": "block/white_concrete"
},
"elements": [
{
"from": [7.5, 3, 1],
"to": [8.5, 5, 7],
"faces": {
"north": {"uv": [7.5, 11, 8.5, 13], "texture": "#texture"},
"east": {"uv": [9, 11, 15, 13], "texture": "#texture"},
"south": {"uv": [7.5, 11, 8.5, 13], "texture": "#texture"},
"west": {"uv": [1, 11, 7, 13], "texture": "#texture"},
"up": {"uv": [7.5, 1, 8.5, 7], "texture": "#texture"},
"down": {"uv": [7.5, 9, 8.5, 15], "texture": "#texture"}
}
},
{
"from": [7.5, 11, 1],
"to": [8.5, 13, 7],
"faces": {
"north": {"uv": [7.5, 3, 8.5, 5], "texture": "#texture"},
"east": {"uv": [9, 3, 15, 5], "texture": "#texture"},
"south": {"uv": [7.5, 3, 8.5, 5], "texture": "#texture"},
"west": {"uv": [1, 3, 7, 5], "texture": "#texture"},
"up": {"uv": [7.5, 1, 8.5, 7], "texture": "#texture"},
"down": {"uv": [7.5, 9, 8.5, 15], "texture": "#texture"}
}
},
{
"from": [7.3, 0, 3],
"to": [8.7, 15, 5],
"faces": {
"north": {"uv": [7.3, 1, 8.7, 16], "texture": "#texture"},
"east": {"uv": [11, 1, 13, 16], "texture": "#texture"},
"south": {"uv": [7.3, 1, 8.7, 16], "texture": "#texture"},
"west": {"uv": [3, 1, 5, 16], "texture": "#texture"},
"up": {"uv": [7.3, 3, 8.7, 5], "texture": "#texture"},
"down": {"uv": [7.3, 11, 8.7, 13], "texture": "#texture"}
}
},
{
"from": [7.3, 0, 0],
"to": [8.7, 16, 1],
"faces": {
"north": {"uv": [7.3, 0, 8.7, 16], "texture": "#texture"},
"east": {"uv": [15, 0, 16, 16], "texture": "#texture"},
"south": {"uv": [7.3, 0, 8.7, 16], "texture": "#texture"},
"west": {"uv": [0, 0, 1, 16], "texture": "#texture"},
"up": {"uv": [7.3, 0, 8.7, 1], "texture": "#texture"},
"down": {"uv": [7.3, 15, 8.7, 16], "texture": "#texture"}
}
},
{
"from": [7.3, 0, 7],
"to": [8.7, 16, 8],
"faces": {
"north": {"uv": [7.3, 0, 8.7, 16], "texture": "#texture"},
"east": {"uv": [8, 0, 9, 16], "texture": "#texture"},
"south": {"uv": [7.3, 0, 8.7, 16], "texture": "#texture"},
"west": {"uv": [7, 0, 8, 16], "texture": "#texture"},
"up": {"uv": [7.3, 7, 8.7, 8], "texture": "#texture"},
"down": {"uv": [7.3, 8, 8.7, 9], "texture": "#texture"}
}
},
{
"from": [7.3, -4, 0],
"to": [8.7, 0, 1],
"faces": {
"north": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"east": {"uv": [15, 12, 16, 16], "texture": "#texture"},
"south": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"west": {"uv": [0, 12, 1, 16], "texture": "#texture"},
"up": {"uv": [7.3, 0, 8.7, 1], "texture": "#texture"},
"down": {"uv": [7.3, 15, 8.7, 16], "texture": "#texture"}
}
},
{
"from": [7.3, -4, 3],
"to": [8.7, 0, 5],
"faces": {
"north": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"east": {"uv": [11, 12, 13, 16], "texture": "#texture"},
"south": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"west": {"uv": [3, 12, 5, 16], "texture": "#texture"},
"up": {"uv": [7.3, 3, 8.7, 5], "texture": "#texture"},
"down": {"uv": [7.3, 11, 8.7, 13], "texture": "#texture"}
}
},
{
"from": [7.3, -4, 7],
"to": [8.7, 0, 8],
"faces": {
"north": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"east": {"uv": [8, 12, 9, 16], "texture": "#texture"},
"south": {"uv": [7.3, 12, 8.7, 16], "texture": "#texture"},
"west": {"uv": [7, 12, 8, 16], "texture": "#texture"},
"up": {"uv": [7.3, 7, 8.7, 8], "texture": "#texture"},
"down": {"uv": [7.3, 8, 8.7, 9], "texture": "#texture"}
}
}
],
"groups": [
{
"name": "top",
"origin": [8, 8, 8],
"color": 0,
"children": [0, 1, 2, 3, 4]
},
{
"name": "bottom",
"origin": [8, 5, 8],
"color": 0,
"children": [5, 6, 7]
}
]
}

View File

@@ -0,0 +1,6 @@
{
"parent": "wheat_plus:block/building/building_fence_c_base_post",
"textures": {
"texture": "block/black_concrete"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "wheat_plus:block/building/building_fence_c_base_side",
"textures": {
"texture": "block/black_concrete"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "wheat_plus:block/building/building_fence_c_base_post",
"textures": {
"texture": "block/white_concrete"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "wheat_plus:block/building/building_fence_c_base_side",
"textures": {
"texture": "block/white_concrete"
}
}