feat: support item model keys and namespaced materials for blueprint bundle icon#2941
Merged
tastybento merged 5 commits intodevelopfrom Apr 14, 2026
Merged
Conversation
…bundle icon The "icon" field in blueprint bundle JSON files now accepts three formats: - Plain material name: "DIAMOND" - Vanilla namespaced material: "minecraft:diamond" - Custom item model key: "myserver:island_tropical" Material.matchMaterial() is tried first, handling plain names and vanilla namespaced keys. If the string contains a colon and is not a recognised vanilla material, it is treated as a custom item model key applied to a PAPER base item via ItemMeta.setItemModel(). getIcon() (returning Material) is preserved for binary compatibility. getIconItemStack() is the new method that returns the full ItemStack with model data applied. Panels now call getIconItemStack() to render icons. Closes #2940 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When an admin clicks an item from their inventory to set a blueprint bundle icon, IconChanger now checks ItemMeta.hasItemModel() first. If the item carries a custom model key (e.g. paper[item_model="myserver:island_tropical"]), that NamespacedKey string is stored instead of the plain Material name, preserving the full item model through to getIconItemStack(). Plain material items continue to work exactly as before. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Applies the same logic as BlueprintBundle to Blueprint.java: - icon field changed from Material to String internally - getIcon() preserved (returns Material, backward compatible) - getIconItemStack() added — resolves plain names, minecraft: keys, and custom item-model keys (PAPER base + ItemMeta.setItemModel) - setIcon(Material) and setIcon(String) both fluently return Blueprint BlueprintManagementPanel now calls blueprint.getIconItemStack() so custom-model icons are visible to admins in the management GUI. IconChanger also applies item-model detection in the blueprint branch, so admins can click a datapacked item to set a blueprint icon the same way as a bundle icon. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
…ation SonarCloud flagged 8.9% code duplication and repeated "PAPER" literals. - Add ItemParser.parseIconMaterial() and parseIconItemStack() as the single source of truth for icon string resolution - Both BlueprintBundle and Blueprint now delegate to these methods instead of duplicating the logic - Replace repeated "PAPER" string literals with a DEFAULT_ICON constant in each class - Remove unused Sound import from IconChangerTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Resolves #2940
The
"icon"field in blueprint bundle JSON files now accepts three formats without any change to existing configs:"icon": "DIAMOND""icon": "minecraft:diamond""icon": "myserver:island_tropical"How it works
Material.matchMaterial()is tried first — this handles both plain names and vanilla namespaced keys. If the string contains a:and is not a recognised vanilla material, it is treated as a custom item model key applied to aPAPERbase item viaItemMeta.setItemModel(NamespacedKey).Backward compatibility
getIcon()(returnsMaterial) is unchanged in signature — existing addons that call this continue to work, receivingPAPERfor custom model keys.getIconItemStack()method returns the fullItemStackwith model data applied.setIcon(Material)overload preserved; newsetIcon(String)overload added.BlueprintManagementPanel,IslandCreationPanel) updated to callgetIconItemStack()so custom model icons actually render.Test plan
BlueprintBundleTestcovers: plain name,minecraft:namespaced, custom model key, null/fallback casesBlueprintManagementPanelTestandIslandCreationPanelTestupdated withgetIconItemStack()stubs🤖 Generated with Claude Code