Class BlockPlacementRule
java.lang.Object
net.minestom.server.instance.block.rule.BlockPlacementRule
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static final record
static final record
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable Block
blockPlace
(@NotNull BlockPlacementRule.PlacementState placementState) Called when the block is placed.@NotNull Block
blockUpdate
(@NotNull BlockPlacementRule.UpdateState updateState) Called when the block state id can be updated (for instance if a neighbour block changed).@NotNull Block
getBlock()
boolean
isSelfReplaceable
(@NotNull BlockPlacementRule.Replacement replacement) int
The max distance where a block update can be triggered.
-
Field Details
-
DEFAULT_UPDATE_RANGE
public static final int DEFAULT_UPDATE_RANGE- See Also:
-
block
-
-
Constructor Details
-
BlockPlacementRule
-
-
Method Details
-
blockUpdate
@NotNull public @NotNull Block blockUpdate(@NotNull @NotNull BlockPlacementRule.UpdateState updateState) Called when the block state id can be updated (for instance if a neighbour block changed). This is first called on a newly placed block, and then this is called for all neighbors of the block- Parameters:
updateState
- The current parameters to the block update- Returns:
- the updated block
-
blockPlace
@Nullable public abstract @Nullable Block blockPlace(@NotNull @NotNull BlockPlacementRule.PlacementState placementState) Called when the block is placed. It is recommended that you only set up basic properties on the block for this placement, such as determining facing, etc- Parameters:
placementState
- The current parameters to the block placement- Returns:
- the block to place,
null
to cancel
-
isSelfReplaceable
-
getBlock
-
maxUpdateDistance
public int maxUpdateDistance()The max distance where a block update can be triggered. It is not based on block, so if the value is 3 and a completely different block updates 3 blocks away it could still trigger an update.
-