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

public class BlockMock extends Object implements org.bukkit.block.Block
  • 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 be null if not needed.
  • Method Details

    • setMetadata

      public void setMetadata(String metadataKey, org.bukkit.metadata.MetadataValue newMetadataValue)
      Specified by:
      setMetadata in interface org.bukkit.metadata.Metadatable
    • getMetadata

      public List<org.bukkit.metadata.MetadataValue> getMetadata(String metadataKey)
      Specified by:
      getMetadata in interface org.bukkit.metadata.Metadatable
    • hasMetadata

      public boolean hasMetadata(String metadataKey)
      Specified by:
      hasMetadata in interface org.bukkit.metadata.Metadatable
    • removeMetadata

      public void removeMetadata(String metadataKey, org.bukkit.plugin.Plugin owningPlugin)
      Specified by:
      removeMetadata in interface org.bukkit.metadata.Metadatable
    • getData

      @Deprecated public byte getData()
      Deprecated.
      Specified by:
      getData in interface org.bukkit.block.Block
    • getRelative

      public org.bukkit.block.Block getRelative(int modX, int modY, int modZ)
      Specified by:
      getRelative in interface org.bukkit.block.Block
    • getRelative

      public org.bukkit.block.Block getRelative(org.bukkit.block.BlockFace face)
      Specified by:
      getRelative in interface org.bukkit.block.Block
    • getRelative

      public org.bukkit.block.Block getRelative(org.bukkit.block.BlockFace face, int distance)
      Specified by:
      getRelative in interface org.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

      public org.bukkit.Material getType()
      Specified by:
      getType in interface org.bukkit.block.Block
    • getLightLevel

      public byte getLightLevel()
      Specified by:
      getLightLevel in interface org.bukkit.block.Block
    • getLightFromSky

      public byte getLightFromSky()
      Specified by:
      getLightFromSky in interface org.bukkit.block.Block
    • getLightFromBlocks

      public byte getLightFromBlocks()
      Specified by:
      getLightFromBlocks in interface org.bukkit.block.Block
    • getWorld

      public org.bukkit.World getWorld()
      Specified by:
      getWorld in interface org.bukkit.block.Block
    • getX

      public int getX()
      Specified by:
      getX in interface org.bukkit.block.Block
    • getY

      public int getY()
      Specified by:
      getY in interface org.bukkit.block.Block
    • getZ

      public int getZ()
      Specified by:
      getZ in interface org.bukkit.block.Block
    • getBlockKey

      @Deprecated public long getBlockKey()
      Deprecated.
      Specified by:
      getBlockKey in interface org.bukkit.block.Block
    • getLocation

      public org.bukkit.Location getLocation()
      Specified by:
      getLocation in interface org.bukkit.block.Block
    • getLocation

      public org.bukkit.Location getLocation(org.bukkit.Location loc)
      Specified by:
      getLocation in interface org.bukkit.block.Block
    • getChunk

      public org.bukkit.Chunk getChunk()
      Specified by:
      getChunk in interface org.bukkit.block.Block
    • setType

      public void setType(org.bukkit.Material type)
      Specified by:
      setType in interface org.bukkit.block.Block
    • setType

      public void setType(org.bukkit.Material type, boolean applyPhysics)
      Specified by:
      setType in interface org.bukkit.block.Block
    • getFace

      public org.bukkit.block.BlockFace getFace(@NotNull @NotNull org.bukkit.block.Block block)
      Specified by:
      getFace in interface org.bukkit.block.Block
    • getState

      public org.bukkit.block.BlockState getState()
      Specified by:
      getState in interface org.bukkit.block.Block
    • getBiome

      @NotNull public @NotNull org.bukkit.block.Biome getBiome()
      Specified by:
      getBiome in interface org.bukkit.block.Block
    • getComputedBiome

      @NotNull public @NotNull org.bukkit.block.Biome getComputedBiome()
      Specified by:
      getComputedBiome in interface org.bukkit.block.Block
    • getDestroySpeed

      @NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Specified by:
      getDestroySpeed in interface org.bukkit.block.Block
    • getState

      @NotNull public @NotNull org.bukkit.block.BlockState getState(boolean useSnapshot)
      Specified by:
      getState in interface org.bukkit.block.Block
    • isValidTool

      public boolean isValidTool(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Specified by:
      isValidTool in interface org.bukkit.block.Block
    • setBiome

      public void setBiome(org.bukkit.block.Biome bio)
      Specified by:
      setBiome in interface org.bukkit.block.Block
    • isBlockPowered

      public boolean isBlockPowered()
      Specified by:
      isBlockPowered in interface org.bukkit.block.Block
    • isBlockIndirectlyPowered

      public boolean isBlockIndirectlyPowered()
      Specified by:
      isBlockIndirectlyPowered in interface org.bukkit.block.Block
    • isBlockFacePowered

      public boolean isBlockFacePowered(org.bukkit.block.BlockFace face)
      Specified by:
      isBlockFacePowered in interface org.bukkit.block.Block
    • isBlockFaceIndirectlyPowered

      public boolean isBlockFaceIndirectlyPowered(org.bukkit.block.BlockFace face)
      Specified by:
      isBlockFaceIndirectlyPowered in interface org.bukkit.block.Block
    • getBlockPower

      public int getBlockPower(org.bukkit.block.BlockFace face)
      Specified by:
      getBlockPower in interface org.bukkit.block.Block
    • getBlockPower

      public int getBlockPower()
      Specified by:
      getBlockPower in interface org.bukkit.block.Block
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.bukkit.block.Block
    • isBurnable

      public boolean isBurnable()
      Specified by:
      isBurnable in interface org.bukkit.block.Block
    • isSolid

      public boolean isSolid()
      Specified by:
      isSolid in interface org.bukkit.block.Block
    • isCollidable

      public boolean isCollidable()
      Specified by:
      isCollidable in interface org.bukkit.block.Block
    • isReplaceable

      public boolean isReplaceable()
      Specified by:
      isReplaceable in interface org.bukkit.block.Block
    • isLiquid

      public boolean isLiquid()
      Specified by:
      isLiquid in interface org.bukkit.block.Block
    • isBuildable

      public boolean isBuildable()
      Specified by:
      isBuildable in interface org.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:
      getSoundGroup in interface org.bukkit.block.Block
    • getBlockSoundGroup

      @NotNull public @NotNull org.bukkit.SoundGroup getBlockSoundGroup()
      Specified by:
      getBlockSoundGroup in interface org.bukkit.block.Block
    • getTranslationKey

      @NotNull public @NotNull String getTranslationKey()
      Specified by:
      getTranslationKey in interface org.bukkit.block.Block
    • getDestroySpeed

      @NotNull public @org.jetbrains.annotations.NotNull float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants)
      Specified by:
      getDestroySpeed in interface org.bukkit.block.Block
    • breakNaturally

      public boolean breakNaturally(@NotNull @NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect)
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • breakNaturally

      public boolean breakNaturally(boolean triggerEffect)
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • getTemperature

      public double getTemperature()
      Specified by:
      getTemperature in interface org.bukkit.block.Block
    • getHumidity

      public double getHumidity()
      Specified by:
      getHumidity in interface org.bukkit.block.Block
    • getPistonMoveReaction

      public org.bukkit.block.PistonMoveReaction getPistonMoveReaction()
      Specified by:
      getPistonMoveReaction in interface org.bukkit.block.Block
    • breakNaturally

      public boolean breakNaturally()
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • breakNaturally

      public boolean breakNaturally(org.bukkit.inventory.ItemStack tool)
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • getDrops

      public Collection<org.bukkit.inventory.ItemStack> getDrops()
      Specified by:
      getDrops in interface org.bukkit.block.Block
    • getDrops

      public Collection<org.bukkit.inventory.ItemStack> getDrops(org.bukkit.inventory.ItemStack tool)
      Specified by:
      getDrops in interface org.bukkit.block.Block
    • getBlockData

      public org.bukkit.block.data.BlockData getBlockData()
      Specified by:
      getBlockData in interface org.bukkit.block.Block
    • setBlockData

      public void setBlockData(@NotNull @NotNull org.bukkit.block.data.BlockData data)
      Specified by:
      setBlockData in interface org.bukkit.block.Block
    • setBlockData

      public void setBlockData(org.bukkit.block.data.BlockData data, boolean applyPhysics)
      Specified by:
      setBlockData in interface org.bukkit.block.Block
    • isPassable

      public boolean isPassable()
      Specified by:
      isPassable in interface org.bukkit.block.Block
    • rayTrace

      public org.bukkit.util.RayTraceResult rayTrace(org.bukkit.Location start, org.bukkit.util.Vector direction, double maxDistance, org.bukkit.FluidCollisionMode fluidCollisionMode)
      Specified by:
      rayTrace in interface org.bukkit.block.Block
    • getBoundingBox

      public org.bukkit.util.BoundingBox getBoundingBox()
      Specified by:
      getBoundingBox in interface org.bukkit.block.Block
    • getCollisionShape

      @NotNull public @NotNull org.bukkit.util.VoxelShape getCollisionShape()
      Specified by:
      getCollisionShape in interface org.bukkit.block.Block
    • getDrops

      public Collection<org.bukkit.inventory.ItemStack> getDrops(org.bukkit.inventory.ItemStack tool, org.bukkit.entity.Entity entity)
      Specified by:
      getDrops in interface org.bukkit.block.Block
    • setState

      public void setState(@NotNull @NotNull BlockStateMock state)
      This method sets the current BlockState to the provided BlockStateMock. Do not call this method directly, use BlockState.update() instead.
      Parameters:
      state - The BlockState that should be set.
    • applyBoneMeal

      public boolean applyBoneMeal(org.bukkit.block.BlockFace face)
      Specified by:
      applyBoneMeal in interface org.bukkit.block.Block
    • isPreferredTool

      public boolean isPreferredTool(org.bukkit.inventory.ItemStack tool)
      Specified by:
      isPreferredTool in interface org.bukkit.block.Block
    • getBreakSpeed

      public float getBreakSpeed(@NotNull @NotNull org.bukkit.entity.Player player)
      Specified by:
      getBreakSpeed in interface org.bukkit.block.Block
    • canPlace

      public boolean canPlace(org.bukkit.block.data.BlockData data)
      Specified by:
      canPlace in interface org.bukkit.block.Block
    • translationKey

      @NotNull public @NotNull String translationKey()
      Specified by:
      translationKey in interface net.kyori.adventure.translation.Translatable