1
0

feat: 添加道闸方块模型

This commit is contained in:
2025-05-02 16:52:33 +08:00
parent fb581f819e
commit 3ff9f94974
4 changed files with 142 additions and 12 deletions

View File

@@ -48,25 +48,54 @@ function getFenceBlockstateJson(postPath, sidePath) {
return {
multipart: [
{
apply: { model: postPath }
apply: { model: postPath, uvlock: false, y: 0 },
},
{
apply: { model: sidePath, uvlock: true },
when: { north: 'true' }
apply: { model: sidePath, uvlock: true, y: 0 },
when: { north: 'true' },
},
{
apply: { model: sidePath, uvlock: true, y: 90 },
when: { east: 'true' }
when: { east: 'true' },
},
{
apply: { model: sidePath, uvlock: true, y: 180 },
when: { south: 'true' }
when: { south: 'true' },
},
{
apply: { model: sidePath, uvlock: true, y: 270 },
when: { west: 'true' }
}
]
when: { west: 'true' },
},
],
};
}
/**
* @description 获取活板门方块状态 JSON
* @param {string} bottomPath 活板门 bottom 模型短路径
* @param {string} topPath 活板门 top 模型短路径
* @param {string} openPath 活板门 open 模型短路径
*/
function getTrapdoorBlockstateJson(bottomPath, topPath, openPath) {
return {
variants: {
'facing=east,half=bottom,open=false': { model: bottomPath, y: 0 },
'facing=east,half=bottom,open=true': { model: openPath, y: 90 },
'facing=east,half=top,open=false': { model: topPath, y: 0 },
'facing=east,half=top,open=true': { model: openPath, y: 90 },
'facing=north,half=bottom,open=false': { model: bottomPath, y: 0 },
'facing=north,half=bottom,open=true': { model: openPath, y: 0 },
'facing=north,half=top,open=false': { model: topPath, y: 0 },
'facing=north,half=top,open=true': { model: openPath, y: 0 },
'facing=south,half=bottom,open=false': { model: bottomPath, y: 0 },
'facing=south,half=bottom,open=true': { model: openPath, y: 180 },
'facing=south,half=top,open=false': { model: topPath, y: 0 },
'facing=south,half=top,open=true': { model: openPath, y: 180 },
'facing=west,half=bottom,open=false': { model: bottomPath, y: 0 },
'facing=west,half=bottom,open=true': { model: openPath, y: 270 },
'facing=west,half=top,open=false': { model: topPath, y: 0 },
'facing=west,half=top,open=true': { model: openPath, y: 270 }
},
};
}
@@ -304,7 +333,20 @@ function regBlockCommon(event) {
console.info(`${LOG_PREFIX} 注册方块 - 常规 - 开始`);
let blockList = [
// 普通方块
// -- 普通方块 --
// {
// name: 'barrier_gate_a',
// label: '道闸',
// blockstate: getTrapdoorBlockstateJson(
// `${P_BLOCK}/common/barrier_gate_a_base`,
// `${P_BLOCK}/common/barrier_gate_a_closed`,
// `${P_BLOCK}/common/barrier_gate_a_opened`,
// ),
// box: null,
// model: '',
// texture: 'minecraft:block/yellow_concrete',
// type: 'trapdoor',
// },
{
name: 'carton_a',
label: '纸箱',
@@ -671,7 +713,7 @@ function regBlockCommon(event) {
texture: '',
type: 'cardinal',
},
// 建筑方块
// -- 建筑方块 --
{
name: 'building_brick_a',
label: '砖块(大三角)',
@@ -1146,7 +1188,7 @@ function regBlockCommon(event) {
texture: '',
type: 'cardinal',
},
// 家具方块
// -- 家具方块 --
{
name: 'furniture_birch_chair_a',
label: '白桦木椅子',
@@ -1246,7 +1288,7 @@ function regBlockCommon(event) {
texture: '',
type: 'cardinal',
},
// 树木
// -- 树木 --
{
name: 'tree_maple_leaves',
label: '枫树叶',

View File

@@ -0,0 +1,74 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"ambientocclusion": false,
"textures": {
"connection": "block/black_concrete",
"particle": "block/yellow_concrete",
"main": "block/yellow_concrete",
"pole_closed": "block/white_concrete",
"pole_opened": "block/light_gray_concrete"
},
"elements": [
{
"name": "main",
"from": [3, 0, 3],
"to": [13, 24, 11],
"faces": {
"north": {"uv": [0, 0, 5, 12], "texture": "#main"},
"east": {"uv": [0, 0, 4, 12], "texture": "#main"},
"south": {"uv": [0, 0, 5, 12], "texture": "#main"},
"west": {"uv": [0, 0, 4, 12], "texture": "#main"},
"up": {"uv": [0, 0, 10, 8], "texture": "#main"},
"down": {"uv": [0, 0, 10, 8], "texture": "#main"}
}
},
{
"name": "connection",
"from": [7.5, 18.5, 11],
"to": [8.5, 19.5, 13],
"faces": {
"north": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"},
"east": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"},
"south": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"},
"west": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"},
"up": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"},
"down": {"uv": [0, 0, 0.5, 0.5], "texture": "#connection"}
}
},
{
"name": "pole_closed",
"from": [-48, 18, 11.5],
"to": [11, 20, 13.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 19, 12.5]},
"faces": {
"north": {"uv": [0, 0, 16, 0.5], "texture": "#pole_closed"},
"east": {"uv": [0, 0, 1, 1], "texture": "#pole_closed"},
"south": {"uv": [0, 0, 16, 0.5], "texture": "#pole_closed"},
"west": {"uv": [0, 0, 1, 1], "texture": "#pole_closed"},
"up": {"uv": [0, 0, 16, 0.5], "texture": "#pole_closed"},
"down": {"uv": [0, 0, 16, 0.5], "texture": "#pole_closed"}
}
},
{
"name": "pole_opened",
"from": [7, 16, 11.5],
"to": [9, 75, 13.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 19, 12.5]},
"faces": {
"north": {"uv": [0, 0, 16, 0.5], "rotation": 270, "texture": "#pole_opened"},
"east": {"uv": [0, 0, 16, 0.5], "rotation": 90, "texture": "#pole_opened"},
"south": {"uv": [0, 0, 16, 0.5], "rotation": 90, "texture": "#pole_opened"},
"west": {"uv": [0, 0, 16, 0.5], "rotation": 90, "texture": "#pole_opened"},
"up": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#pole_opened"},
"down": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#pole_opened"}
}
}
],
"display": {
"gui": {
"rotation": [30, 30, 0],
"translation": [4, -4, 0],
"scale": [0.2, 0.2, 0.2]
}
}
}

View File

@@ -0,0 +1,7 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"parent": "wheat_plus:block/common/barrier_gate_a_base",
"textures": {
"pole_opened": "wheat_plus:block/common/transparent"
}
}

View File

@@ -0,0 +1,7 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"parent": "wheat_plus:block/common/barrier_gate_a_base",
"textures": {
"pole_closed": "wheat_plus:block/common/transparent"
}
}