Package be.seeseemelk.mockbukkit.block
Class BlockMock
java.lang.Object
be.seeseemelk.mockbukkit.block.BlockMock
- All Implemented Interfaces:
net.kyori.adventure.translation.Translatable
,Block
,Metadatable
,Translatable
Mock implementation of a
Block
.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a basic block made of air.Creates a basic block made of air at a certain location.Creates a basic block with a given material.Creates a basic block with a given material that is also linked to a specific location. -
Method Summary
Modifier and TypeMethodDescriptionboolean
applyBoneMeal
(@NotNull BlockFace face) void
assertType
(@NotNull Material material) Assets that the material type of the block is equal to a given type.boolean
boolean
breakNaturally
(boolean triggerEffect) boolean
breakNaturally
(boolean triggerEffect, boolean dropExperience) boolean
breakNaturally
(@NotNull ItemStack tool, boolean triggerEffect) boolean
breakNaturally
(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience) boolean
breakNaturally
(@Nullable ItemStack tool) boolean
@NotNull Biome
getBiome()
@NotNull BlockData
long
Deprecated.int
int
getBlockPower
(@NotNull BlockFace face) @NotNull SoundGroup
@NotNull BoundingBox
float
getBreakSpeed
(@NotNull Player player) @NotNull Chunk
getChunk()
@NotNull VoxelShape
@NotNull Biome
byte
getData()
Deprecated.@org.jetbrains.annotations.NotNull float
getDestroySpeed
(@NotNull ItemStack itemStack) @org.jetbrains.annotations.NotNull float
getDestroySpeed
(@NotNull ItemStack itemStack, boolean considerEnchants) @NotNull Collection<ItemStack>
getDrops()
@NotNull Collection<ItemStack>
@NotNull Collection<ItemStack>
double
byte
byte
byte
@NotNull Location
getLocation
(@Nullable Location loc) @NotNull List<MetadataValue>
getMetadata
(String metadataKey) @NotNull PistonMoveReaction
@NotNull Block
getRelative
(int modX, int modY, int modZ) @NotNull Block
getRelative
(@NotNull BlockFace face) @NotNull Block
getRelative
(@NotNull BlockFace face, int distance) @NotNull BlockSoundGroup
Deprecated, for removal: This API element is subject to removal in a future version.@NotNull BlockState
getState()
@NotNull BlockState
getState
(boolean useSnapshot) double
@NotNull String
@NotNull Material
getType()
@NotNull World
getWorld()
int
getX()
int
getY()
int
getZ()
boolean
hasMetadata
(String metadataKey) boolean
isBlockFaceIndirectlyPowered
(@NotNull BlockFace face) boolean
isBlockFacePowered
(@NotNull BlockFace face) boolean
boolean
boolean
boolean
boolean
boolean
isEmpty()
boolean
isLiquid()
boolean
boolean
isPreferredTool
(@NotNull ItemStack tool) boolean
boolean
isSolid()
boolean
isValidTool
(@NotNull ItemStack itemStack) void
rayTrace
(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) void
removeMetadata
(String metadataKey, Plugin owningPlugin) void
void
setBlockData
(@NotNull BlockData data) void
setBlockData
(@NotNull BlockData data, boolean applyPhysics) void
setMetadata
(String metadataKey, @NotNull MetadataValue newMetadataValue) void
setState
(@NotNull BlockStateMock state) This method sets the currentBlockState
to the providedBlockStateMock
.void
void
void
tick()
@NotNull String
-
Constructor Details
-
BlockMock
public BlockMock()Creates a basic block made of air. -
BlockMock
Creates a basic block made of air at a certain location.- Parameters:
location
- The location of the block.
-
BlockMock
Creates a basic block with a given material.- Parameters:
material
- The material to give the block.
-
BlockMock
Creates a basic block with a given material that is also linked to a specific location.- Parameters:
material
- The material of the block.location
- The location of the block. Can benull
if not needed.
-
-
Method Details
-
setMetadata
- Specified by:
setMetadata
in interfaceMetadatable
-
getMetadata
- Specified by:
getMetadata
in interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadata
in interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadata
in interfaceMetadatable
-
getData
Deprecated. -
getRelative
- Specified by:
getRelative
in interfaceBlock
-
getRelative
- Specified by:
getRelative
in interfaceBlock
-
getRelative
- Specified by:
getRelative
in interfaceBlock
-
assertType
Assets that the material type of the block is equal to a given type.- Parameters:
material
- The material type that the block should have.- Throws:
AssertionError
- Thrown if the material type of the block does not equal the given material type.
-
getType
-
getLightLevel
public byte getLightLevel()- Specified by:
getLightLevel
in interfaceBlock
-
getLightFromSky
public byte getLightFromSky()- Specified by:
getLightFromSky
in interfaceBlock
-
getLightFromBlocks
public byte getLightFromBlocks()- Specified by:
getLightFromBlocks
in interfaceBlock
-
getWorld
-
getX
public int getX() -
getY
public int getY() -
getZ
public int getZ() -
getBlockKey
Deprecated.- Specified by:
getBlockKey
in interfaceBlock
-
getLocation
- Specified by:
getLocation
in interfaceBlock
-
getLocation
- Specified by:
getLocation
in interfaceBlock
-
getChunk
-
setType
-
setType
-
getFace
-
getState
-
getBiome
-
getComputedBiome
- Specified by:
getComputedBiome
in interfaceBlock
-
getDestroySpeed
@NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull ItemStack itemStack) - Specified by:
getDestroySpeed
in interfaceBlock
-
getState
-
isValidTool
- Specified by:
isValidTool
in interfaceBlock
-
setBiome
-
isBlockPowered
public boolean isBlockPowered()- Specified by:
isBlockPowered
in interfaceBlock
-
isBlockIndirectlyPowered
public boolean isBlockIndirectlyPowered()- Specified by:
isBlockIndirectlyPowered
in interfaceBlock
-
isBlockFacePowered
- Specified by:
isBlockFacePowered
in interfaceBlock
-
isBlockFaceIndirectlyPowered
- Specified by:
isBlockFaceIndirectlyPowered
in interfaceBlock
-
getBlockPower
- Specified by:
getBlockPower
in interfaceBlock
-
getBlockPower
public int getBlockPower()- Specified by:
getBlockPower
in interfaceBlock
-
isEmpty
public boolean isEmpty() -
isBurnable
public boolean isBurnable()- Specified by:
isBurnable
in interfaceBlock
-
isSolid
public boolean isSolid() -
isCollidable
public boolean isCollidable()- Specified by:
isCollidable
in interfaceBlock
-
isReplaceable
public boolean isReplaceable()- Specified by:
isReplaceable
in interfaceBlock
-
isLiquid
public boolean isLiquid() -
isBuildable
public boolean isBuildable()- Specified by:
isBuildable
in interfaceBlock
-
getSoundGroup
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getSoundGroup
in interfaceBlock
-
getBlockSoundGroup
- Specified by:
getBlockSoundGroup
in interfaceBlock
-
getTranslationKey
- Specified by:
getTranslationKey
in interfaceBlock
- Specified by:
getTranslationKey
in interfaceTranslatable
-
getDestroySpeed
@NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull ItemStack itemStack, boolean considerEnchants) - Specified by:
getDestroySpeed
in interfaceBlock
-
breakNaturally
- Specified by:
breakNaturally
in interfaceBlock
-
tick
public void tick() -
randomTick
public void randomTick()- Specified by:
randomTick
in interfaceBlock
-
breakNaturally
public boolean breakNaturally(boolean triggerEffect) - Specified by:
breakNaturally
in interfaceBlock
-
breakNaturally
public boolean breakNaturally(@NotNull @NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience) - Specified by:
breakNaturally
in interfaceBlock
-
breakNaturally
public boolean breakNaturally(boolean triggerEffect, boolean dropExperience) - Specified by:
breakNaturally
in interfaceBlock
-
getTemperature
public double getTemperature()- Specified by:
getTemperature
in interfaceBlock
-
getHumidity
public double getHumidity()- Specified by:
getHumidity
in interfaceBlock
-
getPistonMoveReaction
- Specified by:
getPistonMoveReaction
in interfaceBlock
-
breakNaturally
public boolean breakNaturally()- Specified by:
breakNaturally
in interfaceBlock
-
breakNaturally
- Specified by:
breakNaturally
in interfaceBlock
-
getDrops
-
getDrops
-
getBlockData
- Specified by:
getBlockData
in interfaceBlock
-
setBlockData
- Specified by:
setBlockData
in interfaceBlock
-
setBlockData
- Specified by:
setBlockData
in interfaceBlock
-
isPassable
public boolean isPassable()- Specified by:
isPassable
in interfaceBlock
-
rayTrace
public RayTraceResult rayTrace(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode) -
getBoundingBox
- Specified by:
getBoundingBox
in interfaceBlock
-
getCollisionShape
- Specified by:
getCollisionShape
in interfaceBlock
-
getDrops
@NotNull public @NotNull Collection<ItemStack> getDrops(@NotNull @NotNull ItemStack tool, Entity entity) -
setState
This method sets the currentBlockState
to the providedBlockStateMock
. Do not call this method directly, useBlockState.update()
instead.- Parameters:
state
- TheBlockState
that should be set.
-
applyBoneMeal
- Specified by:
applyBoneMeal
in interfaceBlock
-
isPreferredTool
- Specified by:
isPreferredTool
in interfaceBlock
-
getBreakSpeed
- Specified by:
getBreakSpeed
in interfaceBlock
-
canPlace
-
translationKey
- Specified by:
translationKey
in interfacenet.kyori.adventure.translation.Translatable
-