Class AxisPlacementRule

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

public class AxisPlacementRule
extends BlockPlacementRule
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Block block  
  • Constructor Summary

    Constructors 
    Constructor Description
    AxisPlacementRule​(Block block)  
  • Method Summary

    Modifier and Type Method Description
    short blockPlace​(Instance instance, Block block, BlockFace blockFace, Player pl)
    Called when the block is placed.
    short blockRefresh​(Instance instance, BlockPosition blockPosition, short currentId)
    Called when the block state id can be updated (for instance if a neighbour block changed).
    boolean canPlace​(Instance instance, BlockPosition blockPosition)
    Gets if the block can be placed in blockPosition.

    Methods inherited from class net.minestom.server.instance.block.rule.BlockPlacementRule

    getBlockId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • canPlace

      public boolean canPlace​(Instance instance, BlockPosition blockPosition)
      Description copied from class: BlockPlacementRule
      Gets if the block can be placed in blockPosition. Can for example, be used for blocks which have to be placed on a solid block.
      Specified by:
      canPlace in class BlockPlacementRule
      Parameters:
      instance - the instance of the block
      blockPosition - the position where the block is trying to get place
      Returns:
      true if the block placement position is valid
    • blockRefresh

      public short blockRefresh​(Instance instance, BlockPosition blockPosition, short currentId)
      Description copied from class: BlockPlacementRule
      Called when the block state id can be updated (for instance if a neighbour block changed).
      Specified by:
      blockRefresh in class BlockPlacementRule
      Parameters:
      instance - the instance of the block
      blockPosition - the block position
      currentId - the current block state id of the block
      Returns:
      the updated block state id
    • blockPlace

      public short blockPlace​(Instance instance, Block block, BlockFace blockFace, Player pl)
      Description copied from class: BlockPlacementRule
      Called when the block is placed.
      Specified by:
      blockPlace in class BlockPlacementRule
      Parameters:
      instance - the instance of the block
      block - the block placed
      blockFace - the block face
      pl - the player who placed the block
      Returns:
      the block state id of the placed block