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 newBlockDataMockfor the providedMaterial. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidEnsures the provided block type is one of the expected materials provided.protected voidEnsures the provided block type is contained in theTag.protected voidEnsures the provided material is one of the expected materials provided.protected voidEnsures the provided material is contained in theTag.@NotNull BlockDataclone()@NotNull BlockStatebooleanprotected <T> TGets a data value.@NotNull String@NotNull StringgetAsString(boolean hideUnspecified) int@NotNull Material@NotNull PistonMoveReaction@NotNull Material@NotNull SoundGroupinthashCode()booleanisFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support) booleanbooleanisPreferredTool(@NotNull ItemStack tool) booleanbooleanisSupported(@NotNull Block block) booleanisSupported(@NotNull Location location) boolean@NotNull BlockDatavoidstatic @NotNull BlockDataMockAttempts to construct a BlockDataMock by the provided material.booleanvoidrotate(@NotNull StructureRotation rotation) protected <T> voidSets a data value.
-
Constructor Details
-
BlockDataMock
Constructs a newBlockDataMockfor 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 anIllegalArgumentExceptionif 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:
getMaterialin interfaceBlockData
-
getAsString
- Specified by:
getAsStringin interfaceBlockData
-
getAsString
- Specified by:
getAsStringin interfaceBlockData
-
merge
-
getSoundGroup
- Specified by:
getSoundGroupin interfaceBlockData
-
getLightEmission
public int getLightEmission()- Specified by:
getLightEmissionin interfaceBlockData
-
isOccluding
public boolean isOccluding()- Specified by:
isOccludingin interfaceBlockData
-
requiresCorrectToolForDrops
public boolean requiresCorrectToolForDrops()- Specified by:
requiresCorrectToolForDropsin interfaceBlockData
-
isSupported
- Specified by:
isSupportedin interfaceBlockData
-
isSupported
- Specified by:
isSupportedin interfaceBlockData
-
isFaceSturdy
public boolean isFaceSturdy(@NotNull @NotNull BlockFace face, @NotNull @NotNull BlockSupport support) - Specified by:
isFaceSturdyin interfaceBlockData
-
getPlacementMaterial
- Specified by:
getPlacementMaterialin interfaceBlockData
-
rotate
-
mirror
-
createBlockState
- Specified by:
createBlockStatein interfaceBlockData
-
isRandomlyTicked
public boolean isRandomlyTicked()- Specified by:
isRandomlyTickedin interfaceBlockData
-
isPreferredTool
- Specified by:
isPreferredToolin interfaceBlockData
-
getPistonMoveReaction
- Specified by:
getPistonMoveReactionin interfaceBlockData
-
matches
-
hashCode
public int hashCode() -
equals
-
clone
-
mock
Attempts to construct a BlockDataMock by the provided material. Will return a basicBlockDataMockif no implementation is found.- Parameters:
material- The material to create the BlockData from.- Returns:
- The BlockData.
-