Phantom Block
Phantom blocks are used where a block failed to load, or where a block errors and is unloaded.
The intention behind phantom blocks is to make BlockStorage act consistently even if the block is not loaded - i.e., if a block is broken, its block storage data should also be deleted. Additionally, phantom blocks allow us to persist data from blocks that have failed to load. In such cases, the data should not be deleted to avoid cases where an addon fails to load and all of its blocks get deleted when their chunk is loaded.
This is slightly hacky, but also by far the simplest way to accomplish this; a more 'clean' solution likely involves a lot more boilerplate and overhead, this is nice and intuitive and unlikely to clash with any changes in the future.
Properties
A packet based ItemDisplay sent to players who have customBlockTextures enabled.
Set this to true if your block should not have a blockTextureEntity for custom models/textures.
All the data needed to create or load the block.
Functions
Returns the item that should be used to display the block's texture.
Returns a map of custom block state properties to be used for the block texture item. These properties will be merged with the vanilla block state properties of the block.
Returns the item that the block should drop.
Returns the item that should be given when the block is middle clicked.
Returns settings associated with the block.
WAILA is the text that shows up when looking at a block to tell you what the block is.
Called as the block is being broken. At this point, the block break cannot be cancelled, but the physical block has not yet been broken or removed from io.github.pylonmc.rebar.block.BlockStorage.
Called after the block has been broken. At this point, the block has been physically removed, block drops have been dropped, and the block has been removed from io.github.pylonmc.rebar.block.BlockStorage.
Called after both the create constructor and the load constructor.
Called before the block is broken. Note this is not called for Deletions as those are not cancellable.
Call this method to refresh the block texture entity's item to be the result of getBlockTextureItem, or a barrier if that returns null.
Schedules the block texture item to be refreshed on the next server tick. See refreshBlockTextureItem.
Called when the block is saved.
Called when debug info is requested for the block by someone using the DebugWaxedWeatheredCutCopperStairs. If there is any transient data that can be useful for debugging, you're encouraged to serialize it here.