Package be.seeseemelk.mockbukkit.block
Class BlockMock
java.lang.Object
be.seeseemelk.mockbukkit.block.BlockMock
- All Implemented Interfaces:
net.kyori.adventure.translation.Translatable,org.bukkit.block.Block,org.bukkit.metadata.Metadatable,org.bukkit.Translatable
Mock implementation of a
Block.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a basic block made of air.BlockMock(@NotNull org.bukkit.Location location) Creates a basic block made of air at a certain location.BlockMock(@NotNull org.bukkit.Material material) Creates a basic block with a given material.BlockMock(@NotNull org.bukkit.Material material, @Nullable org.bukkit.Location location) Creates a basic block with a given material that is also linked to a specific location. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyBoneMeal(@NotNull org.bukkit.block.BlockFace face) voidassertType(@NotNull org.bukkit.Material material) Assets that the material type of the block is equal to a given type.booleanbooleanbreakNaturally(boolean triggerEffect) booleanbreakNaturally(boolean triggerEffect, boolean dropExperience) booleanbreakNaturally(@NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect) booleanbreakNaturally(@NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect, boolean dropExperience) booleanbreakNaturally(@Nullable org.bukkit.inventory.ItemStack tool) booleancanPlace(@NotNull org.bukkit.block.data.BlockData data) void@NotNull org.bukkit.block.BiomegetBiome()@NotNull org.bukkit.block.data.BlockDatalongDeprecated.intintgetBlockPower(@NotNull org.bukkit.block.BlockFace face) @NotNull org.bukkit.SoundGroup@NotNull org.bukkit.util.BoundingBoxfloatgetBreakSpeed(@NotNull org.bukkit.entity.Player player) @NotNull org.bukkit.ChunkgetChunk()@NotNull org.bukkit.util.VoxelShape@NotNull org.bukkit.block.BiomebytegetData()Deprecated.@org.jetbrains.annotations.NotNull floatgetDestroySpeed(@NotNull org.bukkit.inventory.ItemStack itemStack) @org.jetbrains.annotations.NotNull floatgetDestroySpeed(@NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants) @NotNull Collection<org.bukkit.inventory.ItemStack> getDrops()@NotNull Collection<org.bukkit.inventory.ItemStack> getDrops(@NotNull org.bukkit.inventory.ItemStack tool, org.bukkit.entity.Entity entity) @NotNull Collection<org.bukkit.inventory.ItemStack> getDrops(@Nullable org.bukkit.inventory.ItemStack tool) org.bukkit.block.BlockFacegetFace(@NotNull org.bukkit.block.Block block) doublebytebytebyte@NotNull org.bukkit.Locationorg.bukkit.LocationgetLocation(@Nullable org.bukkit.Location loc) @NotNull List<org.bukkit.metadata.MetadataValue> getMetadata(String metadataKey) @NotNull org.bukkit.block.PistonMoveReaction@NotNull org.bukkit.block.BlockgetRelative(int modX, int modY, int modZ) @NotNull org.bukkit.block.BlockgetRelative(@NotNull org.bukkit.block.BlockFace face) @NotNull org.bukkit.block.BlockgetRelative(@NotNull org.bukkit.block.BlockFace face, int distance) @NotNull com.destroystokyo.paper.block.BlockSoundGroupDeprecated, for removal: This API element is subject to removal in a future version.@NotNull org.bukkit.block.BlockStategetState()@NotNull org.bukkit.block.BlockStategetState(boolean useSnapshot) double@NotNull StringDeprecated, for removal: This API element is subject to removal in a future version.@NotNull org.bukkit.MaterialgetType()@NotNull org.bukkit.WorldgetWorld()intgetX()intgetY()intgetZ()booleanhasMetadata(String metadataKey) booleanisBlockFaceIndirectlyPowered(@NotNull org.bukkit.block.BlockFace face) booleanisBlockFacePowered(@NotNull org.bukkit.block.BlockFace face) booleanbooleanbooleanbooleanbooleanbooleanisEmpty()booleanisLiquid()booleanbooleanisPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool) booleanbooleanisSolid()booleanisValidTool(@NotNull org.bukkit.inventory.ItemStack itemStack) voidorg.bukkit.util.RayTraceResultrayTrace(@NotNull org.bukkit.Location start, @NotNull org.bukkit.util.Vector direction, double maxDistance, @NotNull org.bukkit.FluidCollisionMode fluidCollisionMode) voidremoveMetadata(String metadataKey, org.bukkit.plugin.Plugin owningPlugin) voidsetBiome(@NotNull org.bukkit.block.Biome bio) voidsetBlockData(@NotNull org.bukkit.block.data.BlockData data) voidsetBlockData(@NotNull org.bukkit.block.data.BlockData data, boolean applyPhysics) voidsetLightFromBlocks(byte lightFromBlocks) Sets the light level received from other blocks.voidsetLightFromSky(byte lightFromSky) Sets the light level received from sky.voidsetMetadata(String metadataKey, @NotNull org.bukkit.metadata.MetadataValue newMetadataValue) voidsetState(@NotNull BlockStateMock state) This method sets the currentBlockStateto the providedBlockStateMock.voidsetType(@NotNull org.bukkit.Material type) voidsetType(@NotNull org.bukkit.Material type, boolean applyPhysics) voidtick()@NotNull String
-
Constructor Details
-
BlockMock
public BlockMock()Creates a basic block made of air. -
BlockMock
public BlockMock(@NotNull @NotNull org.bukkit.Location location) Creates a basic block made of air at a certain location.- Parameters:
location- The location of the block.
-
BlockMock
public BlockMock(@NotNull @NotNull org.bukkit.Material material) Creates a basic block with a given material.- Parameters:
material- The material to give the block.
-
BlockMock
public BlockMock(@NotNull @NotNull org.bukkit.Material material, @Nullable @Nullable org.bukkit.Location location) 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 benullif not needed.
-
-
Method Details
-
setMetadata
public void setMetadata(String metadataKey, @NotNull @NotNull org.bukkit.metadata.MetadataValue newMetadataValue) - Specified by:
setMetadatain interfaceorg.bukkit.metadata.Metadatable
-
getMetadata
- Specified by:
getMetadatain interfaceorg.bukkit.metadata.Metadatable
-
hasMetadata
- Specified by:
hasMetadatain interfaceorg.bukkit.metadata.Metadatable
-
removeMetadata
- Specified by:
removeMetadatain interfaceorg.bukkit.metadata.Metadatable
-
getData
Deprecated.- Specified by:
getDatain interfaceorg.bukkit.block.Block
-
getRelative
@NotNull public @NotNull org.bukkit.block.Block getRelative(int modX, int modY, int modZ) - Specified by:
getRelativein interfaceorg.bukkit.block.Block
-
getRelative
@NotNull public @NotNull org.bukkit.block.Block getRelative(@NotNull @NotNull org.bukkit.block.BlockFace face) - Specified by:
getRelativein interfaceorg.bukkit.block.Block
-
getRelative
@NotNull public @NotNull org.bukkit.block.Block getRelative(@NotNull @NotNull org.bukkit.block.BlockFace face, int distance) - Specified by:
getRelativein interfaceorg.bukkit.block.Block
-
assertType
public void assertType(@NotNull @NotNull org.bukkit.Material material) 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
@NotNull public @NotNull org.bukkit.Material getType()- Specified by:
getTypein interfaceorg.bukkit.block.Block
-
getLightLevel
public byte getLightLevel()- Specified by:
getLightLevelin interfaceorg.bukkit.block.Block
-
getLightFromSky
public byte getLightFromSky()- Specified by:
getLightFromSkyin interfaceorg.bukkit.block.Block
-
setLightFromSky
public void setLightFromSky(byte lightFromSky) Sets the light level received from sky.- Parameters:
lightFromSky- Value between 0 and 15.
-
getLightFromBlocks
public byte getLightFromBlocks()- Specified by:
getLightFromBlocksin interfaceorg.bukkit.block.Block
-
setLightFromBlocks
public void setLightFromBlocks(byte lightFromBlocks) Sets the light level received from other blocks.- Parameters:
lightFromBlocks- Value between 0 and 15.
-
getWorld
@NotNull public @NotNull org.bukkit.World getWorld()- Specified by:
getWorldin interfaceorg.bukkit.block.Block
-
getX
public int getX()- Specified by:
getXin interfaceorg.bukkit.block.Block
-
getY
public int getY()- Specified by:
getYin interfaceorg.bukkit.block.Block
-
getZ
public int getZ()- Specified by:
getZin interfaceorg.bukkit.block.Block
-
getBlockKey
Deprecated.- Specified by:
getBlockKeyin interfaceorg.bukkit.block.Block
-
getLocation
@NotNull public @NotNull org.bukkit.Location getLocation()- Specified by:
getLocationin interfaceorg.bukkit.block.Block
-
getLocation
public org.bukkit.Location getLocation(@Nullable @Nullable org.bukkit.Location loc) - Specified by:
getLocationin interfaceorg.bukkit.block.Block
-
getChunk
@NotNull public @NotNull org.bukkit.Chunk getChunk()- Specified by:
getChunkin interfaceorg.bukkit.block.Block
-
setType
public void setType(@NotNull @NotNull org.bukkit.Material type) - Specified by:
setTypein interfaceorg.bukkit.block.Block
-
setType
public void setType(@NotNull @NotNull org.bukkit.Material type, boolean applyPhysics) - Specified by:
setTypein interfaceorg.bukkit.block.Block
-
getFace
public org.bukkit.block.BlockFace getFace(@NotNull @NotNull org.bukkit.block.Block block) - Specified by:
getFacein interfaceorg.bukkit.block.Block
-
getState
@NotNull public @NotNull org.bukkit.block.BlockState getState()- Specified by:
getStatein interfaceorg.bukkit.block.Block
-
getBiome
@NotNull public @NotNull org.bukkit.block.Biome getBiome()- Specified by:
getBiomein interfaceorg.bukkit.block.Block
-
getComputedBiome
@NotNull public @NotNull org.bukkit.block.Biome getComputedBiome()- Specified by:
getComputedBiomein interfaceorg.bukkit.block.Block
-
getDestroySpeed
@NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) - Specified by:
getDestroySpeedin interfaceorg.bukkit.block.Block
-
getState
@NotNull public @NotNull org.bukkit.block.BlockState getState(boolean useSnapshot) - Specified by:
getStatein interfaceorg.bukkit.block.Block
-
isValidTool
public boolean isValidTool(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) - Specified by:
isValidToolin interfaceorg.bukkit.block.Block
-
setBiome
public void setBiome(@NotNull @NotNull org.bukkit.block.Biome bio) - Specified by:
setBiomein interfaceorg.bukkit.block.Block
-
isBlockPowered
public boolean isBlockPowered()- Specified by:
isBlockPoweredin interfaceorg.bukkit.block.Block
-
isBlockIndirectlyPowered
public boolean isBlockIndirectlyPowered()- Specified by:
isBlockIndirectlyPoweredin interfaceorg.bukkit.block.Block
-
isBlockFacePowered
public boolean isBlockFacePowered(@NotNull @NotNull org.bukkit.block.BlockFace face) - Specified by:
isBlockFacePoweredin interfaceorg.bukkit.block.Block
-
isBlockFaceIndirectlyPowered
public boolean isBlockFaceIndirectlyPowered(@NotNull @NotNull org.bukkit.block.BlockFace face) - Specified by:
isBlockFaceIndirectlyPoweredin interfaceorg.bukkit.block.Block
-
getBlockPower
public int getBlockPower(@NotNull @NotNull org.bukkit.block.BlockFace face) - Specified by:
getBlockPowerin interfaceorg.bukkit.block.Block
-
getBlockPower
public int getBlockPower()- Specified by:
getBlockPowerin interfaceorg.bukkit.block.Block
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.bukkit.block.Block
-
isBurnable
public boolean isBurnable()- Specified by:
isBurnablein interfaceorg.bukkit.block.Block
-
isSolid
public boolean isSolid()- Specified by:
isSolidin interfaceorg.bukkit.block.Block
-
isCollidable
public boolean isCollidable()- Specified by:
isCollidablein interfaceorg.bukkit.block.Block
-
isReplaceable
public boolean isReplaceable()- Specified by:
isReplaceablein interfaceorg.bukkit.block.Block
-
isLiquid
public boolean isLiquid()- Specified by:
isLiquidin interfaceorg.bukkit.block.Block
-
isBuildable
public boolean isBuildable()- Specified by:
isBuildablein interfaceorg.bukkit.block.Block
-
getSoundGroup
@Deprecated(forRemoval=true) @NotNull public @NotNull com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getSoundGroupin interfaceorg.bukkit.block.Block
-
getBlockSoundGroup
@NotNull public @NotNull org.bukkit.SoundGroup getBlockSoundGroup()- Specified by:
getBlockSoundGroupin interfaceorg.bukkit.block.Block
-
getTranslationKey
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getTranslationKeyin interfaceorg.bukkit.block.Block- Specified by:
getTranslationKeyin interfaceorg.bukkit.Translatable
-
getDestroySpeed
@NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants) - Specified by:
getDestroySpeedin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally(@NotNull @NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect) - Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
tick
public void tick()- Specified by:
tickin interfaceorg.bukkit.block.Block
-
fluidTick
public void fluidTick()- Specified by:
fluidTickin interfaceorg.bukkit.block.Block
-
randomTick
public void randomTick()- Specified by:
randomTickin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally(boolean triggerEffect) - Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally(@NotNull @NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect, boolean dropExperience) - Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally(boolean triggerEffect, boolean dropExperience) - Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
getTemperature
public double getTemperature()- Specified by:
getTemperaturein interfaceorg.bukkit.block.Block
-
getHumidity
public double getHumidity()- Specified by:
getHumidityin interfaceorg.bukkit.block.Block
-
getPistonMoveReaction
@NotNull public @NotNull org.bukkit.block.PistonMoveReaction getPistonMoveReaction()- Specified by:
getPistonMoveReactionin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally()- Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
breakNaturally
public boolean breakNaturally(@Nullable @Nullable org.bukkit.inventory.ItemStack tool) - Specified by:
breakNaturallyin interfaceorg.bukkit.block.Block
-
getDrops
- Specified by:
getDropsin interfaceorg.bukkit.block.Block
-
getDrops
@NotNull public @NotNull Collection<org.bukkit.inventory.ItemStack> getDrops(@Nullable @Nullable org.bukkit.inventory.ItemStack tool) - Specified by:
getDropsin interfaceorg.bukkit.block.Block
-
getBlockData
@NotNull public @NotNull org.bukkit.block.data.BlockData getBlockData()- Specified by:
getBlockDatain interfaceorg.bukkit.block.Block
-
setBlockData
public void setBlockData(@NotNull @NotNull org.bukkit.block.data.BlockData data) - Specified by:
setBlockDatain interfaceorg.bukkit.block.Block
-
setBlockData
public void setBlockData(@NotNull @NotNull org.bukkit.block.data.BlockData data, boolean applyPhysics) - Specified by:
setBlockDatain interfaceorg.bukkit.block.Block
-
isPassable
public boolean isPassable()- Specified by:
isPassablein interfaceorg.bukkit.block.Block
-
rayTrace
public org.bukkit.util.RayTraceResult rayTrace(@NotNull @NotNull org.bukkit.Location start, @NotNull @NotNull org.bukkit.util.Vector direction, double maxDistance, @NotNull @NotNull org.bukkit.FluidCollisionMode fluidCollisionMode) - Specified by:
rayTracein interfaceorg.bukkit.block.Block
-
getBoundingBox
@NotNull public @NotNull org.bukkit.util.BoundingBox getBoundingBox()- Specified by:
getBoundingBoxin interfaceorg.bukkit.block.Block
-
getCollisionShape
@NotNull public @NotNull org.bukkit.util.VoxelShape getCollisionShape()- Specified by:
getCollisionShapein interfaceorg.bukkit.block.Block
-
getDrops
@NotNull public @NotNull Collection<org.bukkit.inventory.ItemStack> getDrops(@NotNull @NotNull org.bukkit.inventory.ItemStack tool, org.bukkit.entity.Entity entity) - Specified by:
getDropsin interfaceorg.bukkit.block.Block
-
setState
This method sets the currentBlockStateto the providedBlockStateMock. Do not call this method directly, useBlockState.update()instead.- Parameters:
state- TheBlockStatethat should be set.
-
applyBoneMeal
public boolean applyBoneMeal(@NotNull @NotNull org.bukkit.block.BlockFace face) - Specified by:
applyBoneMealin interfaceorg.bukkit.block.Block
-
isPreferredTool
public boolean isPreferredTool(@NotNull @NotNull org.bukkit.inventory.ItemStack tool) - Specified by:
isPreferredToolin interfaceorg.bukkit.block.Block
-
getBreakSpeed
public float getBreakSpeed(@NotNull @NotNull org.bukkit.entity.Player player) - Specified by:
getBreakSpeedin interfaceorg.bukkit.block.Block
-
canPlace
public boolean canPlace(@NotNull @NotNull org.bukkit.block.data.BlockData data) - Specified by:
canPlacein interfaceorg.bukkit.block.Block
-
translationKey
- Specified by:
translationKeyin interfacenet.kyori.adventure.translation.Translatable
-