RebarBlock

open class RebarBlock : Keyed(source)

Represents a Rebar block in the world.

All custom Rebar blocks extend this class. Every instance of this class is wrapping a real block in the world, and is stored in BlockStorage. All new block types must be registered using register.

An implementation of RebarBlock must have two constructors: one that takes a Block and a BlockCreateContext, and one that takes a Block and a PersistentDataContainer. The first constructor is known as the "create constructor", and is used when the block is created in the world. The second constructor is known as the "load constructor", and is used to reconstruct the block when the chunk containing the block is loaded.

See also

Inheritors

Constructors

Link copied to clipboard
constructor(block: Block, context: BlockCreateContext)

This constructor is called when a new block is created in the world.

constructor(block: Block, pdc: PersistentDataContainer)

This constructor is called when the block is loaded. For example, if the server restarts, we need to create a new RebarBlock instance, and we'll do it with this constructor.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

A packet based ItemDisplay sent to players who have 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
open override val key: NamespacedKey
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

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.

Link copied to clipboard

Returns the item that the block should drop.

Link copied to clipboard
open override fun getKey(): NamespacedKey
Link copied to clipboard
open 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 fun getWaila(player: Player): WailaDisplay?

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

Link copied to clipboard
open fun key(): @NotNull Key
Link copied to clipboard
open fun postInitialise()

Called after both the create constructor and the load constructor.

Link copied to clipboard

Call this method to refresh the block texture entity's item to be the result of getBlockTextureItem, or a barrier if that returns null.

Link copied to clipboard

Schedules the block texture item to be refreshed on the next server tick. See refreshBlockTextureItem.

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.