Interface BlockCompat

All Known Implementing Classes:
NewBlockCompat

public interface BlockCompat
Methods which operate with blocks but are not compatible across some Minecraft versions.
  • Field Details

    • INSTANCE

      static final BlockCompat INSTANCE
      Instance of BlockCompat for current Minecraft version.
    • SETTER

      static final BlockSetter SETTER
  • Method Details

    • getBlockValues

      @Deprecated @Nullable @Nullable BlockValues getBlockValues(org.bukkit.block.BlockState block)
      Deprecated.
      Gets block values from a block state. They can be compared to other values if needed, but cannot be used to retrieve any other data.
      Parameters:
      block - Block state to retrieve value from.
      Returns:
      Block values.
    • getBlockValues

      @Nullable default @Nullable BlockValues getBlockValues(org.bukkit.block.Block block)
      Gets block values from a block. They can be compared to other values if needed, but cannot be used to retrieve any other data.
      Parameters:
      block - Block to retrieve value from.
      Returns:
      Block values.
    • getBlockValues

      @Nullable @Nullable BlockValues getBlockValues(org.bukkit.Material material)
    • getBlockValues

      @Nullable @Nullable BlockValues getBlockValues(org.bukkit.block.data.BlockData blockData)
    • getBlockValues

      @Nullable @Nullable BlockValues getBlockValues(org.bukkit.inventory.ItemStack stack)
      Gets block values from a item stack. They can be compared to other values if needed, but cannot be used to retrieve any other data.
      Parameters:
      stack - Item that would be placed as the block
      Returns:
      Block values.
    • fallingBlockToState

      @Deprecated org.bukkit.block.BlockState fallingBlockToState(org.bukkit.entity.FallingBlock entity)
      Deprecated.
      This shouldn't be used
      Creates a block state from a falling block.
      Parameters:
      entity - Falling block entity
      Returns:
      Block state.
    • getBlockValues

      @Nullable default @Nullable BlockValues getBlockValues(org.bukkit.entity.FallingBlock entity)
    • createBlockValues

      @Nullable @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String,String> states, @Nullable @Nullable org.bukkit.inventory.ItemStack item, int itemFlags)
      Creates new block values for given material and state. Item, if given, will be used to correct data value etc. when needed.
      Parameters:
      type - Block material.
      states - Block states, as used in /setblock command in Minecraft.
      item - Item form that may or may not provide additional information. Optional, but very useful on 1.12 and older.
      itemFlags - Additional information about item. See ItemFlags.
      Returns:
      Block values, or null if given state was invalid.
    • createBlockValues

      @Nullable default @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String,String> states)
      Creates new block values for given material and state.
      Parameters:
      type - Block material.
      states - Block states, as used in /setblock command in Minecraft.
      Returns:
      Block values, or null if given state was invalid.
    • getSetter

      BlockSetter getSetter()
      Gets block setter that understands block values produced by this compatibility layer.
      Returns:
      Block setter.
    • isEmpty

      boolean isEmpty(org.bukkit.Material type)
      Checks whether the given material implies emptiness. On Minecraft 1.13+, there are several blocks that do so.
      Parameters:
      type - Material of block.
      Returns:
      Whether the material implies empty block.
    • isLiquid

      boolean isLiquid(org.bukkit.Material type)
      Checks whether the given material is a liquid.
      Parameters:
      type - Material of block.
      Returns:
      Whether the material is liquid.