Creates a new instance of the block trait.
The block that this trait will be attached to.
Optional_options: JSONLikeObjectProtected ReadonlyblockThe block that this trait is attached to.
ReadonlycomponentThe block component that this trait is attached to.
Protected ReadonlydimensionThe dimension that the block is in.
ReadonlyidentifierThe identifier of the trait.
ReadonlystateThe block state key that this trait is attached to.
ReadonlytagThe block tag that this trait is attached to.
Static ReadonlycomponentThe block component that this trait is compatible with by default. If null, the trait will not attach to any block by default.
Static ReadonlyidentifierThe identifier of the trait.
Static ReadonlystateThe block state key that this trait is compatible with by default. If null, the trait will not be initialized by any block state.
Static ReadonlytagThe block tag that this trait is compatible with by default. If null, the trait will not attach to any block by default.
Static ReadonlytypesThe block type identifiers that this trait is compatible with by default.
ProtectedbreakBreaks the block on the next tick, dropping it, if it is still not held up then. Breaking a block updates its neighbours, so blocks held up by one another break one per tick, as in vanilla, rather than all at once, which spreads the work of breaking many blocks over many ticks.
Checks whether the block is held up.
ProtectedgetGets the block beside the door in a direction.
The direction of the block.
Whether a door placed by a player facing a direction hinges on its right: when there is a door to its left to pair with, or a full block to its right and not to its left.
The direction the player placing the door faces.
OptionalonCalled when the trait is added to an object.
OptionalonCalled when the block is broken in the world.
Whether the block break was successful; default is true.
OptionalonCalled when a container that is attached to the block is updated.
The container that was updated.
OptionalonCalled when the block is interacted with by a player.
The options of the block interaction.
Whether the interaction was successful; default is true.
OptionalonCalled when a player pick blocks the block.
The player that picked the block.
Whether the player picked the block with a data request.
Called when the block is placed in the world.
The options of the block placement.
Whether the block placement was successful; default is true.
OptionalonCalled when the trait is random ticked by the dimension.
OptionalonCalled when the trait is removed from an object.
OptionalonOptionalonCalled when the block is started to be broken in the world.
The player that started to break the block.
OptionalonCalled when the block is stopped to be broken in the world.
The player that stopped breaking the block.
OptionalonCalled when the trait is ticked by the dimension.
The details about the tick event.
OptionalonCalled when the block is updated in the world.
Optionalsource: BlockThe source of the update, if any.
Sets the probability of this trait being randomly ticked each tick.
The numerator of the probability fraction.
The denominator of the probability fraction.
Wether this trait should be randomly ticked this tick.
A factor to multiply the chance by. Default is 1.
True if the trait should be randomly ticked, false otherwise.
Places doors as vanilla does. The upper half goes in the space above, in the same state as the lower half, and a door hinges on its right when there is a door to its left to pair with, or a full block to its right and not to its left. Opening and closing both halves together is done by the open bit trait.