Skip to content

feat(hooks): add CraftEngineHook.getItemId(item) lookup#2973

Merged
tastybento merged 1 commit into
developfrom
feat/craftengine-item-helpers
May 9, 2026
Merged

feat(hooks): add CraftEngineHook.getItemId(item) lookup#2973
tastybento merged 1 commit into
developfrom
feat/craftengine-item-helpers

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Adds CraftEngineHook.getItemId(ItemStack) returning the namespaced ID of a held CraftEngine custom item, or null when the item is not a CraftEngine custom item.
  • Mirrors the existing getItemStack(id) helper (added in 9d3715a) so addons can map both directions without depending on CraftEngine directly.

Why

Needed for the Level addon fix to issue BentoBoxWorld/Level#428. The addon's /is value hand command and value-panel icon lookup both need to recognize a held CraftEngine item; without this helper they fall back to the vanilla material (PAPER) and report "no value".

Test plan

  • ./gradlew compileJava passes
  • CI test suite green

Mirrors the recently-added getItemStack(id) helper. Lets addon command
handlers (e.g. /is value hand in Level addon) recognize a held
CraftEngine custom item 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 9, 2026

@tastybento tastybento merged commit 9a2045c into develop May 9, 2026
3 checks passed
@tastybento tastybento deleted the feat/craftengine-item-helpers branch May 9, 2026 22:04
msmith-codes pushed a commit to msmith-codes/Level that referenced this pull request May 12, 2026
Three call sites were missing CraftEngine support, so /is value hand
returned "no value" for held CraftEngine items, the value panel showed
a paper icon with the prettified namespaced key, and the chat output
used the raw key instead of the configured display name:

- Level.getCustomBlockId now checks CraftEngineHook.getItemId, so a
  held custom item is mapped to its namespaced ID.
- Utils.getCustomBlockItemStack now delegates to
  CraftEngineHook.getItemStack so the panel renders the real icon.
- Utils.getCustomBlockDisplayName now also reads the modern
  minecraft:item_name component (hasItemName/getItemName) used by
  CraftEngine, in addition to the legacy display.Name used by Oraxen,
  Nexo, and ItemsAdder.
- IslandValueCommand.printValue routes string IDs through the same
  getCustomBlockItemStack/getCustomBlockDisplayName path used by the
  panel, so the chat message shows the configured display name.

Requires BentoBox >= 3.15.1-SNAPSHOT (BentoBoxWorld/BentoBox#2973 for
the new getItemId helper).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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