Fix false "Bad custom block" errors for CraftEngine blocks on startup#511
Merged
tastybento merged 2 commits intodevelopfrom Apr 29, 2026
Merged
Fix false "Bad custom block" errors for CraftEngine blocks on startup#511tastybento merged 2 commits intodevelopfrom
tastybento merged 2 commits intodevelopfrom
Conversation
Closed
…initial load CraftEngineCustomBlock.fromMap() no longer delegates to fromId() (which calls CraftEngineHook.exists()). When a YAML entry explicitly declares type: craftengine the block type is already unambiguous, so the CraftEngineCustomBlock is created directly from the id field without requiring CraftEngine's block registry to be populated yet. The fromId() path (used by the short-form creator) keeps the exists() check so it can still distinguish CraftEngine IDs from vanilla material names. Fixes: invalid runtime error on startup when CraftEngine fires its reload event after AOneBlock has already attempted to load phases. Agent-Logs-Url: https://github.com/BentoBoxWorld/AOneBlock/sessions/7e16e2d1-e9ec-4551-b155-ebb10c178074 Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bad custom block error in CraftEngine
Fix false "Bad custom block" errors for CraftEngine blocks on startup
Apr 28, 2026
|
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.



AOneBlock's
onEnableruns before CraftEngine populates its block registry, soCraftEngineHook.exists(id)returnsfalsefor every validtype: craftengineblock — flooding the log withERROR: Bad custom blockon every phase that uses CraftEngine blocks. The blocks work fine becauseCraftEngineListenertriggers a full phase reload onCraftEngineReloadEvent, at which point the registry is ready.Changes
CraftEngineCustomBlock.fromMap()— decoupled fromfromId(). When a YAML entry explicitly declarestype: craftengine, the block type is unambiguous; the object is now created directly from theidfield without consulting the registry:fromId()retains theexists()check — it doubles as the short-form creator and must not greedily match vanilla material names.Added
fromMapReturnsPresentWhenIdProvidedtest to cover the previously broken path.