Skip to content

Add CraftEngineHook.getItemStack(id) lookup#2970

Merged
tastybento merged 1 commit into
developfrom
feature/craftengine-item-by-id
May 9, 2026
Merged

Add CraftEngineHook.getItemStack(id) lookup#2970
tastybento merged 1 commit into
developfrom
feature/craftengine-item-by-id

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Adds Optional<ItemStack> CraftEngineHook.getItemStack(String id) so addons can resolve a CraftEngine custom-item ID to a real ItemStack (with the correct texture / model data) without depending on CraftEngine directly
  • Mirrors the existing OraxenHook.getOptionalItemById and ItemsAdderHook.getItemStack shape so addon code can branch by hook uniformly

Why

The Level addon (and others) need to render custom blocks in GUIs. Oraxen and ItemsAdder both expose hook methods that return an ItemStack; CraftEngine did not, so panels fell back to Material.PAPER. See BentoBoxWorld/Level#426.

Implementation

Calls CraftEngineItems.byId(Key.of(id)) and, if the item is registered, returns customItem.buildItemStack() (the parameterless default on BuildableItem, which uses the empty build context).

Test plan

  • ./gradlew test — full suite passes
  • ./gradlew compileJava — compiles cleanly against craft-engine-bukkit:0.0.67
  • Manual: Level addon's /is value panel renders CraftEngine custom blocks with the correct icon and display name

🤖 Generated with Claude Code

Mirrors OraxenHook / ItemsAdderHook so addons can render the correct
icon and display name for CraftEngine custom blocks in panels and
GUIs without depending on CraftEngine directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@tastybento tastybento merged commit fecaa09 into develop May 9, 2026
3 checks passed
@tastybento tastybento deleted the feature/craftengine-item-by-id branch May 9, 2026 01:10
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.

1 participant