Skip to content

feat: add CraftEngineHook for centralised custom block support#2952

Merged
tastybento merged 1 commit intodevelopfrom
feat/craftengine-hook
Apr 21, 2026
Merged

feat: add CraftEngineHook for centralised custom block support#2952
tastybento merged 1 commit intodevelopfrom
feat/craftengine-hook

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Adds CraftEngineHook to the BentoBox hooks system, following the same pattern as ItemsAdderHook and OraxenHook
  • Registers it in BentoBoxHookRegistrar.registerLateHooks() and adds CraftEngine to plugin.yml soft-depends
  • Adds net.momirealms:craft-engine-bukkit/core provided compile dependencies and the MomiRealms Maven repo

API provided

Method Purpose
getBlockId(Location/Block) Returns the namespaced ID of the CE block at a location, or null
exists(String id) Checks whether a block ID is registered in CraftEngine
placeBlock(Location, String id) Places a CraftEngine custom block

Context

CraftEngine support was added to AOneBlock in PR #496 using direct API calls. The Level addon (BentoBoxWorld/Level#418) also needs CraftEngine block detection for island level calculation. Centralising the hook in BentoBox means neither addon needs a direct CraftEngine compile dependency, and future addons get the same benefit for free.

Dependent PRs:

  • AOneBlock: refactors to use this hook (direct CE imports removed)
  • Level: adds CE block counting using CraftEngineHook.getBlockId()

Test plan

  • Server starts with CraftEngine installed → hook registers, getHooks().getHook("CraftEngine").isPresent() returns true
  • Server starts without CraftEngine → hook silently skipped, no errors logged
  • CraftEngineHook.getBlockId(location) returns the correct namespaced ID for a placed CE block
  • CraftEngineHook.placeBlock(location, id) places the block (exercised via AOneBlock)

🤖 Generated with Claude Code

Centralises CraftEngine custom block access in a BentoBox hook,
following the same pattern as ItemsAdderHook and OraxenHook.
Provides static utility methods for block ID detection, registry
validation, and block placement so that addons do not need a direct
CraftEngine compile-time dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tastybento tastybento merged commit 2e4fa6a into develop Apr 21, 2026
1 check passed
@tastybento tastybento deleted the feat/craftengine-hook branch April 21, 2026 15:28
@sonarqubecloud
Copy link
Copy Markdown

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