Skip to content

Commit 0c1f627

Browse files
mvanhornclaude
andauthored
Warn about unsupported blocks after chunk loading (#1880)
* feat: warn about unsupported blocks after chunk loading Track block names that are not recognized by any BlockProvider in a concurrent set within BlockPalette. After chunk loading completes, log a warning listing the unsupported block names and suggesting the user update Chunky or check the minecraft label on GitHub. Fixes #1801 * refactor: move unsupported blocks check into loadChunks, use HashSet Address review feedback from @NotStirred: - Move unsupported blocks warning from Scene caller into loadChunks itself, since the check should run for all callers, not just the scene reload path - Change unsupportedBlocks from ConcurrentHashMap.newKeySet() to HashSet since put() locks internally and all puts complete before getUnsupportedBlocks Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1db9225 commit 0c1f627

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class BlockPalette {
6464

6565
private final Map<BlockSpec, Integer> blockMap;
6666
private List<Block> palette;
67+
private final Set<String> unsupportedBlocks = new HashSet<>();
6768

6869
private ReentrantLock lock = new ReentrantLock();
6970

@@ -131,6 +132,9 @@ public int put(BlockSpec spec) {
131132
id = palette.size();
132133
blockMap.put(spec, id);
133134
Block block = spec.toBlock();
135+
if (block instanceof UnknownBlock) {
136+
unsupportedBlocks.add(block.name);
137+
}
134138
applyMaterial(block);
135139
palette.add(block);
136140
return id;
@@ -139,6 +143,14 @@ public int put(BlockSpec spec) {
139143
}
140144
}
141145

146+
/**
147+
* Returns the set of block names that were not recognized by any block provider.
148+
* These blocks are rendered as {@link UnknownBlock}.
149+
*/
150+
public Set<String> getUnsupportedBlocks() {
151+
return Collections.unmodifiableSet(unsupportedBlocks);
152+
}
153+
142154
public Block get(int id) {
143155
if (id == ANY_ID)
144156
return stone;

chunky/src/java/se/llbit/chunky/renderer/scene/Scene.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,14 @@ public synchronized void loadChunks(TaskTracker taskTracker, World world, Map<Re
14661466

14671467
importMaterials();
14681468

1469+
if (palette != null) {
1470+
Set<String> unsupported = palette.getUnsupportedBlocks();
1471+
if (!unsupported.isEmpty()) {
1472+
Log.warn("Unsupported blocks found: " + String.join(", ", unsupported)
1473+
+ ". Consider updating Chunky or check https://github.com/chunky-dev/chunky/labels/minecraft for known issues.");
1474+
}
1475+
}
1476+
14691477
isLoading = false;
14701478
}
14711479

0 commit comments

Comments
 (0)