Skip to content

feat: warn about unsupported blocks after chunk loading#1880

Open
mvanhorn wants to merge 2 commits intochunky-dev:masterfrom
mvanhorn:osc/1801-warn-unsupported-blocks
Open

feat: warn about unsupported blocks after chunk loading#1880
mvanhorn wants to merge 2 commits intochunky-dev:masterfrom
mvanhorn:osc/1801-warn-unsupported-blocks

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 9, 2026

Summary

After loading chunks, Chunky now logs a warning listing any block types that weren't recognized by any BlockProvider. The warning suggests updating Chunky or checking the minecraft label on GitHub.

Changes

  • BlockPalette.java: Added a ConcurrentHashMap.KeySetView<String> to collect unknown block names during put(). Added getUnsupportedBlocks() accessor.
  • Scene.java: After loadChunks() returns, checks the palette for unsupported blocks and logs a warning if any are found.

Testing

  • Could not run Gradle build locally (no Java runtime), but the changes follow existing patterns in the codebase

Fixes #1801

This contribution was developed with AI assistance (Claude Code).

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 chunky-dev#1801
Comment on lines 578 to 585
if (palette != null) {
Set<String> unsupported = palette.getUnsupportedBlocks();
if (!unsupported.isEmpty()) {
Log.warn("Unsupported blocks found: " + String.join(", ", unsupported)
+ ". Consider updating Chunky or check https://github.com/chunky-dev/chunky/labels/minecraft for known issues.");
}
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only hit when loading an existing scene that doesn't have an octree

Should probably do this inside loadChunks itself


private final Map<BlockSpec, Integer> blockMap;
private List<Block> palette;
private final Set<String> unsupportedBlocks = ConcurrentHashMap.newKeySet();
Copy link
Copy Markdown
Member

@NotStirred NotStirred Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put locks internally, and we're guaranteed that all puts have finished by the time chunkloading is finished (and getUnsupportedBlocks is called).

Can use HashMap to avoid extra work in chunk loading hot path (@leMaik is this worth the performance? In <=1.12 palette is around 50% of chunk loading, >1.12 it's about 5%)

Would probably need some comments explaining that exactly what's going on with the concurrent access (I'll do that after merge)

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>
@mvanhorn
Copy link
Copy Markdown
Author

Addressed in cb75335:

  • Moved the unsupported blocks check from the Scene caller into loadChunks itself, so it runs for all callers (not just the scene reload path)
  • Changed unsupportedBlocks from ConcurrentHashMap.newKeySet() to HashSet since put() locks internally and all puts complete before getUnsupportedBlocks() is called

@NotStirred NotStirred requested a review from leMaik April 12, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn about unsupported blocks

2 participants