From 8f7193edf6388a80e06f16ecbdeff9ea1ba72d8c Mon Sep 17 00:00:00 2001 From: Frost-ZX <30585462+Frost-ZX@users.noreply.github.com> Date: Sun, 4 Sep 2022 19:17:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E8=B7=AF?= =?UTF-8?q?=E6=96=B9=E5=9D=97=E7=BA=B9=E7=90=86=E5=AE=9A=E4=B9=89=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=A9=BA=E7=99=BD=E4=BE=A7=E8=BE=B9=E7=BA=B9?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kubejs/startup_scripts/wheat_plus.js | 42 +++++++++++++++++----------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/kubejs/startup_scripts/wheat_plus.js b/kubejs/startup_scripts/wheat_plus.js index 9e8cf45..551a225 100644 --- a/kubejs/startup_scripts/wheat_plus.js +++ b/kubejs/startup_scripts/wheat_plus.js @@ -109,9 +109,10 @@ onEvent('block.registry', (event) => { name: 'road_blank', label: '路 - 空白', texturePath: 'transparent', - hasNormal: true, - hasSlant: false, - isBlank: true, + hasNormal: true, // 普通 / 直线 + hasSlant: false, // 斜线 + hasSide: false, // 侧边纹理 + isBlank: true, // 空白 }, { name: 'road_white', @@ -119,6 +120,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/content_white', hasNormal: true, hasSlant: false, + hasSide: false, isBlank: true, }, { @@ -127,6 +129,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/content_yellow', hasNormal: true, hasSlant: false, + hasSide: false, isBlank: true, }, { @@ -135,6 +138,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/line/single_white', hasNormal: true, hasSlant: true, + hasSide: true, isBlank: false, }, { @@ -143,6 +147,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/line/single_yellow', hasNormal: true, hasSlant: true, + hasSide: true, isBlank: false, }, { @@ -151,6 +156,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/line/double_white', hasNormal: true, hasSlant: true, + hasSide: true, isBlank: false, }, { @@ -159,6 +165,7 @@ onEvent('block.registry', (event) => { texturePath: 'road/line/double_yellow', hasNormal: true, hasSlant: true, + hasSide: true, isBlank: false, }, ]; @@ -172,7 +179,10 @@ onEvent('block.registry', (event) => { const label = (config.label || 'Unknown'); /** 纹理文件相对路径 */ - const texturePath = config.texturePath; + const tPath = config.texturePath; + + /** 是否存在侧边纹理 */ + const tSide = config.hasSide; // 完整,直线 if (config.hasNormal) { @@ -186,12 +196,12 @@ onEvent('block.registry', (event) => { renderType: 'cutout', }); - if (texturePath) { + if (tPath) { block.modelJson = { parent: `${PATH_MODEL}road/base_full`, textures: { - content: `${PATH_TEXTURE}${texturePath}`, - side: `${PATH_TEXTURE}${texturePath}` + content: `${PATH_TEXTURE}${tPath}`, + side: tSide ? `${PATH_TEXTURE}${tPath}` : undefined } }; } @@ -210,12 +220,12 @@ onEvent('block.registry', (event) => { renderType: 'cutout', }); - if (texturePath) { + if (tPath) { block.modelJson = { parent: `${PATH_MODEL}road/base_full`, textures: { - content: `${PATH_TEXTURE}${texturePath}_slant`, - side: `${PATH_TEXTURE}${texturePath}` + content: `${PATH_TEXTURE}${tPath}_slant`, + side: tSide ? `${PATH_TEXTURE}${tPath}` : undefined } }; } @@ -234,12 +244,12 @@ onEvent('block.registry', (event) => { renderType: 'cutout', }); - if (texturePath) { + if (tPath) { block.modelJson = { parent: `${PATH_MODEL}road/base_half`, textures: { - content: `${PATH_TEXTURE}${texturePath}`, - side: `${PATH_TEXTURE}${texturePath}` + content: `${PATH_TEXTURE}${tPath}`, + side: tSide ? `${PATH_TEXTURE}${tPath}` : undefined } }; } @@ -258,12 +268,12 @@ onEvent('block.registry', (event) => { renderType: 'cutout', }); - if (texturePath) { + if (tPath) { block.modelJson = { parent: `${PATH_MODEL}road/base_half`, textures: { - content: `${PATH_TEXTURE}${texturePath}_slant`, - side: `${PATH_TEXTURE}${texturePath}` + content: `${PATH_TEXTURE}${tPath}_slant`, + side: tSide ? `${PATH_TEXTURE}${tPath}` : undefined } }; }