Class BlockLever

All Implemented Interfaces:
BlockID, IBlockState, IMutableBlockState, AxisAlignedBB, Metadatable, Faceable, RedstoneComponent, Cloneable

@PowerNukkitDifference(info="Implements RedstoneComponent and uses methods from it.", since="1.4.0.0-PN") public class BlockLever extends BlockFlowable implements RedstoneComponent, Faceable
Author:
Nukkit Project Team
  • Field Details

  • Constructor Details

    • BlockLever

      public BlockLever()
    • BlockLever

      public BlockLever(int meta)
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in class Block
    • getId

      public int getId()
      Specified by:
      getId in class Block
    • getProperties

      @Since("1.4.0.0-PN") @PowerNukkitOnly @Nonnull public BlockProperties getProperties()
      Description copied from class: Block
      The properties that fully describe all possible and valid states that this block can have.
      Specified by:
      getProperties in interface IBlockState
      Specified by:
      getProperties in class BlockMeta
    • canBeActivated

      public boolean canBeActivated()
      Overrides:
      canBeActivated in class Block
    • getHardness

      public double getHardness()
      Description copied from class: Block
      控制方块硬度
      Overrides:
      getHardness in class BlockFlowable
      Returns:
      方块的硬度
    • getResistance

      public double getResistance()
      Description copied from class: Block
      控制方块爆炸抗性
      Overrides:
      getResistance in class BlockFlowable
      Returns:
      方块的爆炸抗性
    • toItem

      public Item toItem()
      Overrides:
      toItem in class Block
    • isPowerOn

      public boolean isPowerOn()
    • setPowerOn

      @PowerNukkitOnly @Since("1.4.0.0-P`N") public void setPowerOn(boolean powerOn)
    • getLeverOrientation

      @PowerNukkitOnly @Since("1.4.0.0-P`N") public BlockLever.LeverOrientation getLeverOrientation()
    • setLeverOrientation

      @PowerNukkitOnly @Since("1.4.0.0-P`N") public void setLeverOrientation(@Nullable BlockLever.LeverOrientation value)
    • onActivate

      public boolean onActivate(@Nonnull Item item, Player player)
      Overrides:
      onActivate in class Block
    • onUpdate

      @PowerNukkitDifference(info="Now, can be placed on solid blocks", since="1.4.0.0-PN") public int onUpdate(int type)
      Overrides:
      onUpdate in class Block
    • place

      @PowerNukkitDifference(info="Allows to be placed on walls",since="1.3.0.0-PN") @PowerNukkitDifference(info="Now, can be placed on solid blocks and always returns false if the placement fails",since="1.4.0.0-PN") public boolean place(@Nonnull Item item, @Nonnull Block block, @Nonnull Block target, @Nonnull BlockFace face, double fx, double fy, double fz, Player player)
      Description copied from class: Block
      Place and initialize a this block correctly in the world.

      The current instance must have level, x, y, z, and layer properties already set before calling this method.

      Overrides:
      place in class Block
      Parameters:
      item - The item being used to place the block. Should be used as an optional reference, may mismatch the block that is being placed depending on plugin implementations.
      block - The current block that is in the world and is getting replaced by this instance. It has the same x, y, z, layer, and level as this block.
      target - The block that was clicked to create the place action in this block position.
      face - The face that was clicked in the target block
      fx - The detailed X coordinate of the clicked target block face
      fy - The detailed Y coordinate of the clicked target block face
      fz - The detailed Z coordinate of the clicked target block face
      player - The player that is placing the block. May be null.
      Returns:
      true if the block was properly place. The implementation is responsible for reverting any partial change.
    • isSupportValid

      @PowerNukkitOnly @Since("1.4.0.0-PN") public static boolean isSupportValid(Block support, BlockFace face)
      Check if the given block and its block face is a valid support for a lever
      Parameters:
      support - The block that the lever is being placed against
      face - The face that the torch will be touching the block
      Returns:
      If the support and face combinations can hold the lever
    • onBreak

      @PowerNukkitDifference(info="Update redstone", since="1.4.0.0-PN") public boolean onBreak(Item item)
      Overrides:
      onBreak in class Block
    • getWeakPower

      public int getWeakPower(BlockFace side)
      Overrides:
      getWeakPower in class Block
    • getStrongPower

      public int getStrongPower(BlockFace side)
      Overrides:
      getStrongPower in class Block
    • isPowerSource

      public boolean isPowerSource()
      Overrides:
      isPowerSource in class Block
    • getWaterloggingLevel

      @PowerNukkitOnly public int getWaterloggingLevel()
      Overrides:
      getWaterloggingLevel in class Block
    • canBeFlowedInto

      public boolean canBeFlowedInto()
      Overrides:
      canBeFlowedInto in class BlockFlowable
    • getBlockFace

      @PowerNukkitDifference(info="Fixed the directions", since="1.3.0.0-PN") public BlockFace getBlockFace()
      Specified by:
      getBlockFace in interface Faceable
    • getColor

      public BlockColor getColor()
      Overrides:
      getColor in class BlockTransparentMeta