BlueGit

timfa questward

Keep gatherable blocks off chunk atlases so nodes disappear on delta.

Resource nodes and pickables render as per-tile sprites; block chunkDelta triggers an immediate rebuild so exhausted ore and picked plants do not linger in baked rows.

timfa Tim Falken · pushed by timfa

Authored 2026-08-28 · 2 months ago

Hash
38812f199548f883b1968a24077d9d1c1e275e43
Parent
b573c1c4
5 files changed +113 −20
client/src/render/chunkBake.js +25 −4
@@ -1,5 +1,5 @@
1 1 import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
2 import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock } from "/shared/definitions/tiles.js";
2 import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock, isChunkAtlasBakedBlock } from "/shared/definitions/tiles.js";
3 3 import { bloomImageName, spriteImageName } from "/shared/definitions/tileSprites.js";
4 4 import { resolveSeasonalVisualState, SeasonId } from "/shared/world/season.js";
5 5 import {
@@ -139,7 +139,7 @@ export function collectChunkSpriteExtras ({
139 139 if (!blockName)
140 140 { continue; }
141 141 const blockMeta = blockCatalogMeta(catalog, blockEntry);
142 if (!isBakeable(images[blockName], blockMeta))
142 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
143 143 {
144 144 tallBlocks.push({
145 145 tileX,
@@ -154,6 +154,27 @@ export function collectChunkSpriteExtras ({
154 154 return { tallBlocks, animatedGrounds };
155 155 }
156 156
157 /**
158 * Per-tile block sprite when the block is not represented in the chunk atlas row.
159 * @returns {{ sprite: string, bloom: string | null } | null}
160 */
161 export function tileBlockSpriteEntry (catalog, images, blockEntry, season = SeasonId.summer)
162 {
163 if (!blockEntry)
164 { return null; }
165 const blockName = blockSpriteName(catalog, blockEntry, season);
166 if (!blockName)
167 { return null; }
168 const blockMeta = blockCatalogMeta(catalog, blockEntry);
169 const bakeable = isBakeable(images[blockName], blockMeta);
170 if (bakeable && isChunkAtlasBakedBlock(blockEntry))
171 { return null; }
172 return {
173 sprite: blockName,
174 bloom: blockBloomName(catalog, blockEntry, season)
175 };
176 }
177
157 178 function bakeGroundCanvas ({
158 179 snapshot,
159 180 catalog,
@@ -238,7 +259,7 @@ function bakeBlockRowCanvas ({
238 259 if (!blockName)
239 260 { continue; }
240 261 const blockMeta = blockCatalogMeta(catalog, blockEntry);
241 if (!isBakeable(images[blockName], blockMeta))
262 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
242 263 { continue; }
243 264 blit(ctx, images[blockName], localX * SPRITE_SIZE_PX, 0);
244 265 }
@@ -281,7 +302,7 @@ function bakeBloomCanvas ({
281 302 if (!blockName)
282 303 { continue; }
283 304 const blockMeta = blockCatalogMeta(catalog, blockEntry);
284 if (!isBakeable(images[blockName], blockMeta))
305 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
285 306 { continue; }
286 307 const blockBloom = blockBloomName(catalog, blockEntry, season);
287 308 if (blockBloom)
@@ -1,5 +1,5 @@
1import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
1import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
2import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock } from "/shared/definitions/tiles.js";
2import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock, isChunkAtlasBakedBlock } from "/shared/definitions/tiles.js";
3import { bloomImageName, spriteImageName } from "/shared/definitions/tileSprites.js";
3import { bloomImageName, spriteImageName } from "/shared/definitions/tileSprites.js";
4import { resolveSeasonalVisualState, SeasonId } from "/shared/world/season.js";
4import { resolveSeasonalVisualState, SeasonId } from "/shared/world/season.js";
5import {
5import {
@@ -139,7 +139,7 @@ export function collectChunkSpriteExtras ({
139 if (!blockName)
139 if (!blockName)
140 { continue; }
140 { continue; }
141 const blockMeta = blockCatalogMeta(catalog, blockEntry);
141 const blockMeta = blockCatalogMeta(catalog, blockEntry);
142 if (!isBakeable(images[blockName], blockMeta))
142 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
143 {
143 {
144 tallBlocks.push({
144 tallBlocks.push({
145 tileX,
145 tileX,
@@ -154,6 +154,27 @@ export function collectChunkSpriteExtras ({
154 return { tallBlocks, animatedGrounds };
154 return { tallBlocks, animatedGrounds };
155}
155}
156
156
157/**
158 * Per-tile block sprite when the block is not represented in the chunk atlas row.
159 * @returns {{ sprite: string, bloom: string | null } | null}
160 */
161export function tileBlockSpriteEntry (catalog, images, blockEntry, season = SeasonId.summer)
162{
163 if (!blockEntry)
164 { return null; }
165 const blockName = blockSpriteName(catalog, blockEntry, season);
166 if (!blockName)
167 { return null; }
168 const blockMeta = blockCatalogMeta(catalog, blockEntry);
169 const bakeable = isBakeable(images[blockName], blockMeta);
170 if (bakeable && isChunkAtlasBakedBlock(blockEntry))
171 { return null; }
172 return {
173 sprite: blockName,
174 bloom: blockBloomName(catalog, blockEntry, season)
175 };
176}
177
157function bakeGroundCanvas ({
178function bakeGroundCanvas ({
158 snapshot,
179 snapshot,
159 catalog,
180 catalog,
@@ -238,7 +259,7 @@ function bakeBlockRowCanvas ({
238 if (!blockName)
259 if (!blockName)
239 { continue; }
260 { continue; }
240 const blockMeta = blockCatalogMeta(catalog, blockEntry);
261 const blockMeta = blockCatalogMeta(catalog, blockEntry);
241 if (!isBakeable(images[blockName], blockMeta))
262 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
242 { continue; }
263 { continue; }
243 blit(ctx, images[blockName], localX * SPRITE_SIZE_PX, 0);
264 blit(ctx, images[blockName], localX * SPRITE_SIZE_PX, 0);
244 }
265 }
@@ -281,7 +302,7 @@ function bakeBloomCanvas ({
281 if (!blockName)
302 if (!blockName)
282 { continue; }
303 { continue; }
283 const blockMeta = blockCatalogMeta(catalog, blockEntry);
304 const blockMeta = blockCatalogMeta(catalog, blockEntry);
284 if (!isBakeable(images[blockName], blockMeta))
305 if (!isBakeable(images[blockName], blockMeta) || !isChunkAtlasBakedBlock(blockEntry))
285 { continue; }
306 { continue; }
286 const blockBloom = blockBloomName(catalog, blockEntry, season);
307 const blockBloom = blockBloomName(catalog, blockEntry, season);
287 if (blockBloom)
308 if (blockBloom)
client/src/render/worldView.js +22 −12
@@ -7,7 +7,7 @@ import { EQUIPMENT_SLOT, itemEquipSprite, itemSpriteName, itemDefinition } from
7 7 import { resolveItemTint, resolveEquipTint, resolveItemDualTint, normalizeRgb } from "/shared/render/tint.js";
8 8 import { normalizeGround, isWadeGroundInSeason, isWaterGround, isLiquidWaterGround, isGroundPassable, isBlockOccludingLight, LightOcclusion } from "/shared/definitions/tiles.js";
9 9 import { spriteCenterFromPivot, spriteDrawSize, tilePivot, ySortLayer } from "/shared/render/pivot.js";
10 import { bakeChunkAtlases } from "./chunkBake.js";
10 import { bakeChunkAtlases, tileBlockSpriteEntry } from "./chunkBake.js";
11 11 import { createChunkAtlasCache } from "./chunkAtlasCache.js";
12 12 import
13 13 {
@@ -1564,7 +1564,17 @@ export class WorldView
1564 1564 { snapshot.blocks[index] = block; }
1565 1565 if (light !== undefined)
1566 1566 { snapshot.light[index] = light; }
1567 const tileX = chunkX * CHUNK_SIZE + localX;
1568 const tileY = chunkY * CHUNK_SIZE + localY;
1569 if (block !== undefined)
1570 {
1571 this.#rebuildChunk(snapshot, { refreshSoftNeighbors: false });
1572 this.#drawTile(tileX, tileY);
1573 return;
1574 }
1567 1575 this.#scheduleChunkRebuild(snapshot);
1576 if (ground !== undefined)
1577 { this.#drawTile(tileX, tileY); }
1568 1578 }
1569 1579
1570 1580 /**
@@ -2463,17 +2473,13 @@ export class WorldView
2463 2473
2464 2474 #relayoutChunkTiles (snapshot)
2465 2475 {
2466 const baked = this.bakedChunks.get(`${snapshot.chunkX},${snapshot.chunkY}`);
2467 const tall = new Set(
2468 (baked?.tallBlocks ?? []).map((entry) => `${entry.tileX},${entry.tileY}`)
2469 );
2470 2476 for (let localY = 0; localY < CHUNK_SIZE; localY++)
2471 2477 {
2472 2478 for (let localX = 0; localX < CHUNK_SIZE; localX++)
2473 2479 {
2474 2480 const tileX = snapshot.chunkX * CHUNK_SIZE + localX;
2475 2481 const tileY = snapshot.chunkY * CHUNK_SIZE + localY;
2476 this.#drawTile(tileX, tileY, tall.has(`${tileX},${tileY}`));
2482 this.#drawTile(tileX, tileY);
2477 2483 }
2478 2484 }
2479 2485 }
@@ -2965,7 +2971,7 @@ export class WorldView
2965 2971 }
2966 2972 }
2967 2973
2968 #drawTile (tileX, tileY, forceTall = null)
2974 #drawTile (tileX, tileY)
2969 2975 {
2970 2976 const chunkX = Math.floor(tileX / CHUNK_SIZE);
2971 2977 const chunkY = Math.floor(tileY / CHUNK_SIZE);
@@ -3022,18 +3028,22 @@ export class WorldView
3022 3028 objects.waterEdges = null;
3023 3029 }
3024 3030
3025 const tallEntry = (baked?.tallBlocks ?? []).find((entry) => entry.tileX === tileX && entry.tileY === tileY);
3026 const isTall = forceTall === true || !!tallEntry;
3027 if (isTall && tallEntry)
3031 const tileBlock = tileBlockSpriteEntry(
3032 this.catalog,
3033 this.game.images,
3034 snapshot.blocks[index],
3035 this.worldSeason
3036 );
3037 if (tileBlock)
3028 3038 {
3029 3039 const pivot = tilePivot(tileX, tileY, this.tileSize());
3030 objects.block = this.#ensureSprite(objects.block, tallEntry.sprite, SORT_ENTITY);
3040 objects.block = this.#ensureSprite(objects.block, tileBlock.sprite, SORT_ENTITY);
3031 3041 if (objects.block)
3032 3042 {
3033 3043 this.#placePivoted(objects.block, pivot.x, pivot.y, pivot.y, SORT_ENTITY);
3034 3044 this.#syncLitSprite(objects.block, objects.shadeAlpha ?? 0);
3035 3045 }
3036 objects.blockBloom = this.#placeBloomOverlay(objects.blockBloom, tallEntry.bloom, pivot, SORT_ENTITY);
3046 objects.blockBloom = this.#placeBloomOverlay(objects.blockBloom, tileBlock.bloom, pivot, SORT_ENTITY);
3037 3047 }
3038 3048 else
3039 3049 {
@@ -7,7 +7,7 @@ import { EQUIPMENT_SLOT, itemEquipSprite, itemSpriteName, itemDefinition } from
7import { resolveItemTint, resolveEquipTint, resolveItemDualTint, normalizeRgb } from "/shared/render/tint.js";
7import { resolveItemTint, resolveEquipTint, resolveItemDualTint, normalizeRgb } from "/shared/render/tint.js";
8import { normalizeGround, isWadeGroundInSeason, isWaterGround, isLiquidWaterGround, isGroundPassable, isBlockOccludingLight, LightOcclusion } from "/shared/definitions/tiles.js";
8import { normalizeGround, isWadeGroundInSeason, isWaterGround, isLiquidWaterGround, isGroundPassable, isBlockOccludingLight, LightOcclusion } from "/shared/definitions/tiles.js";
9import { spriteCenterFromPivot, spriteDrawSize, tilePivot, ySortLayer } from "/shared/render/pivot.js";
9import { spriteCenterFromPivot, spriteDrawSize, tilePivot, ySortLayer } from "/shared/render/pivot.js";
10import { bakeChunkAtlases } from "./chunkBake.js";
10import { bakeChunkAtlases, tileBlockSpriteEntry } from "./chunkBake.js";
11import { createChunkAtlasCache } from "./chunkAtlasCache.js";
11import { createChunkAtlasCache } from "./chunkAtlasCache.js";
12import
12import
13{
13{
@@ -1564,7 +1564,17 @@ export class WorldView
1564 { snapshot.blocks[index] = block; }
1564 { snapshot.blocks[index] = block; }
1565 if (light !== undefined)
1565 if (light !== undefined)
1566 { snapshot.light[index] = light; }
1566 { snapshot.light[index] = light; }
1567 const tileX = chunkX * CHUNK_SIZE + localX;
1568 const tileY = chunkY * CHUNK_SIZE + localY;
1569 if (block !== undefined)
1570 {
1571 this.#rebuildChunk(snapshot, { refreshSoftNeighbors: false });
1572 this.#drawTile(tileX, tileY);
1573 return;
1574 }
1567 this.#scheduleChunkRebuild(snapshot);
1575 this.#scheduleChunkRebuild(snapshot);
1576 if (ground !== undefined)
1577 { this.#drawTile(tileX, tileY); }
1568 }
1578 }
1569
1579
1570 /**
1580 /**
@@ -2463,17 +2473,13 @@ export class WorldView
2463
2473
2464 #relayoutChunkTiles (snapshot)
2474 #relayoutChunkTiles (snapshot)
2465 {
2475 {
2466 const baked = this.bakedChunks.get(`${snapshot.chunkX},${snapshot.chunkY}`);
2467 const tall = new Set(
2468 (baked?.tallBlocks ?? []).map((entry) => `${entry.tileX},${entry.tileY}`)
2469 );
2470 for (let localY = 0; localY < CHUNK_SIZE; localY++)
2476 for (let localY = 0; localY < CHUNK_SIZE; localY++)
2471 {
2477 {
2472 for (let localX = 0; localX < CHUNK_SIZE; localX++)
2478 for (let localX = 0; localX < CHUNK_SIZE; localX++)
2473 {
2479 {
2474 const tileX = snapshot.chunkX * CHUNK_SIZE + localX;
2480 const tileX = snapshot.chunkX * CHUNK_SIZE + localX;
2475 const tileY = snapshot.chunkY * CHUNK_SIZE + localY;
2481 const tileY = snapshot.chunkY * CHUNK_SIZE + localY;
2476 this.#drawTile(tileX, tileY, tall.has(`${tileX},${tileY}`));
2482 this.#drawTile(tileX, tileY);
2477 }
2483 }
2478 }
2484 }
2479 }
2485 }
@@ -2965,7 +2971,7 @@ export class WorldView
2965 }
2971 }
2966 }
2972 }
2967
2973
2968 #drawTile (tileX, tileY, forceTall = null)
2974 #drawTile (tileX, tileY)
2969 {
2975 {
2970 const chunkX = Math.floor(tileX / CHUNK_SIZE);
2976 const chunkX = Math.floor(tileX / CHUNK_SIZE);
2971 const chunkY = Math.floor(tileY / CHUNK_SIZE);
2977 const chunkY = Math.floor(tileY / CHUNK_SIZE);
@@ -3022,18 +3028,22 @@ export class WorldView
3022 objects.waterEdges = null;
3028 objects.waterEdges = null;
3023 }
3029 }
3024
3030
3025 const tallEntry = (baked?.tallBlocks ?? []).find((entry) => entry.tileX === tileX && entry.tileY === tileY);
3031 const tileBlock = tileBlockSpriteEntry(
3026 const isTall = forceTall === true || !!tallEntry;
3032 this.catalog,
3027 if (isTall && tallEntry)
3033 this.game.images,
3034 snapshot.blocks[index],
3035 this.worldSeason
3036 );
3037 if (tileBlock)
3028 {
3038 {
3029 const pivot = tilePivot(tileX, tileY, this.tileSize());
3039 const pivot = tilePivot(tileX, tileY, this.tileSize());
3030 objects.block = this.#ensureSprite(objects.block, tallEntry.sprite, SORT_ENTITY);
3040 objects.block = this.#ensureSprite(objects.block, tileBlock.sprite, SORT_ENTITY);
3031 if (objects.block)
3041 if (objects.block)
3032 {
3042 {
3033 this.#placePivoted(objects.block, pivot.x, pivot.y, pivot.y, SORT_ENTITY);
3043 this.#placePivoted(objects.block, pivot.x, pivot.y, pivot.y, SORT_ENTITY);
3034 this.#syncLitSprite(objects.block, objects.shadeAlpha ?? 0);
3044 this.#syncLitSprite(objects.block, objects.shadeAlpha ?? 0);
3035 }
3045 }
3036 objects.blockBloom = this.#placeBloomOverlay(objects.blockBloom, tallEntry.bloom, pivot, SORT_ENTITY);
3046 objects.blockBloom = this.#placeBloomOverlay(objects.blockBloom, tileBlock.bloom, pivot, SORT_ENTITY);
3037 }
3047 }
3038 else
3048 else
3039 {
3049 {
server/tests/chunk-atlas-baked-blocks.test.js added +36 −0
@@ -0,0 +1,36 @@
1 import test from "node:test";
2 import assert from "node:assert/strict";
3 import { BlockType } from "../../shared/definitions/tiles.js";
4 import { oreBoulderState } from "../../shared/definitions/materialTiers.js";
5 import
6 {
7 isChunkAtlasBakedBlock,
8 isPickablePlantBlock
9 } from "../../shared/definitions/tiles.js";
10
11 test("ore boulders are not chunk-atlas baked", () =>
12 {
13 assert.equal(isChunkAtlasBakedBlock({
14 typeId: BlockType.boulder,
15 state: oreBoulderState("copper")
16 }), false);
17 });
18
19 test("exhausted plain boulders may be chunk-atlas baked", () =>
20 {
21 assert.equal(isChunkAtlasBakedBlock({
22 typeId: BlockType.boulder,
23 state: "boulder"
24 }), true);
25 });
26
27 test("pickable plants are not chunk-atlas baked", () =>
28 {
29 assert.equal(isPickablePlantBlock({ typeId: BlockType.flower, state: "red" }), true);
30 assert.equal(isChunkAtlasBakedBlock({ typeId: BlockType.flower, state: "red" }), false);
31 });
32
33 test("stone walls remain chunk-atlas baked", () =>
34 {
35 assert.equal(isChunkAtlasBakedBlock({ typeId: BlockType.stoneWall }), true);
36 });
@@ -0,0 +1,36 @@
1import test from "node:test";
2import assert from "node:assert/strict";
3import { BlockType } from "../../shared/definitions/tiles.js";
4import { oreBoulderState } from "../../shared/definitions/materialTiers.js";
5import
6{
7 isChunkAtlasBakedBlock,
8 isPickablePlantBlock
9} from "../../shared/definitions/tiles.js";
10
11test("ore boulders are not chunk-atlas baked", () =>
12{
13 assert.equal(isChunkAtlasBakedBlock({
14 typeId: BlockType.boulder,
15 state: oreBoulderState("copper")
16 }), false);
17});
18
19test("exhausted plain boulders may be chunk-atlas baked", () =>
20{
21 assert.equal(isChunkAtlasBakedBlock({
22 typeId: BlockType.boulder,
23 state: "boulder"
24 }), true);
25});
26
27test("pickable plants are not chunk-atlas baked", () =>
28{
29 assert.equal(isPickablePlantBlock({ typeId: BlockType.flower, state: "red" }), true);
30 assert.equal(isChunkAtlasBakedBlock({ typeId: BlockType.flower, state: "red" }), false);
31});
32
33test("stone walls remain chunk-atlas baked", () =>
34{
35 assert.equal(isChunkAtlasBakedBlock({ typeId: BlockType.stoneWall }), true);
36});
shared/definitions/tiles.js +21 −0
@@ -552,6 +552,27 @@ export function isPickablePlantBlock (block)
552 552 return !!plantGatherForBlock(block);
553 553 }
554 554
555 /**
556 * Blocks baked into chunk atlas rows. Gather nodes and pickables stay as per-tile
557 * sprites so chunkDelta can hide or restyle them without rebaking the row.
558 */
559 export function isChunkAtlasBakedBlock (block)
560 {
561 if (!block)
562 { return false; }
563 const entry = normalizeBlock(block);
564 if (!entry)
565 { return false; }
566 const def = BLOCK_DEFINITIONS[entry.typeId];
567 if (!def || def.editorHidden)
568 { return false; }
569 if (resourceNodeDisplayName(entry))
570 { return false; }
571 if (isPickablePlantBlock(entry))
572 { return false; }
573 return true;
574 }
575
555 576 /**
556 577 * Editor palette cards: one entry per placeable, with boulder expanded into
557 578 * plain rock + each ore/coal variant (shared BlockType, distinct state).
@@ -552,6 +552,27 @@ export function isPickablePlantBlock (block)
552 return !!plantGatherForBlock(block);
552 return !!plantGatherForBlock(block);
553}
553}
554
554
555/**
556 * Blocks baked into chunk atlas rows. Gather nodes and pickables stay as per-tile
557 * sprites so chunkDelta can hide or restyle them without rebaking the row.
558 */
559export function isChunkAtlasBakedBlock (block)
560{
561 if (!block)
562 { return false; }
563 const entry = normalizeBlock(block);
564 if (!entry)
565 { return false; }
566 const def = BLOCK_DEFINITIONS[entry.typeId];
567 if (!def || def.editorHidden)
568 { return false; }
569 if (resourceNodeDisplayName(entry))
570 { return false; }
571 if (isPickablePlantBlock(entry))
572 { return false; }
573 return true;
574}
575
555/**
576/**
556 * Editor palette cards: one entry per placeable, with boulder expanded into
577 * Editor palette cards: one entry per placeable, with boulder expanded into
557 * plain rock + each ore/coal variant (shared BlockType, distinct state).
578 * plain rock + each ore/coal variant (shared BlockType, distinct state).
shared/render/chunkAtlasKeys.js +9 −4
@@ -1,5 +1,5 @@
1 1 import { CHUNK_SIZE } from "../protocol/constants.js";
2 import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock } from "../definitions/tiles.js";
2 import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock, isChunkAtlasBakedBlock } from "../definitions/tiles.js";
3 3 import { bloomImageName } from "../definitions/tileSprites.js";
4 4 import { resolveSeasonalVisualState } from "../world/season.js";
5 5 import { SOFT_TERRAIN_NEIGHBOR_DIRS } from "./softTerrain.js";
@@ -137,6 +137,8 @@ function blockFingerprint (catalog, block, season)
137 137 const entry = normalizeBlock(block);
138 138 if (!entry)
139 139 { return "_"; }
140 if (!isChunkAtlasBakedBlock(entry))
141 { return "_"; }
140 142 const def = BLOCK_DEFINITIONS[entry.typeId];
141 143 if (!def || def.editorHidden)
142 144 { return "_"; }
@@ -149,11 +151,14 @@ function bloomFingerprint (catalog, groundEntry, blockEntry, season)
149 151 {
150 152 const parts = [];
151 153 const groundBloom = groundBloomName(catalog, groundEntry, season);
152 const blockBloom = blockBloomName(catalog, blockEntry, season);
153 154 if (groundBloom)
154 155 { parts.push(`g:${groundBloom}`); }
155 if (blockBloom)
156 { parts.push(`b:${blockBloom}`); }
156 if (isChunkAtlasBakedBlock(normalizeBlock(blockEntry)))
157 {
158 const blockBloom = blockBloomName(catalog, blockEntry, season);
159 if (blockBloom)
160 { parts.push(`b:${blockBloom}`); }
161 }
157 162 return parts.length ? parts.join("+") : "_";
158 163 }
159 164
@@ -1,5 +1,5 @@
1import { CHUNK_SIZE } from "../protocol/constants.js";
1import { CHUNK_SIZE } from "../protocol/constants.js";
2import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock } from "../definitions/tiles.js";
2import { GROUND_DEFINITIONS, BLOCK_DEFINITIONS, GroundType, normalizeGround, normalizeBlock, isChunkAtlasBakedBlock } from "../definitions/tiles.js";
3import { bloomImageName } from "../definitions/tileSprites.js";
3import { bloomImageName } from "../definitions/tileSprites.js";
4import { resolveSeasonalVisualState } from "../world/season.js";
4import { resolveSeasonalVisualState } from "../world/season.js";
5import { SOFT_TERRAIN_NEIGHBOR_DIRS } from "./softTerrain.js";
5import { SOFT_TERRAIN_NEIGHBOR_DIRS } from "./softTerrain.js";
@@ -137,6 +137,8 @@ function blockFingerprint (catalog, block, season)
137 const entry = normalizeBlock(block);
137 const entry = normalizeBlock(block);
138 if (!entry)
138 if (!entry)
139 { return "_"; }
139 { return "_"; }
140 if (!isChunkAtlasBakedBlock(entry))
141 { return "_"; }
140 const def = BLOCK_DEFINITIONS[entry.typeId];
142 const def = BLOCK_DEFINITIONS[entry.typeId];
141 if (!def || def.editorHidden)
143 if (!def || def.editorHidden)
142 { return "_"; }
144 { return "_"; }
@@ -149,11 +151,14 @@ function bloomFingerprint (catalog, groundEntry, blockEntry, season)
149{
151{
150 const parts = [];
152 const parts = [];
151 const groundBloom = groundBloomName(catalog, groundEntry, season);
153 const groundBloom = groundBloomName(catalog, groundEntry, season);
152 const blockBloom = blockBloomName(catalog, blockEntry, season);
153 if (groundBloom)
154 if (groundBloom)
154 { parts.push(`g:${groundBloom}`); }
155 { parts.push(`g:${groundBloom}`); }
155 if (blockBloom)
156 if (isChunkAtlasBakedBlock(normalizeBlock(blockEntry)))
156 { parts.push(`b:${blockBloom}`); }
157 {
158 const blockBloom = blockBloomName(catalog, blockEntry, season);
159 if (blockBloom)
160 { parts.push(`b:${blockBloom}`); }
161 }
157 return parts.length ? parts.join("+") : "_";
162 return parts.length ? parts.join("+") : "_";
158}
163}
159
164