Class BlockStateMock
java.lang.Object
be.seeseemelk.mockbukkit.block.state.BlockStateMock
- All Implemented Interfaces:
BlockState,Metadatable
- Direct Known Subclasses:
TileStateMock
Mock implementation of a
BlockState.
Also manages the creation of new BlockStates with the appropriate mock class.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBlockStateMock(@NotNull BlockStateMock state) Constructs a newBlockStateMockby cloning the data from an existing one.BlockStateMock(@NotNull Material material) Constructs a newBlockStateMockfor the providedMaterial.protectedBlockStateMock(@NotNull Block block) Constructs a newBlockStateMockfor the providedBlock. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidEnsures the provided material is one of the expected materials provided.protected voidEnsures the provided material is contained in theTag.protected voidEnsures the provided block type is one of the expected materials provided.protected voidEnsures the provided block type is contained in theTag.@NotNull BlockStatecopy()@NotNull BlockStateboolean@NotNull BlockgetBlock()@NotNull BlockData@NotNull ChunkgetChunk()@NotNull MaterialDatagetData()Deprecated.@NotNull Collection<ItemStack> getDrops()@NotNull Collection<ItemStack> @NotNull Collection<ItemStack> byte@NotNull LocationgetLocation(Location loc) @NotNull List<MetadataValue> getMetadata(String metadataKey) byteDeprecated.@NotNull BlockStateThis returns a copy of thisBlockStateMock.@NotNull MaterialgetType()@NotNull WorldgetWorld()intgetX()intgetY()intgetZ()inthashCode()booleanhasMetadata(String metadataKey) booleanbooleanisPlaced()static @NotNull BlockStateMockstatic @NotNull BlockStateMockAttempts to construct a BlockStateMock by the provided block.voidremoveMetadata(String metadataKey, Plugin owningPlugin) voidsetBlockData(BlockData data) voidsetData(MaterialData data) Deprecated.voidsetMetadata(String metadataKey, @NotNull MetadataValue newMetadataValue) voidsetRawData(byte data) Deprecated.voidbooleanupdate()booleanupdate(boolean force) booleanupdate(boolean force, boolean applyPhysics)
-
Constructor Details
-
BlockStateMock
Constructs a newBlockStateMockfor the providedMaterial.- Parameters:
material- The material this state is for.
-
BlockStateMock
Constructs a newBlockStateMockfor the providedBlock.- Parameters:
block- The block this state is for.
-
BlockStateMock
Constructs a newBlockStateMockby cloning the data from an existing one.- Parameters:
state- The state to clone.
-
-
Method Details
-
checkType
protected void checkType(@NotNull @NotNull Material material, @NotNull @NotNull Material @NotNull ... 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.
-
setMetadata
- Specified by:
setMetadatain interfaceMetadatable
-
getMetadata
- Specified by:
getMetadatain interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadatain interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadatain interfaceMetadatable
-
getBlock
- Specified by:
getBlockin interfaceBlockState
-
getData
Deprecated.- Specified by:
getDatain interfaceBlockState
-
getType
- Specified by:
getTypein interfaceBlockState
-
getLightLevel
public byte getLightLevel()- Specified by:
getLightLevelin interfaceBlockState
-
getWorld
- Specified by:
getWorldin interfaceBlockState
-
getX
public int getX()- Specified by:
getXin interfaceBlockState
-
getY
public int getY()- Specified by:
getYin interfaceBlockState
-
getZ
public int getZ()- Specified by:
getZin interfaceBlockState
-
getLocation
- Specified by:
getLocationin interfaceBlockState
-
getLocation
- Specified by:
getLocationin interfaceBlockState
-
getChunk
- Specified by:
getChunkin interfaceBlockState
-
setData
Deprecated.- Specified by:
setDatain interfaceBlockState
-
setType
- Specified by:
setTypein interfaceBlockState
-
update
public boolean update()- Specified by:
updatein interfaceBlockState
-
update
public boolean update(boolean force) - Specified by:
updatein interfaceBlockState
-
update
public boolean update(boolean force, boolean applyPhysics) - Specified by:
updatein interfaceBlockState
-
getRawData
Deprecated.- Specified by:
getRawDatain interfaceBlockState
-
setRawData
Deprecated.- Specified by:
setRawDatain interfaceBlockState
-
isPlaced
public boolean isPlaced()- Specified by:
isPlacedin interfaceBlockState
-
isCollidable
public boolean isCollidable()- Specified by:
isCollidablein interfaceBlockState
-
getDrops
- Specified by:
getDropsin interfaceBlockState
-
getDrops
- Specified by:
getDropsin interfaceBlockState
-
getDrops
@NotNull public @NotNull Collection<ItemStack> getDrops(@NotNull @NotNull ItemStack tool, @Nullable @Nullable Entity entity) - Specified by:
getDropsin interfaceBlockState
-
getBlockData
- Specified by:
getBlockDatain interfaceBlockState
-
copy
- Specified by:
copyin interfaceBlockState
-
copy
- Specified by:
copyin interfaceBlockState
-
setBlockData
- Specified by:
setBlockDatain interfaceBlockState
-
getSnapshot
This returns a copy of thisBlockStateMock. Inheritents of this class should override this method!- Returns:
- A snapshot of this
BlockStateMock.
-
hashCode
public int hashCode() -
equals
-
mockState
Attempts to construct a BlockStateMock by the provided block. Will return a basicBlockStateMockif no implementation is found.- Parameters:
block- The block to create the BlockState from.- Returns:
- The BlockState.
-
mockState
-