Class BlockPlacementRule

java.lang.Object
net.minestom.server.instance.block.rule.BlockPlacementRule

public abstract class BlockPlacementRule extends Object
  • Field Details

    • DEFAULT_UPDATE_RANGE

      public static final int DEFAULT_UPDATE_RANGE
      See Also:
    • block

      protected final Block block
  • Constructor Details

    • BlockPlacementRule

      protected BlockPlacementRule(@NotNull @NotNull Block block)
  • 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

      public boolean isSelfReplaceable(@NotNull @NotNull BlockPlacementRule.Replacement replacement)
    • getBlock

      @NotNull public @NotNull Block 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.