Class BlockApi

java.lang.Object
com.shanebeestudios.nms.api.world.block.BlockApi

public class BlockApi extends Object
API methods relating to Blocks
  • Constructor Details

    • BlockApi

      protected BlockApi()
      Do not use
  • Method Details

    • getForPlacement

      @Nullable public static @Nullable com.mojang.datafixers.util.Pair<Location,BlockData> getForPlacement(@NotNull @NotNull Player player, int maxDistance)
      Get the BlockData that would be placed at a specific position as well as the location of the placement
      Parameters:
      player - Player that would be placing
      maxDistance - Max distance to check for
      Returns:
      Pair of location and block data
    • getForPlacement

      @Nullable public static @Nullable com.mojang.datafixers.util.Pair<Location,BlockData> getForPlacement(@NotNull @NotNull Player player, int maxDistance, ItemStack itemStack)
      Get the BlockData that would be placed at a specific position as well as the location of the placement
      Parameters:
      player - Player that would be placing
      maxDistance - Max distance to check for
      itemStack - ItemStack to check for BlockData
      Returns:
      Pair of location and block data
    • getBlockDataForPlacement

      @Nullable public static @Nullable BlockData getBlockDataForPlacement(@NotNull @NotNull Player player, int maxDistance)
      Get the BlockData that would be placed at a specific position
      Parameters:
      player - Player that would be placing
      maxDistance - Max distance to check for
      Returns:
      BlockData of what would be placed
    • getBlockDataForPlacement

      @Nullable public static @Nullable BlockData getBlockDataForPlacement(@NotNull @NotNull Player player, int maxDistance, ItemStack itemStack)
      Get the BlockData that would be placed at a specific position
      Parameters:
      player - Player that would be placing
      maxDistance - Max distance to check for
      itemStack - ItemStack to check
      Returns:
      BlockData of what would be placed
    • getBlockDataForPlacement

      @Nullable public static @Nullable BlockData getBlockDataForPlacement(@NotNull @NotNull Player player, @NotNull @NotNull Block hitBlock, @NotNull @NotNull Location hitLocation, @NotNull @NotNull BlockFace face)
      Get the BlockData that would be placed at a specific position
      Parameters:
      player - Player that would be placing
      hitBlock - The block that was hit
      hitLocation - The position of the player's cursor
      face - The fact of the block relative to the hit block
      Returns:
      BlockData of what would be placed
    • getBlockDataForPlacement

      @Nullable public static @Nullable BlockData getBlockDataForPlacement(@NotNull @NotNull Player player, @NotNull @NotNull Block hitBlock, @NotNull @NotNull Location hitLocation, @NotNull @NotNull BlockFace face, @NotNull @NotNull ItemStack itemStack)
      Get the BlockData that would be placed at a specific position
      Parameters:
      player - Player that would be placing
      hitBlock - The block that was hit
      hitLocation - The position of the player's cursor
      face - The fact of the block relative to the hit block
      itemStack - ItemStack to try to place
      Returns:
      BlockData of what would be placed
    • getDestroyProgress

      @Deprecated(forRemoval=true, since="1.7.1") public static float getDestroyProgress(Player player, Block bukkitBlock)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Doesn't return what I thought it did (actually returns break speed)
      Get the destroy progress of a specific Block by a Player
      Parameters:
      player - Player to check for progress
      bukkitBlock - Block to check for progress
      Returns:
      Destroy progress of block by player