Add custom block support via BentoBox hooks (ItemsAdder, CraftEngine, Oraxen, Nexo)#165
Merged
Merged
Conversation
… Oraxen, Nexo) Generator block entries are now stored as string block IDs instead of Material: vanilla material names (COBBLESTONE) or provider-prefixed custom block IDs (itemsadder:namespace:id, craftengine:namespace:id, oraxen:id, nexo:id). Existing databases load unchanged because GSON already serialized Material values as their names. All third-party plugin access is routed through BentoBox core hooks via the new CustomBlocks utility, so the addon never depends on the plugins directly. ItemsAdder and CraftEngine blocks generate out of the box; Oraxen and Nexo IDs are accepted but degrade gracefully to the vanilla block until core hooks support placing them (BentoBoxWorld/BentoBox#3020, BentoBoxWorld/BentoBox#3025). - MagicGenerator validates picked IDs against the hooks and reports failures via /why - Listeners set vanilla blocks immediately; custom blocks are placed via their hook one tick later, since hook APIs set blocks directly - Panels render custom blocks with the provider item's texture and display name; the admin edit panel gains an Add Custom Block button with chat input validated against the hook registry - generatorTemplate.yml accepts quoted prefixed keys; unregistered custom blocks import with a warning so templates stay portable - BentoBox dependency bumped to 3.18.1 (CraftEngineHook needs 3.15.0+) Also fixes a pre-existing admin panel bug where editing a treasure's chance wrote the block list into the deprecated treasureChanceMap instead of updating treasureItemChanceMap. Addresses #103 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q63R7wAXARZD2Rpg3oun6m
CI failed with "class file has wrong version 69.0, should be 65.0" on every BentoBox class: the published 3.18.1 jar is compiled for Java 25, which the Java 21 toolchain used by this project (and its CI) cannot read. 3.17.0 is the newest Java 21-compatible release and contains all hook APIs used by the custom block support (CraftEngineHook.getItemStack landed in 3.16.0). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q63R7wAXARZD2Rpg3oun6m
- S1319: expose NavigableMap instead of TreeMap in GeneratorTierObject block-chance and material-height getters/setters (defensive copy on set) - S1192: extract duplicated template-context literal into a constant in StoneGeneratorImportManager - S3776/S6541: split MagicGenerator.processBlockReplacement into selectBlockId/isPlaceable/processTreasureDrop to cut cognitive complexity and Brain Method metrics - S3776: extract click-handler and min/max height buttons in GeneratorEditPanel to reduce cognitive complexity Updated call sites (MagicGenerator, CommonPanel) to the interface type. Full test suite: 165 tests, 0 failures. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q63R7wAXARZD2Rpg3oun6m
|
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
Adds plugin-agnostic custom block support to generators, addressing #103. Generator tiers can now produce blocks from ItemsAdder, CraftEngine, Oraxen and Nexo, with all plugin access routed through BentoBox core hooks so the addon never depends on the plugins directly.
How it works
COBBLESTONE) or provider-prefixed custom IDs (itemsadder:namespace:id,craftengine:namespace:id,oraxen:id,nexo:id). Existing databases load unchanged — GSON already serializedMaterialvalues as their names.utils/CustomBlockshelper parses provider prefixes and dispatches place/validate/icon/display-name calls throughItemsAdderHook/CraftEngineHook/OraxenHook.BlockState.MagicGeneratorvalidates the picked ID at generation time; unavailable custom blocks degrade gracefully to the vanilla block with a/whyreport.Provider status
Other changes
generatorTemplate.ymlaccepts quoted prefixed keys; unregistered custom blocks import with a warning so templates stay portable across servers.CraftEngineHookshipped in 3.15.0).treasureChanceMapinstead of updatingtreasureItemChanceMap.Testing
mvn test); new coverage for ID parsing, hook-absent rejection, and the Oraxen/Nexo placement gate inCustomBlocksTestandMagicGeneratorTest.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q63R7wAXARZD2Rpg3oun6m