Class BlockDataMock
java.lang.Object
be.seeseemelk.mockbukkit.block.data.BlockDataMock
- Direct Known Subclasses:
AmethystClusterMock
,BedMock
,CampfireMock
,SlabMock
,StairsMock
,SwitchMock
,TrapDoorMock
,WallSignMock
Mock implementation of
BlockData
.
Also manages the creation of new BlockData with the appropriate mock class.-
Constructor Summary
ConstructorsConstructorDescriptionBlockDataMock
(@NotNull Material type) Constructs a newBlockDataMock
for the providedMaterial
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Ensures the provided block type is one of the expected materials provided.protected void
Ensures the provided block type is contained in theTag
.protected void
Ensures the provided material is one of the expected materials provided.protected void
Ensures the provided material is contained in theTag
.@NotNull BlockData
clone()
@NotNull BlockState
boolean
protected <T> T
Gets a data value.@NotNull String
@NotNull String
getAsString
(boolean hideUnspecified) float
getDestroySpeed
(@NotNull ItemStack itemStack, boolean considerEnchants) int
@NotNull Material
@NotNull PistonMoveReaction
@NotNull Material
@NotNull SoundGroup
int
hashCode()
boolean
isFaceSturdy
(@NotNull BlockFace face, @NotNull BlockSupport support) boolean
boolean
isPreferredTool
(@NotNull ItemStack tool) boolean
boolean
isSupported
(@NotNull Block block) boolean
isSupported
(@NotNull Location location) boolean
@NotNull BlockData
void
static @NotNull BlockDataMock
Attempts to construct a BlockDataMock by the provided material.boolean
void
rotate
(@NotNull StructureRotation rotation) protected <T> void
Sets a data value.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.block.data.BlockData
getDestroySpeed
-
Constructor Details
-
BlockDataMock
Constructs a newBlockDataMock
for the providedMaterial
.- 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
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 theTag
.- Parameters:
material
- The material to test.expected
- The expected tag.
-
checkType
Ensures the provided block type is contained in theTag
.- Parameters:
block
- The material to test.expected
- The expected tag.
-
set
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
Gets a data value. Will throw anIllegalArgumentException
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
- Specified by:
getMaterial
in interfaceBlockData
-
getAsString
- Specified by:
getAsString
in interfaceBlockData
-
getAsString
- Specified by:
getAsString
in interfaceBlockData
-
merge
-
getSoundGroup
- Specified by:
getSoundGroup
in interfaceBlockData
-
getLightEmission
public int getLightEmission()- Specified by:
getLightEmission
in interfaceBlockData
-
isOccluding
public boolean isOccluding()- Specified by:
isOccluding
in interfaceBlockData
-
requiresCorrectToolForDrops
public boolean requiresCorrectToolForDrops()- Specified by:
requiresCorrectToolForDrops
in interfaceBlockData
-
isSupported
- Specified by:
isSupported
in interfaceBlockData
-
isSupported
- Specified by:
isSupported
in interfaceBlockData
-
isFaceSturdy
public boolean isFaceSturdy(@NotNull @NotNull BlockFace face, @NotNull @NotNull BlockSupport support) - Specified by:
isFaceSturdy
in interfaceBlockData
-
getPlacementMaterial
- Specified by:
getPlacementMaterial
in interfaceBlockData
-
rotate
-
mirror
-
createBlockState
- Specified by:
createBlockState
in interfaceBlockData
-
getDestroySpeed
- Specified by:
getDestroySpeed
in interfaceBlockData
-
isRandomlyTicked
public boolean isRandomlyTicked()- Specified by:
isRandomlyTicked
in interfaceBlockData
-
isPreferredTool
- Specified by:
isPreferredTool
in interfaceBlockData
-
getPistonMoveReaction
- Specified by:
getPistonMoveReaction
in interfaceBlockData
-
matches
-
hashCode
public int hashCode() -
equals
-
clone
-
mock
Attempts to construct a BlockDataMock by the provided material. Will return a basicBlockDataMock
if no implementation is found.- Parameters:
material
- The material to create the BlockData from.- Returns:
- The BlockData.
-