Class NewBlockCompat

java.lang.Object
ch.njol.skript.bukkitutil.block.NewBlockCompat
All Implemented Interfaces:
BlockCompat

public class NewBlockCompat extends Object implements BlockCompat
1.13+ block compat.
  • Constructor Details

    • NewBlockCompat

      public NewBlockCompat()
  • Method Details

    • getBlockValues

      public @Nullable BlockValues getBlockValues(org.bukkit.block.BlockState block)
      Description copied from interface: BlockCompat
      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.
      Specified by:
      getBlockValues in interface BlockCompat
      Parameters:
      block - Block state to retrieve value from.
      Returns:
      Block values.
    • getBlockValues

      public @Nullable BlockValues getBlockValues(org.bukkit.inventory.ItemStack stack)
      Description copied from interface: BlockCompat
      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.
      Specified by:
      getBlockValues in interface BlockCompat
      Parameters:
      stack - Item that would be placed as the block
      Returns:
      Block values.
    • getSetter

      public BlockSetter getSetter()
      Description copied from interface: BlockCompat
      Gets block setter that understands block values produced by this compatibility layer.
      Specified by:
      getSetter in interface BlockCompat
      Returns:
      Block setter.
    • fallingBlockToState

      public org.bukkit.block.BlockState fallingBlockToState(org.bukkit.entity.FallingBlock entity)
      Description copied from interface: BlockCompat
      Creates a block state from a falling block.
      Specified by:
      fallingBlockToState in interface BlockCompat
      Parameters:
      entity - Falling block entity
      Returns:
      Block state.
    • createBlockValues

      public @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String,String> states, @Nullable org.bukkit.inventory.ItemStack item, int itemFlags)
      Description copied from interface: BlockCompat
      Creates new block values for given material and state. Item, if given, will be used to correct data value etc. when needed.
      Specified by:
      createBlockValues in interface BlockCompat
      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.
    • isEmpty

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

      public boolean isLiquid(org.bukkit.Material type)
      Description copied from interface: BlockCompat
      Checks whether the given material is a liquid.
      Specified by:
      isLiquid in interface BlockCompat
      Parameters:
      type - Material of block.
      Returns:
      Whether the material is liquid.