Class BlockDataMock
java.lang.Object
be.seeseemelk.mockbukkit.block.data.BlockDataMock
- Direct Known Subclasses:
AmethystClusterMock,BambooMock,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 material) Constructs a newBlockDataMockfor the providedMaterial. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidcheckMaterial(@NotNull Material material) Ensures the provided material is valid for minecraft.protected voidcheckProperty(String property) Ensures the provided material/state combination is valid for minecraft.protected voidEnsures the provided material is one of the expected materials provided.protected voidEnsures the provided material is contained in theTag.@NotNull BlockDataMockclone()void@NotNull BlockStatebooleanprotected <T> TGets a data value.@NotNull String@NotNull StringgetAsString(boolean hideUnspecified) @NotNull VoxelShapegetCollisionShape(@NotNull Location location) floatgetDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) int@NotNull Color@NotNull Material@NotNull PistonMoveReaction@NotNull Material@NotNull SoundGroupinthashCode()booleanisFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support) booleanbooleanisPreferredTool(@NotNull ItemStack tool) booleanbooleanisSupported(@NotNull Location location) booleanisSupported(@NotNull Block block) boolean@NotNull BlockDatavoidstatic @NotNull BlockDataMockAttempts to construct a BlockDataMock by the provided material.booleanvoidrotate(@NotNull StructureRotation rotation) protected <T> voidSets a data value.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bukkit.block.data.BlockData
getDestroySpeed
-
Constructor Details
-
BlockDataMock
Constructs a newBlockDataMockfor the providedMaterial.- Parameters:
material- 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 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.
-
checkMaterial
Ensures the provided material is valid for minecraft.- Parameters:
material- The material to test.
-
checkProperty
Ensures the provided material/state combination is valid for minecraft.- Parameters:
property- The state to test.
-
set
Sets a data value.- Type Parameters:
T- The type of the data.- Parameters:
key- The data key.value- The data value.- See Also:
-
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:
-
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
-
getCollisionShape
- Specified by:
getCollisionShapein interfaceBlockData
-
getMapColor
- Specified by:
getMapColorin interfaceBlockData
-
getPlacementMaterial
- Specified by:
getPlacementMaterialin interfaceBlockData
-
rotate
-
mirror
-
copyTo
-
createBlockState
- Specified by:
createBlockStatein interfaceBlockData
-
getDestroySpeed
- Specified by:
getDestroySpeedin 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.
-