RebarGhostBlockHolder

A wrapper over RebarEntityHolderBlock which allows for 'ghost blocks' (like those used to show how to build a multiblock) to be managed. Each ghost block has a relative position and can display vanilla blocks, rebar blocks, or both.

Due to some annoying technicalities, vanilla blocks need to be displayed as a BlockDisplay and Rebar items as an ItemDisplay. So we operate a somewhat cursed system where either a BlockDisplay, ItemDisplay, or both are spawned. In the case where both are spawned, one of the displays is hidden while the other is shown as all the possible states are cycled through.

You can access the individual displays with getVanillaGhostBlockDisplay and getRebarGhostBlockDisplay. Keep in mind that any given position may have none, one, or both displays.

Inheritors

Types

Link copied to clipboard
Link copied to clipboard
open class GhostBlock<E : Entity> : RebarEntity<E>

Properties

Link copied to clipboard
abstract val block: Block
Link copied to clipboard
@get:ApiStatus.NonExtendable
open val heldEntities: MutableMap<String, UUID>

Functions

Link copied to clipboard
open fun addEntity(name: String, entity: RebarEntity<*>)
open fun addEntity(name: String, entity: Entity)
Link copied to clipboard
open fun addGhostBlock(position: Vector3i, vanillaBlocks: List<BlockData>, rebarBlocks: List<NamespacedKey>)
Link copied to clipboard
@ApiStatus.NonExtendable
open fun areAllHeldEntitiesLoaded(): Boolean

Returns false if any entity is unloaded or does not exist.

Link copied to clipboard
@ApiStatus.NonExtendable
open fun getHeldEntity(name: String): Entity?
@ApiStatus.NonExtendable
open fun <T : Entity> getHeldEntity(clazz: Class<T>, name: String): T?
Link copied to clipboard
@ApiStatus.NonExtendable
open fun getHeldEntityOrThrow(name: String): Entity
@ApiStatus.NonExtendable
open fun <T : Entity> getHeldEntityOrThrow(clazz: Class<T>, name: String): T
Link copied to clipboard
@ApiStatus.NonExtendable
open fun getHeldEntityUuid(name: String): UUID?
Link copied to clipboard
@ApiStatus.NonExtendable
open fun getHeldEntityUuidOrThrow(name: String): UUID
Link copied to clipboard
@ApiStatus.NonExtendable
open fun getHeldRebarEntity(name: String): RebarEntity<*>?
@ApiStatus.NonExtendable
open fun <T : RebarEntity<*>> getHeldRebarEntity(clazz: Class<T>, name: String): T?
Link copied to clipboard
@ApiStatus.NonExtendable
open fun <T : RebarEntity<*>> getHeldRebarEntityOrThrow(clazz: Class<T>, name: String): T
Link copied to clipboard
open fun hasGhostBlockAt(position: Vector3i): Boolean
Link copied to clipboard
@ApiStatus.NonExtendable
open fun isHeldEntityPresent(name: String): Boolean

Returns false if the block holds no entity with the provided name, the entity is unloaded or does not physically exist.

Link copied to clipboard
open fun removeGhostBlock(position: Vector3i)
Link copied to clipboard
Link copied to clipboard
open fun tryRemoveEntity(name: String)
Link copied to clipboard
@ApiStatus.NonExtendable
open fun whenHeldRebarEntityLoads(name: String, consumer: Consumer<RebarEntity<*>>)
@ApiStatus.NonExtendable
open fun <T : RebarEntity<*>> whenHeldRebarEntityLoads(clazz: Class<T>, name: String, consumer: Consumer<T>)