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
ModifierConstructorDescriptionprotected
BlockStateMock
(@NotNull BlockStateMock state) Constructs a newBlockStateMock
by cloning the data from an existing one.protected
BlockStateMock
(@NotNull Block block) Constructs a newBlockStateMock
for the providedBlock
.BlockStateMock
(@NotNull Material material) Constructs a newBlockStateMock
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 BlockState
copy()
boolean
@NotNull Block
getBlock()
@NotNull BlockData
@NotNull Chunk
getChunk()
@NotNull MaterialData
getData()
Deprecated.@NotNull Collection<ItemStack>
getDrops()
@NotNull Collection<ItemStack>
@NotNull Collection<ItemStack>
byte
@NotNull Location
getLocation
(Location loc) @NotNull List<MetadataValue>
getMetadata
(String metadataKey) byte
Deprecated.@NotNull BlockState
This returns a copy of thisBlockStateMock
.@NotNull Material
getType()
@NotNull World
getWorld()
int
getX()
int
getY()
int
getZ()
int
hashCode()
boolean
hasMetadata
(String metadataKey) boolean
boolean
isPlaced()
static @NotNull BlockStateMock
Attempts to construct a BlockStateMock by the provided block.void
removeMetadata
(String metadataKey, Plugin owningPlugin) void
setBlockData
(BlockData data) void
setData
(MaterialData data) Deprecated.void
setMetadata
(String metadataKey, @NotNull MetadataValue newMetadataValue) void
setRawData
(byte data) Deprecated.void
boolean
update()
boolean
update
(boolean force) boolean
update
(boolean force, boolean applyPhysics)
-
Constructor Details
-
BlockStateMock
Constructs a newBlockStateMock
for the providedMaterial
.- Parameters:
material
- The material this state is for.
-
BlockStateMock
Constructs a newBlockStateMock
for the providedBlock
.- Parameters:
block
- The block this state is for.
-
BlockStateMock
Constructs a newBlockStateMock
by 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:
setMetadata
in interfaceMetadatable
-
getMetadata
- Specified by:
getMetadata
in interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadata
in interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadata
in interfaceMetadatable
-
getBlock
- Specified by:
getBlock
in interfaceBlockState
-
getData
Deprecated.- Specified by:
getData
in interfaceBlockState
-
getType
- Specified by:
getType
in interfaceBlockState
-
getLightLevel
public byte getLightLevel()- Specified by:
getLightLevel
in interfaceBlockState
-
getWorld
- Specified by:
getWorld
in interfaceBlockState
-
getX
public int getX()- Specified by:
getX
in interfaceBlockState
-
getY
public int getY()- Specified by:
getY
in interfaceBlockState
-
getZ
public int getZ()- Specified by:
getZ
in interfaceBlockState
-
getLocation
- Specified by:
getLocation
in interfaceBlockState
-
getLocation
- Specified by:
getLocation
in interfaceBlockState
-
getChunk
- Specified by:
getChunk
in interfaceBlockState
-
setData
Deprecated.- Specified by:
setData
in interfaceBlockState
-
setType
- Specified by:
setType
in interfaceBlockState
-
update
public boolean update()- Specified by:
update
in interfaceBlockState
-
update
public boolean update(boolean force) - Specified by:
update
in interfaceBlockState
-
update
public boolean update(boolean force, boolean applyPhysics) - Specified by:
update
in interfaceBlockState
-
getRawData
Deprecated.- Specified by:
getRawData
in interfaceBlockState
-
setRawData
Deprecated.- Specified by:
setRawData
in interfaceBlockState
-
isPlaced
public boolean isPlaced()- Specified by:
isPlaced
in interfaceBlockState
-
isCollidable
public boolean isCollidable()- Specified by:
isCollidable
in interfaceBlockState
-
getDrops
- Specified by:
getDrops
in interfaceBlockState
-
getDrops
- Specified by:
getDrops
in interfaceBlockState
-
getDrops
@NotNull public @NotNull Collection<ItemStack> getDrops(@NotNull @NotNull ItemStack tool, @Nullable @Nullable Entity entity) - Specified by:
getDrops
in interfaceBlockState
-
getBlockData
- Specified by:
getBlockData
in interfaceBlockState
-
copy
- Specified by:
copy
in interfaceBlockState
-
setBlockData
- Specified by:
setBlockData
in 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 basicBlockStateMock
if no implementation is found.- Parameters:
block
- The block to create the BlockState from.- Returns:
- The BlockState.
-