1
0

feat: 添加闸机门方块

This commit is contained in:
2025-05-02 17:48:07 +08:00
parent 3ff9f94974
commit 411fb354e7
4 changed files with 580 additions and 15 deletions

View File

@@ -80,21 +80,21 @@ 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=east,half=bottom,open=true': { model: bottomPath, y: 0 },
'facing=east,half=top,open=false': { model: topPath, y: 180 },
'facing=east,half=top,open=true': { model: openPath, y: 180 },
'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=north,half=bottom,open=true': { model: bottomPath, y: 0 },
'facing=north,half=top,open=false': { model: topPath, y: 90 },
'facing=north,half=top,open=true': { model: openPath, y: 90 },
'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=south,half=bottom,open=true': { model: bottomPath, y: 0 },
'facing=south,half=top,open=false': { model: topPath, y: 270 },
'facing=south,half=top,open=true': { model: openPath, y: 270 },
'facing=west,half=bottom,open=false': { model: bottomPath, y: 0 },
'facing=west,half=bottom,open=true': { model: openPath, y: 270 },
'facing=west,half=bottom,open=true': { model: bottomPath, y: 0 },
'facing=west,half=top,open=false': { model: topPath, y: 0 },
'facing=west,half=top,open=true': { model: openPath, y: 270 }
'facing=west,half=top,open=true': { model: openPath, y: 0 },
},
};
}
@@ -1288,6 +1288,19 @@ function regBlockCommon(event) {
texture: '',
type: 'cardinal',
},
{
name: 'turnstile_door_a',
label: '闸机门',
blockstate: getTrapdoorBlockstateJson(
`${P_BLOCK}/common/turnstile_door_a_base`,
`${P_BLOCK}/common/turnstile_door_a_closed`,
`${P_BLOCK}/common/turnstile_door_a_opened`,
),
box: null,
model: '',
texture: 'minecraft:block/red_wool',
type: 'trapdoor',
},
// -- 树木 --
{
name: 'tree_maple_leaves',
@@ -1405,8 +1418,18 @@ function regBlockCommon(event) {
// 添加到创造模式标签页
TAB_BLOCKS_ITEMS.push(blockId);
let isType1 = ['', 'cardinal'].indexOf(blockType > -1);
let isType2 = ['fence', 'slab', 'stairs', 'wall'].indexOf(blockType) > -1;
let isBlockType1 = [
'',
'cardinal',
].indexOf(blockType > -1);
let isBlockType2 = [
'fence',
'slab',
'stairs',
'trapdoor',
'wall',
].indexOf(blockType) > -1;
/** @type {_SetBlockPropsOpts} */
let commonProps = {
@@ -1427,7 +1450,7 @@ function regBlockCommon(event) {
let specialProps = {};
// 处理基础属性
if (isType1) {
if (isBlockType1) {
if (blockBox) {
specialProps = {
boxConfig: blockBox,
@@ -1443,7 +1466,7 @@ function regBlockCommon(event) {
renderType: 'solid',
};
}
} else if (isType2) {
} else if (isBlockType2) {
specialProps = {
renderType: 'cutout_mipped',
};

View File

@@ -0,0 +1,526 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"parent": "block/block",
"textures": {
"particle": "block/red_wool",
"closed": "block/red_wool",
"opened": "block/yellow_wool"
},
"elements": [
{
"from": [0, 11, 7],
"to": [7, 14, 7],
"faces": {
"north": {"uv": [9, 2, 16, 5], "texture": "#closed"}
}
},
{
"from": [9, 11, 7],
"to": [16, 14, 7],
"faces": {
"north": {"uv": [0, 2, 7, 5], "texture": "#closed"}
}
},
{
"from": [10, 9, 7],
"to": [16, 11, 7],
"faces": {
"north": {"uv": [0, 5, 6, 7], "texture": "#closed"}
}
},
{
"from": [0, 9, 7],
"to": [6, 11, 7],
"faces": {
"north": {"uv": [10, 5, 16, 7], "texture": "#closed"}
}
},
{
"from": [11, 8, 7],
"to": [16, 9, 7],
"faces": {
"north": {"uv": [0, 7, 5, 8], "texture": "#closed"}
}
},
{
"from": [0, 8, 7],
"to": [5, 9, 7],
"faces": {
"north": {"uv": [11, 7, 16, 8], "texture": "#closed"}
}
},
{
"from": [12, 7, 7],
"to": [16, 8, 7],
"faces": {
"north": {"uv": [0, 8, 4, 9], "texture": "#closed"}
}
},
{
"from": [0, 7, 7],
"to": [4, 8, 7],
"faces": {
"north": {"uv": [12, 8, 16, 9], "texture": "#closed"}
}
},
{
"from": [13, 6, 7],
"to": [16, 7, 7],
"faces": {
"north": {"uv": [0, 9, 3, 10], "texture": "#closed"}
}
},
{
"from": [0, 6, 7],
"to": [3, 7, 7],
"faces": {
"north": {"uv": [13, 9, 16, 10], "texture": "#closed"}
}
},
{
"from": [14, 5, 7],
"to": [16, 6, 7],
"faces": {
"north": {"uv": [0, 10, 2, 11], "texture": "#closed"}
}
},
{
"from": [0, 5, 7],
"to": [2, 6, 7],
"faces": {
"north": {"uv": [14, 10, 16, 11], "texture": "#closed"}
}
},
{
"from": [0, 11, 9],
"to": [7, 14, 9],
"faces": {
"south": {"uv": [0, 2, 7, 5], "texture": "#closed"}
}
},
{
"from": [9, 11, 9],
"to": [16, 14, 9],
"faces": {
"south": {"uv": [9, 2, 16, 5], "texture": "#closed"}
}
},
{
"from": [10, 9, 9],
"to": [16, 11, 9],
"faces": {
"south": {"uv": [10, 5, 16, 7], "texture": "#closed"}
}
},
{
"from": [0, 9, 9],
"to": [6, 11, 9],
"faces": {
"south": {"uv": [0, 5, 6, 7], "texture": "#closed"}
}
},
{
"from": [11, 8, 9],
"to": [16, 9, 9],
"faces": {
"south": {"uv": [11, 7, 16, 8], "texture": "#closed"}
}
},
{
"from": [0, 8, 9],
"to": [5, 9, 9],
"faces": {
"south": {"uv": [0, 7, 5, 8], "texture": "#closed"}
}
},
{
"from": [12, 7, 9],
"to": [16, 8, 9],
"faces": {
"south": {"uv": [12, 8, 16, 9], "texture": "#closed"}
}
},
{
"from": [0, 7, 9],
"to": [4, 8, 9],
"faces": {
"south": {"uv": [0, 8, 4, 9], "texture": "#closed"}
}
},
{
"from": [13, 6, 9],
"to": [16, 7, 9],
"faces": {
"south": {"uv": [13, 9, 16, 10], "texture": "#closed"}
}
},
{
"from": [0, 6, 9],
"to": [3, 7, 9],
"faces": {
"south": {"uv": [0, 9, 3, 10], "texture": "#closed"}
}
},
{
"from": [14, 5, 9],
"to": [16, 6, 9],
"faces": {
"south": {"uv": [14, 10, 16, 11], "texture": "#closed"}
}
},
{
"from": [0, 5, 9],
"to": [2, 6, 9],
"faces": {
"south": {"uv": [0, 10, 2, 11], "texture": "#closed"}
}
},
{
"from": [9, 11, 7],
"to": [10, 11, 9],
"faces": {
"down": {"uv": [9, 7, 10, 9], "texture": "#closed"}
}
},
{
"from": [6, 11, 7],
"to": [7, 11, 9],
"faces": {
"down": {"uv": [6, 7, 7, 9], "texture": "#closed"}
}
},
{
"from": [10, 9, 7],
"to": [11, 9, 9],
"faces": {
"down": {"uv": [10, 7, 11, 9], "texture": "#closed"}
}
},
{
"from": [5, 9, 7],
"to": [6, 9, 9],
"faces": {
"down": {"uv": [5, 7, 6, 9], "texture": "#closed"}
}
},
{
"from": [11, 8, 7],
"to": [12, 8, 9],
"faces": {
"down": {"uv": [11, 7, 12, 9], "texture": "#closed"}
}
},
{
"from": [4, 8, 7],
"to": [5, 8, 9],
"faces": {
"down": {"uv": [4, 7, 5, 9], "texture": "#closed"}
}
},
{
"from": [12, 7, 7],
"to": [13, 7, 9],
"faces": {
"down": {"uv": [12, 7, 13, 9], "texture": "#closed"}
}
},
{
"from": [3, 7, 7],
"to": [4, 7, 9],
"faces": {
"down": {"uv": [3, 7, 4, 9], "texture": "#closed"}
}
},
{
"from": [13, 6, 7],
"to": [14, 6, 9],
"faces": {
"down": {"uv": [13, 7, 14, 9], "texture": "#closed"}
}
},
{
"from": [2, 6, 7],
"to": [3, 6, 9],
"faces": {
"down": {"uv": [2, 7, 3, 9], "texture": "#closed"}
}
},
{
"from": [14, 5, 7],
"to": [16, 5, 9],
"faces": {
"down": {"uv": [14, 7, 16, 9], "texture": "#closed"}
}
},
{
"from": [0, 5, 7],
"to": [2, 5, 9],
"faces": {
"down": {"uv": [0, 7, 2, 9], "texture": "#closed"}
}
},
{
"from": [9, 14, 7],
"to": [16, 14, 9],
"faces": {
"up": {"uv": [9, 7, 16, 9], "texture": "#closed"}
}
},
{
"from": [0, 14, 7],
"to": [7, 14, 9],
"faces": {
"up": {"uv": [0, 7, 7, 9], "texture": "#closed"}
}
},
{
"from": [14, 5, 7],
"to": [14, 6, 9],
"faces": {
"west": {"uv": [7, 10, 9, 11], "texture": "#closed"}
}
},
{
"from": [13, 6, 7],
"to": [13, 7, 9],
"faces": {
"west": {"uv": [7, 9, 9, 10], "texture": "#closed"}
}
},
{
"from": [12, 7, 7],
"to": [12, 8, 9],
"faces": {
"west": {"uv": [7, 8, 9, 9], "texture": "#closed"}
}
},
{
"from": [11, 8, 7],
"to": [11, 9, 9],
"faces": {
"west": {"uv": [7, 7, 9, 8], "texture": "#closed"}
}
},
{
"from": [10, 9, 7],
"to": [10, 11, 9],
"faces": {
"west": {"uv": [7, 5, 9, 7], "texture": "#closed"}
}
},
{
"from": [9, 11, 7],
"to": [9, 14, 9],
"faces": {
"west": {"uv": [7, 2, 9, 5], "texture": "#closed"}
}
},
{
"from": [7, 11, 7],
"to": [7, 14, 9],
"faces": {
"east": {"uv": [7, 2, 9, 5], "texture": "#closed"}
}
},
{
"from": [6, 9, 7],
"to": [6, 11, 9],
"faces": {
"east": {"uv": [7, 5, 9, 7], "texture": "#closed"}
}
},
{
"from": [5, 8, 7],
"to": [5, 9, 9],
"faces": {
"east": {"uv": [7, 7, 9, 8], "texture": "#closed"}
}
},
{
"from": [4, 7, 7],
"to": [4, 8, 9],
"faces": {
"east": {"uv": [7, 8, 9, 9], "texture": "#closed"}
}
},
{
"from": [3, 6, 7],
"to": [3, 7, 9],
"faces": {
"east": {"uv": [7, 9, 9, 10], "texture": "#closed"}
}
},
{
"from": [2, 5, 7],
"to": [2, 6, 9],
"faces": {
"east": {"uv": [7, 10, 9, 11], "texture": "#closed"}
}
},
{
"from": [16, 5, 7],
"to": [16, 14, 9],
"faces": {
"east": {"uv": [7, 2, 9, 11], "texture": "#closed"}
}
},
{
"from": [0, 5, 7],
"to": [0, 14, 9],
"faces": {
"west": {"uv": [7, 2, 9, 11], "texture": "#closed"}
}
},
{
"from": [0, 5, 7],
"to": [1, 14, 7],
"faces": {
"north": {"uv": [15, 2, 16, 11], "texture": "#opened"}
}
},
{
"from": [15, 5, 9],
"to": [16, 14, 9],
"faces": {
"south": {"uv": [15, 2, 16, 11], "texture": "#opened"}
}
},
{
"from": [0, 5, 9],
"to": [1, 14, 9],
"faces": {
"south": {"uv": [0, 2, 1, 11], "texture": "#opened"}
}
},
{
"from": [15, 5, 7],
"to": [16, 5, 9],
"faces": {
"down": {"uv": [15, 7, 16, 9], "texture": "#opened"}
}
},
{
"from": [0, 5, 7],
"to": [1, 5, 9],
"faces": {
"down": {"uv": [0, 7, 1, 9], "texture": "#opened"}
}
},
{
"from": [15, 14, 7],
"to": [16, 14, 9],
"faces": {
"up": {"uv": [15, 7, 16, 9], "texture": "#opened"}
}
},
{
"from": [0, 14, 7],
"to": [1, 14, 9],
"faces": {
"up": {"uv": [0, 7, 1, 9], "texture": "#opened"}
}
},
{
"from": [15, 5, 7],
"to": [15, 14, 9],
"faces": {
"west": {"uv": [7, 2, 9, 11], "texture": "#opened"}
}
},
{
"from": [1, 5, 7],
"to": [1, 14, 9],
"faces": {
"east": {"uv": [7, 2, 9, 11], "texture": "#opened"}
}
},
{
"from": [16, 5, 7],
"to": [16, 14, 9],
"faces": {
"east": {"uv": [7, 2, 9, 11], "texture": "#opened"}
}
},
{
"from": [0, 5, 7],
"to": [0, 14, 9],
"faces": {
"west": {"uv": [7, 2, 9, 11], "texture": "#opened"}
}
},
{
"from": [15, 5, 7],
"to": [16, 14, 7],
"faces": {
"north": {"uv": [0, 2, 1, 11], "texture": "#opened"}
}
}
],
"groups": [
{
"name": "closed",
"origin": [8, 8, 8],
"color": 0,
"children": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51
]
},
{
"name": "opened",
"origin": [8, 8, 8],
"color": 0,
"children": [52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]
}
]
}

View File

@@ -0,0 +1,8 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"parent": "wheat_plus:block/common/turnstile_door_a_base",
"textures": {
"closed": "block/red_wool",
"opened": "wheat_plus:block/common/transparent"
}
}

View File

@@ -0,0 +1,8 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"parent": "wheat_plus:block/common/turnstile_door_a_base",
"textures": {
"closed": "wheat_plus:block/common/transparent",
"opened": "block/red_wool"
}
}