Class BlockBed


public class BlockBed extends BlockType
  • Constructor Details

    • BlockBed

      public BlockBed()
  • Method Details

    • setOccupied

      public static void setOccupied(GlowBlock head, GlowBlock foot, boolean occupied)
      Helper method for set whether the specified bed blocks are occupied.
      Parameters:
      head - head of the bed
      foot - foot of the bed
      occupied - if the bed is occupied by a player
    • isOccupied

      public static boolean isOccupied(GlowBlock block)
      Return whether the specified bed block is occupied.
      Parameters:
      block - part of the bed
      Returns:
      true if this bed is occupied, false if it is not
    • getHead

      public static GlowBlock getHead(GlowBlock block)
      Returns the head of a bed given one of its blocks.
      Parameters:
      block - part of the bed
      Returns:
      The head of the bed
    • getFoot

      public static GlowBlock getFoot(GlowBlock block)
      Returns the foot of a bed given one of its blocks.
      Parameters:
      block - part of the bed
      Returns:
      The foot of the bed
    • isValidSpawn

      public static boolean isValidSpawn(org.bukkit.Material material)
      Returns whether a player can spawn within a block of specified material.
      Parameters:
      material - the material
      Returns:
      Whether spawning is possible
    • getExitLocation

      public static org.bukkit.block.Block getExitLocation(GlowBlock head, GlowBlock foot)
      Returns an 'empty' block next to the bed used to put the player at when they exit a bed or respawn.
      Parameters:
      head - head of the bed
      foot - foot of the bed
      Returns:
      Exit block or null if all spots are blocked
    • getDrops

      @NotNull public @NotNull Collection<org.bukkit.inventory.ItemStack> getDrops(GlowBlock block, org.bukkit.inventory.ItemStack tool)
      Description copied from class: BlockType
      Get the items that will be dropped by digging the block.
      Overrides:
      getDrops in class BlockType
      Parameters:
      block - The block being dug.
      tool - The tool used or null if fists or no tool was used.
      Returns:
      The drops that should be returned.
    • canPlaceAt

      public boolean canPlaceAt(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace against)
      Description copied from class: BlockType
      Check whether the block can be placed at the given location.
      Overrides:
      canPlaceAt in class BlockType
      Parameters:
      player - The player who placed the block.
      block - The location the block is being placed at.
      against - The face the block is being placed against.
      Returns:
      Whether the placement is valid.
    • onNearBlockChanged

      public void onNearBlockChanged(GlowBlock block, org.bukkit.block.BlockFace face, GlowBlock changedBlock, org.bukkit.Material oldType, byte oldData, org.bukkit.Material newType, byte newData)
      Description copied from class: BlockType
      Called when a neighboring block (within a 3x3x3 cube) has changed its type or data and physics checks should occur.
      Overrides:
      onNearBlockChanged in class BlockType
      Parameters:
      block - The block to perform physics checks for
      face - The BlockFace to the changed block, or null if unavailable
      changedBlock - The neighboring block that has changed
      oldType - The old type of the changed block
      oldData - The old data of the changed block
      newType - The new type of the changed block
      newData - The new data of the changed block
    • placeBlock

      public void placeBlock(GlowPlayer player, GlowBlockState state, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding, org.bukkit.util.Vector clickedLoc)
      Description copied from class: BlockType
      Called when a block is placed to calculate what the block will become.
      Overrides:
      placeBlock in class BlockType
      Parameters:
      player - the player who placed the block
      state - the BlockState to edit
      face - the face off which the block is being placed
      holding - the ItemStack that was being held
      clickedLoc - where in the block the click occurred
    • createBlockEntity

      public BlockEntity createBlockEntity(GlowChunk chunk, int cx, int cy, int cz)
      Description copied from class: BlockType
      Create a new block entity at the given location.
      Overrides:
      createBlockEntity in class BlockType
      Parameters:
      chunk - The chunk to create the block entity at.
      cx - The x coordinate in the chunk.
      cy - The y coordinate in the chunk.
      cz - The z coordinate in the chunk.
      Returns:
      The new BlockEntity, or null if no block entity is used.
    • afterPlace

      public void afterPlace(GlowPlayer player, GlowBlock block, org.bukkit.inventory.ItemStack holding, GlowBlockState oldState)
      Description copied from class: BlockType
      Called after a block has been placed by a player.
      Overrides:
      afterPlace in class BlockType
      Parameters:
      player - the player who placed the block
      block - the block that was placed
      holding - the the ItemStack that was being held
      oldState - The old block state before the block was placed.
    • blockInteract

      public boolean blockInteract(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace face, org.bukkit.util.Vector clickedLoc)
      Description copied from class: BlockType
      Called when a player attempts to interact with (right-click) a block of this type already in the world.
      Overrides:
      blockInteract in class BlockType
      Parameters:
      player - the player interacting
      block - the block interacted with
      face - the clicked face
      clickedLoc - where in the block the click occurred
      Returns:
      Whether the interaction occurred.