1
0

fix: 解决部分方块的粒子效果纹理是黑紫方块的问题

This commit is contained in:
2025-05-06 21:45:58 +08:00
parent 9eac5e5db8
commit 46fabc2901
3 changed files with 18 additions and 0 deletions

View File

@@ -152,6 +152,9 @@ type SetBlockPropsOpts = {
/** 纹理文件路径,每一面都相同时指定 */
textureAll?: string;
/** 方块粒子效果纹理文件路径,不使用 `textureAll` 的情况下才需要指定 */
textureParticle?: string;
/** 纹理文件路径,侧面都相同时指定 */
textureSide?: string;

View File

@@ -131,6 +131,7 @@ global.setBlockProps = function (block, opts) {
let resistance = defaults(opts.resistance, 16);
let soundType = defaults(opts.soundType, 'stone');
let textureAll = defaults(opts.textureAll, '');
let textureParticle = defaults(opts.textureParticle, '');
let textureSide = defaults(opts.textureSide, '');
let textureSideNS = defaults(opts.textureSideNS, '');
let textureSideWE = defaults(opts.textureSideWE, '');
@@ -177,6 +178,10 @@ global.setBlockProps = function (block, opts) {
block.texture(textureAll);
}
if (textureParticle) {
block.texture('particle', textureParticle);
}
if (textureSide) {
block.texture([
Direction.NORTH,

View File

@@ -354,6 +354,7 @@ function regBlockCommon(event) {
box: null,
model: '',
texture: '',
textureParticle: 'common/carton_a_ud',
textureSideNS: 'common/carton_a_ns',
textureSideWE: 'common/carton_a_we',
textureUpDown: 'common/carton_a_ud',
@@ -1318,6 +1319,7 @@ function regBlockCommon(event) {
box: null,
model: '',
texture: '',
textureParticle: 'common/tree_maple_wood_side',
textureSide: 'common/tree_maple_wood_side',
textureUpDown: 'common/tree_maple_wood_ud',
type: '',
@@ -1338,6 +1340,7 @@ function regBlockCommon(event) {
box: null,
model: '',
texture: '',
textureParticle: 'common/tree_palm_wood_side',
textureSide: 'common/tree_palm_wood_side',
textureUpDown: 'common/tree_palm_wood_ud',
type: '',
@@ -1358,6 +1361,7 @@ function regBlockCommon(event) {
box: null,
model: '',
texture: '',
textureParticle: 'common/tree_willow_wood_side',
textureSide: 'common/tree_willow_wood_side',
textureUpDown: 'common/tree_willow_wood_ud',
type: '',
@@ -1418,6 +1422,8 @@ function regBlockCommon(event) {
// 获取纹理文件路径
let textureAllPath0 = config.texture;
let textureAllPath1 = textureAllPath0 || '';
let textureParticlePath0 = config.textureParticle;
let textureParticlePath1 = textureParticlePath0 || '';
let textureSidePath0 = config.textureSide;
let textureSidePath1 = textureSidePath0 || '';
let textureSideNSPath0 = config.textureSideNS;
@@ -1431,6 +1437,9 @@ function regBlockCommon(event) {
if (textureAllPath0 && !textureAllPath0.includes(':')) {
textureAllPath1 = `${P_BLOCK}/${textureAllPath0}`;
}
if (textureParticlePath0 && !textureParticlePath0.includes(':')) {
textureParticlePath1 = `${P_BLOCK}/${textureParticlePath0}`;
}
if (textureSidePath0 && !textureSidePath0.includes(':')) {
textureSidePath1 = `${P_BLOCK}/${textureSidePath0}`;
}
@@ -1476,6 +1485,7 @@ function regBlockCommon(event) {
filePath: modelPath1,
} : null,
textureAll: textureAllPath1,
textureParticle: textureParticlePath1,
textureSide: textureSidePath1,
textureSideNS: textureSideNSPath1,
textureSideWE: textureSideWEPath1,