1
0

feat: 添加矿车方块(广州地铁样式)

This commit is contained in:
2022-11-20 21:18:29 +08:00
parent 5661c75b3d
commit 449df18742
19 changed files with 202 additions and 0 deletions

View File

@@ -209,6 +209,71 @@ onEvent('block.registry', function (event) {
});
// 注册方块 - 矿车方块
onEvent('block.registry', function (event) {
/** 父模型路径 */
const modelParent = `${P_BLOCK}/minecart/main`;
/** 纹理文件路径前缀 */
const texturePrefix = `${P_BLOCK}/minecart/`;
const blocks = [
{ name: 'mtr_gz_gf_1', label: '广州地铁 - 广佛线' },
{ name: 'mtr_gz_gf_2', label: '广州地铁 - 广佛线' },
{ name: 'mtr_gz_l1_1', label: '广州地铁 - 一号线' },
{ name: 'mtr_gz_l1_2', label: '广州地铁 - 一号线' },
{ name: 'mtr_gz_l2_1', label: '广州地铁 - 二号线' },
{ name: 'mtr_gz_l3_1', label: '广州地铁 - 三号线' },
{ name: 'mtr_gz_l3_2', label: '广州地铁 - 三号线' },
{ name: 'mtr_gz_l4_1', label: '广州地铁 - 四号线' },
{ name: 'mtr_gz_l5_1', label: '广州地铁 - 五号线' },
{ name: 'mtr_gz_l6_1', label: '广州地铁 - 六号线' },
{ name: 'mtr_gz_l7_1', label: '广州地铁 - 七号线' },
{ name: 'mtr_gz_l8_1', label: '广州地铁 - 八号线' },
{ name: 'mtr_gz_l9_1', label: '广州地铁 - 九号线' },
{ name: 'mtr_gz_l13_1', label: '广州地铁 - 十三号线' },
{ name: 'mtr_gz_l14_1', label: '广州地铁 - 十四号线' },
{ name: 'mtr_gz_l21_1', label: '广州地铁 - 二十一号线' },
];
blocks.forEach((config) => {
const blockName = config.name;
const blockId = `${MOD_ID}:minecart_${blockName}`;
const block = event.create(blockId, 'basic');
const modelPathL = `${P_BLOCK_MODEL}/minecart/${blockName}`;
const modelPathS = `${P_BLOCK}/minecart/${blockName}`;
const modelJSON = {
parent: modelParent,
textures: {
main: `${texturePrefix}${blockName}`
}
};
// 生成模型 JSON 文件
JSON_ASSETS.push({ PATH: modelPathL, DATA: modelJSON });
// 设置基础属性
setBlockProps(block, {
boxConfig: [-3, 0, -6, 19, 16, 22],
boxType: 'custom',
collision: false,
displayName: config.label,
isSolid: false,
material: 'metal',
modelPath: modelPathS,
renderType: 'cutout',
});
// 设置旋转属性
setHorizontalFacing(block, 'same', modelPathS);
});
});
// 注册方块 - 路
onEvent('block.registry', function (event) {

View File

@@ -0,0 +1,110 @@
{
"credit": "Created by Frost-ZX using Blockbench.",
"textures": {
"particle": "#main"
},
"ambientocclusion": false,
"elements": [
{
"name": "Side_N",
"from": [0.5, 0, -6],
"to": [15.5, 16, -2],
"shade": false,
"faces": {
"north": {"uv": [0.75, 3, 3.75, 6], "texture": "#main"},
"south": {"uv": [5.75, 2.75, 8.75, 4.75], "texture": "#main"},
"up": {"uv": [5.75, 0, 10.25, 0.75], "texture": "#main"}
}
},
{
"name": "Side_S",
"from": [0.5, 0, 18],
"to": [15.5, 16, 22],
"shade": false,
"faces": {
"north": {"uv": [5.75, 2.75, 8.75, 4.75], "texture": "#main"},
"south": {"uv": [0.75, 9, 3.75, 12], "texture": "#main"},
"up": {"uv": [5.75, 0, 10.25, 0.75], "texture": "#main"}
}
},
{
"name": "Side_W",
"from": [-3.5, 0, -6],
"to": [0.5, 16, 22],
"shade": false,
"faces": {
"north": {"uv": [3.75, 3, 4.5, 6], "texture": "#main"},
"east": {"uv": [5.75, 0.75, 9.25, 4.5], "rotation": 90, "texture": "#main"},
"south": {"uv": [0, 9, 0.75, 12], "texture": "#main"},
"west": {"uv": [0, 0, 5, 3], "texture": "#main"},
"up": {"uv": [5, 0, 5.75, 5.25], "texture": "#main"}
}
},
{
"name": "Side_E",
"from": [15.5, 0, -6],
"to": [19.5, 16, 22],
"shade": false,
"faces": {
"north": {"uv": [0, 3, 0.75, 6], "texture": "#main"},
"east": {"uv": [0, 6, 5, 9], "texture": "#main"},
"south": {"uv": [3.75, 9, 4.5, 12], "texture": "#main"},
"west": {"uv": [5.75, 0.75, 9.25, 4.5], "rotation": 90, "texture": "#main"},
"up": {"uv": [5, 0, 5.75, 5.25], "texture": "#main"}
}
},
{
"name": "Bottom",
"from": [0.5, 2.5, -2],
"to": [15.5, 4.5, 18],
"shade": false,
"faces": {
"north": {"uv": [5.75, 0.75, 8.75, 1.25], "rotation": 180, "texture": "#main"},
"east": {"uv": [5.75, 0.75, 6.25, 4.5], "rotation": 90, "texture": "#main"},
"south": {"uv": [5.75, 0.75, 8.75, 1.25], "texture": "#main"},
"west": {"uv": [5.75, 0.75, 6.25, 4.5], "rotation": 90, "texture": "#main"},
"up": {"uv": [5.75, 0.75, 8.75, 4.5], "texture": "#main"},
"down": {"uv": [5.75, 0.75, 8.75, 4.5], "texture": "#main"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [90, 90, 0],
"translation": [0, 0, -1.5],
"scale": [0.25, 0.25, 0.25]
},
"thirdperson_lefthand": {
"rotation": [90, 90, 0],
"translation": [0, 0, -1.5],
"scale": [0.25, 0.25, 0.25]
},
"firstperson_righthand": {
"rotation": [0, 16, 0],
"translation": [5, 1, -4],
"scale": [0.2, 0.2, 0.2]
},
"firstperson_lefthand": {
"rotation": [0, 16, 0],
"translation": [5, 1, -4],
"scale": [0.2, 0.2, 0.2]
},
"ground": {
"translation": [0, 5, 0]
},
"gui": {
"rotation": [20, 40, 0],
"scale": [0.4, 0.4, 0.4]
},
"head": {
"rotation": [0, 90, 0],
"translation": [0, 10, 0],
"scale": [0.4, 0.4, 0.4]
},
"fixed": {
"rotation": [0, 90, 0],
"translation": [0, 0, -9],
"scale": [0.8, 0.8, 0.8]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,27 @@
————————————————————————
广州地铁
包含文件:
mtr_gz_gf_1.png
mtr_gz_gf_2.png
mtr_gz_l1_1.png
mtr_gz_l1_2.png
mtr_gz_l2_1.png
mtr_gz_l3_1.png
mtr_gz_l3_2.png
mtr_gz_l4_1.png
mtr_gz_l5_1.png
mtr_gz_l6_1.png
mtr_gz_l7_1.png
mtr_gz_l8_1.png
mtr_gz_l9_1.png
mtr_gz_l13_1.png
mtr_gz_l14_1.png
mtr_gz_l21_1.png
作者:
Grafeugen (bilibili UID 9053928)
Frost-ZX (bilibili UID 936757)
————————————————————————