Class BlockDispenser

Direct Known Subclasses:
BlockDropper

public class BlockDispenser extends BlockContainer
  • Constructor Details

    • BlockDispenser

      public BlockDispenser()
  • Method Details

    • getDispensePosition

      public static org.bukkit.util.Vector getDispensePosition(GlowBlock block)
      Returns the position where an item will emerge from the dispenser.
      Parameters:
      block - a dispenser block
      Returns:
      the position as a Vector
    • getFacing

      public static org.bukkit.block.BlockFace getFacing(GlowBlock block)
      Returns the direction a dispenser is facing.
      Parameters:
      block - a dispenser block
      Returns:
      the facing direction
    • 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.
    • 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
    • getNeededMiningTool

      protected MaterialMatcher getNeededMiningTool(GlowBlock block)
      Overrides:
      getNeededMiningTool in class BlockContainer
    • 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.
    • 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
    • updatePhysicsAfterEvent

      public void updatePhysicsAfterEvent(GlowBlock me)
      Overrides:
      updatePhysicsAfterEvent in class BlockType
    • trigger

      public void trigger(GlowBlock block)
      Dispense an item from the given block if it's a dispenser.
      Parameters:
      block - the dispenser block