Class BlockDataMock

java.lang.Object
be.seeseemelk.mockbukkit.block.data.BlockDataMock
All Implemented Interfaces:
Cloneable, BlockData
Direct Known Subclasses:
AmethystClusterMock, BedMock, CampfireMock, SlabMock, StairsMock, SwitchMock, TrapDoorMock, WallSignMock

public class BlockDataMock extends Object implements BlockData
Mock implementation of BlockData. Also manages the creation of new BlockData with the appropriate mock class.
  • Constructor Details

    • BlockDataMock

      public BlockDataMock(@NotNull @NotNull Material type)
      Constructs a new BlockDataMock for the provided Material.
      Parameters:
      type - The material this data is for.
  • Method Details

    • checkType

      protected void checkType(@NotNull @NotNull Material material, @NotNull @NotNull Material... expected)
      Ensures the provided material is one of the expected materials provided.
      Parameters:
      material - The material to test.
      expected - The expected materials.
    • checkType

      protected void checkType(@NotNull @NotNull Block block, @NotNull @NotNull Material... expected)
      Ensures the provided block type is one of the expected materials provided.
      Parameters:
      block - The block to test.
      expected - The expected materials.
    • checkType

      protected void checkType(@NotNull @NotNull Material material, @NotNull @NotNull Tag<Material> expected)
      Ensures the provided material is contained in the Tag.
      Parameters:
      material - The material to test.
      expected - The expected tag.
    • checkType

      protected void checkType(@NotNull @NotNull Block block, @NotNull @NotNull Tag<Material> expected)
      Ensures the provided block type is contained in the Tag.
      Parameters:
      block - The material to test.
      expected - The expected tag.
    • set

      protected <T> void set(@NotNull @NotNull String key, @NotNull T value)
      Sets a data value.
      Type Parameters:
      T - The type of the data.
      Parameters:
      key - The data key.
      value - The data value.
      See Also:
      • BlockDataKey
    • get

      @NotNull protected <T> T get(@NotNull @NotNull String key)
      Gets a data value. Will throw an IllegalArgumentException if no data is set for the provided key.
      Type Parameters:
      T - The type of the data.
      Parameters:
      key - The data key.
      Returns:
      The data attached to the key.
      See Also:
      • BlockDataKey
    • getMaterial

      @NotNull public @NotNull Material getMaterial()
      Specified by:
      getMaterial in interface BlockData
    • getAsString

      @NotNull public @NotNull String getAsString()
      Specified by:
      getAsString in interface BlockData
    • getAsString

      @NotNull public @NotNull String getAsString(boolean hideUnspecified)
      Specified by:
      getAsString in interface BlockData
    • merge

      @NotNull public @NotNull BlockData merge(@NotNull @NotNull BlockData data)
      Specified by:
      merge in interface BlockData
    • getSoundGroup

      @NotNull public @NotNull SoundGroup getSoundGroup()
      Specified by:
      getSoundGroup in interface BlockData
    • getLightEmission

      public int getLightEmission()
      Specified by:
      getLightEmission in interface BlockData
    • isOccluding

      public boolean isOccluding()
      Specified by:
      isOccluding in interface BlockData
    • requiresCorrectToolForDrops

      public boolean requiresCorrectToolForDrops()
      Specified by:
      requiresCorrectToolForDrops in interface BlockData
    • isSupported

      public boolean isSupported(@NotNull @NotNull Block block)
      Specified by:
      isSupported in interface BlockData
    • isSupported

      public boolean isSupported(@NotNull @NotNull Location location)
      Specified by:
      isSupported in interface BlockData
    • isFaceSturdy

      public boolean isFaceSturdy(@NotNull @NotNull BlockFace face, @NotNull @NotNull BlockSupport support)
      Specified by:
      isFaceSturdy in interface BlockData
    • getPlacementMaterial

      @NotNull public @NotNull Material getPlacementMaterial()
      Specified by:
      getPlacementMaterial in interface BlockData
    • rotate

      public void rotate(@NotNull @NotNull StructureRotation rotation)
      Specified by:
      rotate in interface BlockData
    • mirror

      public void mirror(@NotNull @NotNull Mirror mirror)
      Specified by:
      mirror in interface BlockData
    • createBlockState

      @NotNull public @NotNull BlockState createBlockState()
      Specified by:
      createBlockState in interface BlockData
    • getDestroySpeed

      public float getDestroySpeed(@NotNull @NotNull ItemStack itemStack, boolean considerEnchants)
      Specified by:
      getDestroySpeed in interface BlockData
    • isRandomlyTicked

      public boolean isRandomlyTicked()
      Specified by:
      isRandomlyTicked in interface BlockData
    • isPreferredTool

      public boolean isPreferredTool(@NotNull @NotNull ItemStack tool)
      Specified by:
      isPreferredTool in interface BlockData
    • getPistonMoveReaction

      @NotNull public @NotNull PistonMoveReaction getPistonMoveReaction()
      Specified by:
      getPistonMoveReaction in interface BlockData
    • matches

      public boolean matches(@Nullable @Nullable BlockData data)
      Specified by:
      matches in interface BlockData
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      @NotNull public @NotNull BlockData clone()
      Specified by:
      clone in interface BlockData
      Overrides:
      clone in class Object
    • mock

      @NotNull public static @NotNull BlockDataMock mock(@NotNull @NotNull Material material)
      Attempts to construct a BlockDataMock by the provided material. Will return a basic BlockDataMock if no implementation is found.
      Parameters:
      material - The material to create the BlockData from.
      Returns:
      The BlockData.