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.
ProtectedkindHow the block is held up.
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.
Gets the face of the block that the block holding this one up is on, if it needs one.
ProtectedisWhether a hanging sign on a wall is held up from one of its sides: by the block on that side, or, when that is another hanging sign in line with it, by what holds up the line of signs on that side. Signs in a line do not hold each other up, so the line breaks when nothing at either end holds it.
The side of the sign.
ProtectedisWhether the chunk holding a position is loaded.
The position to check.
Whether the block holding this one up is still there.
ProtectedisWhether the block on a face of this block holds it up.
The face of the block holding this one up.
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.
Called when the block is updated in the world.
Optionalsource: BlockThe source of the update, if any.
ProtectedsetSets the direction of a lever from the face it was placed on. Levers on the top or bottom of a block lie along the direction the player faces.
The face the lever was placed on.
Optionaldirection: CardinalDirectionThe direction the player placing the lever faces.
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.
Breaks blocks, dropping them, when the block holding them up is removed: buttons, levers, ladders, wall and standing signs, banners, item frames, pressure plates, carpets, candles, rails, redstone dust, repeaters, comparators, doors and lanterns. They also cannot be placed where nothing holds them up.