Class BlockApi
java.lang.Object
com.shanebeestudios.nms.api.world.block.BlockApi
API methods relating to
Blocks
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable BlockData
getBlockDataForPlacement
(@NotNull Player player, int maxDistance) Get the BlockData that would be placed at a specific positionstatic @Nullable BlockData
getBlockDataForPlacement
(@NotNull Player player, int maxDistance, ItemStack itemStack) Get the BlockData that would be placed at a specific positionstatic @Nullable BlockData
getBlockDataForPlacement
(@NotNull Player player, @NotNull Block hitBlock, @NotNull Location hitLocation, @NotNull BlockFace face) Get the BlockData that would be placed at a specific positionstatic @Nullable BlockData
getBlockDataForPlacement
(@NotNull Player player, @NotNull Block hitBlock, @NotNull Location hitLocation, @NotNull BlockFace face, @NotNull ItemStack itemStack) Get the BlockData that would be placed at a specific positionstatic 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)getForPlacement
(@NotNull Player player, int maxDistance) Get the BlockData that would be placed at a specific position as well as the location of the placementgetForPlacement
(@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
-
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 placingmaxDistance
- 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 placingmaxDistance
- Max distance to check foritemStack
- 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 placingmaxDistance
- 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 placingmaxDistance
- Max distance to check foritemStack
- 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 placinghitBlock
- The block that was hithitLocation
- The position of the player's cursorface
- 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 placinghitBlock
- The block that was hithitLocation
- The position of the player's cursorface
- The fact of the block relative to the hit blockitemStack
- 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 progressbukkitBlock
- Block to check for progress- Returns:
- Destroy progress of block by player
-