Interface BlockCompatibility


public interface BlockCompatibility
This interface outlines a version dependant api that return values based on different Block inputs. There should be an implementing class for each minecraft protocol version.

For methods that return packets, in order for those packets to be visible to players, the packets need to be sent to the players. See ICompatibility.sendPackets(Player, Object).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final AtomicInteger
    Threadsafe method to get unique ids for block cracking.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Object
    getCrackPacket(@NotNull org.bukkit.block.Block block, int crack)
    Returns a block break animation packet for the given block and crack.
    @NotNull Object
    getCrackPacket(@NotNull org.bukkit.block.Block block, int crack, int id)
    Returns a block break animation packet for the given block and crack.
  • Field Details

  • Method Details

    • getCrackPacket

      @NotNull @NotNull Object getCrackPacket(@NotNull @NotNull org.bukkit.block.Block block, int crack)
      Returns a block break animation packet for the given block and crack. This should probably not be used for transparent blocks. This method is a shorthand for getCrackPacket(Block, int, int).

      For more information, please see the protocol wiki.

      Parameters:
      block - The non-null block to display the cracking animation over.
      crack - The cracking amount, between 0 and 9 inclusively. Higher values are more visibly cracked.
      Returns:
      The non-null animation packet.
    • getCrackPacket

      @NotNull @NotNull Object getCrackPacket(@NotNull @NotNull org.bukkit.block.Block block, int crack, int id)
      Returns a block break animation packet for the given block and crack. This should probably not be used for transparent blocks. The id is a unique to each packet, and sending a new packet with the same id will cause the previous one to be overwritten.

      For more information, please see the protocol wiki.

      Parameters:
      block - The non-null block to display the cracking animation over.
      crack - The cracking amount, between 0 and 9 inclusively. Higher values are more visibly cracked.
      id - The unique id. If you do not want to override the previous packet, use getCrackPacket(Block, int)}.
      Returns:
      The non-null animation packet.