Class BlockVinesNether

All Implemented Interfaces:
BlockID, IBlockState, IMutableBlockState, AxisAlignedBB, Metadatable, Cloneable
Direct Known Subclasses:
BlockVinesTwisting, BlockVinesWeeping

@PowerNukkitOnly @Since("1.4.0.0-PN") public abstract class BlockVinesNether extends BlockTransparentMeta
Implements the main logic of all nether vines.
Author:
joserobjr
  • Constructor Details

  • Method Details

    • getGrowthDirection

      @PowerNukkitOnly @Since("1.4.0.0-PN") @Nonnull public abstract BlockFace getGrowthDirection()
      The direction that the vine will grow, vertical direction is expected but future implementations may also add horizontal directions.
      Returns:
      Normally, up or down.
    • getVineAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") public abstract int getVineAge()
      The current age of this block.
    • setVineAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") public abstract void setVineAge(int vineAge) throws InvalidBlockPropertyValueException
      Changes the age of this block.
      Parameters:
      vineAge - The new age
      Throws:
      InvalidBlockPropertyValueException - If the value is outside the accepted range from 0 to getMaxVineAge(), both inclusive.
    • getMaxVineAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") public abstract int getMaxVineAge()
      The maximum accepted age of this block.
      Returns:
      Positive, inclusive value.
    • randomizeVineAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") public void randomizeVineAge(boolean pseudorandom)
      Changes the current vine age to a random new random age.
      Parameters:
      pseudorandom - If the the randomization should be pseudorandom.
    • place

      public boolean place(@Nonnull Item item, @Nonnull Block block, @Nonnull Block target, @Nonnull BlockFace face, double fx, double fy, double fz, @Nullable 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.
    • onUpdate

      public int onUpdate(int type)
      Overrides:
      onUpdate in class Block
    • grow

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean grow()
      Grow a single vine if possible. Calls BlockGrowEvent passing the positioned new state and the source block.
      Returns:
      If the vine grew successfully.
    • growMultiple

      @PowerNukkitOnly @Since("1.4.0.0-PN") public int growMultiple()
      Grow a random amount of vines. Calls BlockGrowEvent passing the positioned new state and the source block for each new vine being added to the world, if one of the events gets cancelled the growth gets interrupted.
      Returns:
      How many vines grew
    • findVineAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") @Nonnull public OptionalInt findVineAge(boolean base)
      Attempt to get the age of the root or the head of the vine.
      Parameters:
      base - True to get the age of the base (oldest block), false to get the age of the head (newest block)
      Returns:
      Empty if the target could not be reached. The age of the target if it was found.
    • findVineBlock

      @PowerNukkitOnly @Since("1.4.0.0-PN") @Nonnull public Optional<BlockVinesNether> findVineBlock(boolean base)
      Attempt to find the root or the head of the vine transversing the growth direction for up to 256 blocks.
      Parameters:
      base - True to find the base (oldest block), false to find the head (newest block)
      Returns:
      Empty if the target could not be reached or the block there isn't an instance of BlockVinesNether. The positioned block of the target if it was found.
    • findVine

      @PowerNukkitOnly @Since("1.4.0.0-PN") @Nonnull public Optional<Position> findVine(boolean base)
      Attempt to find the root or the head of the vine transversing the growth direction for up to 256 blocks.
      Parameters:
      base - True to find the base (oldest block), false to find the head (newest block)
      Returns:
      Empty if the target could not be reached. The position of the target if it was found.
    • increaseRootAge

      @PowerNukkitOnly @Since("1.4.0.0-PN") @Nonnull public OptionalBoolean increaseRootAge()
      Attempts to increase the age of the base of the nether vine.
      Returns:
      • EMPTY if the base could not be reached or have an invalid instance type
      • TRUE if the base was changed successfully
      • FALSE if the base was already in the max age or the block change was refused
    • onActivate

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

      public Item[] getDrops(Item item)
      Description copied from class: Block
      控制方块被破坏时掉落的物品 常在Level.useBreakOn(Vector3, int, BlockFace, Item, Player, boolean, boolean)方法被调用
      Overrides:
      getDrops in class Block
      Returns:
      掉落的物品数组
    • isSupportValid

      @PowerNukkitOnly @Since("1.4.0.0-PN") protected boolean isSupportValid(@Nonnull Block support)
    • isSupportValid

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean isSupportValid()
    • onEntityCollide

      public void onEntityCollide(Entity entity)
      Overrides:
      onEntityCollide in class Block
    • hasEntityCollision

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

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

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

      public boolean canBeClimbed()
      Overrides:
      canBeClimbed in class Block
    • canBeFlowedInto

      public boolean canBeFlowedInto()
      Overrides:
      canBeFlowedInto in class Block
    • isSolid

      public boolean isSolid()
      Overrides:
      isSolid in class Block
    • getMinX

      public double getMinX()
      Specified by:
      getMinX in interface AxisAlignedBB
      Overrides:
      getMinX in class Block
    • getMinZ

      public double getMinZ()
      Specified by:
      getMinZ in interface AxisAlignedBB
      Overrides:
      getMinZ in class Block
    • getMaxX

      public double getMaxX()
      Specified by:
      getMaxX in interface AxisAlignedBB
      Overrides:
      getMaxX in class Block
    • getMaxZ

      public double getMaxZ()
      Specified by:
      getMaxZ in interface AxisAlignedBB
      Overrides:
      getMaxZ in class Block
    • getMaxY

      public double getMaxY()
      Specified by:
      getMaxY in interface AxisAlignedBB
      Overrides:
      getMaxY in class Block
    • canPassThrough

      public boolean canPassThrough()
      Overrides:
      canPassThrough in class Block
    • sticksToPiston

      @PowerNukkitOnly public boolean sticksToPiston()
      Overrides:
      sticksToPiston in class Block
    • breaksWhenMoved

      @PowerNukkitOnly public boolean breaksWhenMoved()
      Overrides:
      breaksWhenMoved in class Block
    • canBeActivated

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

      public boolean canSilkTouch()
      Overrides:
      canSilkTouch in class Block
    • clone

      public BlockVinesNether clone()
      Specified by:
      clone in interface AxisAlignedBB
      Overrides:
      clone in class Block