PhantomBlock

class PhantomBlock(val pdc: PersistentDataContainer, val erroredBlockKey: NamespacedKey, val block: Block) : PylonBlock(source)

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.

Constructors

Link copied to clipboard
constructor(pdc: PersistentDataContainer, erroredBlockKey: NamespacedKey, block: Block)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val blockTextureEntity: WrapperEntity?

A packet based ItemDisplay sent to players with customBlockTextures enabled.

Link copied to clipboard
Link copied to clipboard

Set this to true if your block should not have a blockTextureEntity for custom models/textures.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

All the data needed to create or load the block.

Functions

Link copied to clipboard

Returns the item that should be used to display the block's texture.

Link copied to clipboard
open override fun getDropItem(context: BlockBreakContext): ItemStack

Returns the item that the block should drop.

Link copied to clipboard
open override fun getPickItem(): ItemStack

Returns the item that should be given when the block is middle clicked.

Link copied to clipboard

Returns settings associated with the block.

Link copied to clipboard
open override fun getWaila(player: Player): WailaConfig?

WAILA is the text that shows up when looking at a block to tell you what the block is.

Link copied to clipboard

Called when the block is saved.

Link copied to clipboard

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.