Class McBlockState

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

public class McBlockState extends Object
Wrapper for Minecraft BlockState

Provides easy-to-use mapped methods for BlockStates

Keep in mind, a Minecraft BlockState differs from a Bukkit BlockState. A Minecraft BlockState is basically like Bukkit's BlockData

  • Method Details

    • wrap

      public static McBlockState wrap(net.minecraft.world.level.block.state.BlockState blockState)
      Wrap a Minecraft BlockState as an McBlockState
      Parameters:
      blockState - BlockState to wrap
      Returns:
      Wrapper for Minecraft BlockState
    • wrap

      public static McBlockState wrap(BlockData blockData)
      Wrap a Bukkit BlockData as a Minecraft BlockState
      Parameters:
      blockData - BlockData to wrap
      Returns:
      Wrapper for Minecraft BlockState
    • getBlock

      public net.minecraft.world.level.block.Block getBlock()
      Get the Block of this BlockState
      Returns:
      Block of this BlockState
    • getMcBlock

      public McBlock getMcBlock()
      Get a wrapped Block of this BlockState
      Returns:
      Wrapped Block of this BlockState
    • canSurvive

      public boolean canSurvive(Location location)
      Check if this BlockState can survive at a location

      Example of this would be checking if sand is supported or a block can be placed over farmland/dirt path

      Parameters:
      location - Location to check for survival
      Returns:
      True if this BlockState can survive at this Location
    • entityCanStandOn

      public boolean entityCanStandOn(Entity bukkitEntity)
      Check if an Entity can stand on this BlockState
      Parameters:
      bukkitEntity - Entity to check if it can stand on this BlockState
      Returns:
      True if the Entity can stand on this BlockState
    • canBeReplaced

      public boolean canBeReplaced()
      Check if this BlockState can be replaced
      Returns:
      True if it can be replaced
    • getCollisionShape

      public net.minecraft.world.phys.shapes.VoxelShape getCollisionShape(Location location)
      Get the collision shape of this BlockState at a location in the world
      Parameters:
      location - Location to check for shape
      Returns:
      VoxelShape of BlockState at location
    • getMapColor

      public net.minecraft.world.level.material.MapColor getMapColor(Location location)
      Get the MapColor this BlockState will appear on a map
      Parameters:
      location - Location of BlockState to test for color
      Returns:
      MapColor of BlockState at given Location