Class BlockMock

java.lang.Object
be.seeseemelk.mockbukkit.block.BlockMock
All Implemented Interfaces:
net.kyori.adventure.translation.Translatable, Block, Metadatable, Translatable

public class BlockMock extends Object implements Block
Mock implementation of a Block.
  • Constructor Details

    • BlockMock

      public BlockMock()
      Creates a basic block made of air.
    • BlockMock

      public BlockMock(@NotNull @NotNull 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 Material material)
      Creates a basic block with a given material.
      Parameters:
      material - The material to give the block.
    • BlockMock

      public BlockMock(@NotNull @NotNull Material material, @Nullable @Nullable 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, @NotNull @NotNull MetadataValue newMetadataValue)
      Specified by:
      setMetadata in interface Metadatable
    • getMetadata

      @NotNull public @NotNull List<MetadataValue> getMetadata(String metadataKey)
      Specified by:
      getMetadata in interface Metadatable
    • hasMetadata

      public boolean hasMetadata(String metadataKey)
      Specified by:
      hasMetadata in interface Metadatable
    • removeMetadata

      public void removeMetadata(String metadataKey, Plugin owningPlugin)
      Specified by:
      removeMetadata in interface Metadatable
    • getData

      @Deprecated(since="1.6.2") public byte getData()
      Deprecated.
      Specified by:
      getData in interface Block
    • getRelative

      @NotNull public @NotNull Block getRelative(int modX, int modY, int modZ)
      Specified by:
      getRelative in interface Block
    • getRelative

      @NotNull public @NotNull Block getRelative(@NotNull @NotNull BlockFace face)
      Specified by:
      getRelative in interface Block
    • getRelative

      @NotNull public @NotNull Block getRelative(@NotNull @NotNull BlockFace face, int distance)
      Specified by:
      getRelative in interface Block
    • assertType

      public void assertType(@NotNull @NotNull 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 Material getType()
      Specified by:
      getType in interface Block
    • getLightLevel

      public byte getLightLevel()
      Specified by:
      getLightLevel in interface Block
    • getLightFromSky

      public byte getLightFromSky()
      Specified by:
      getLightFromSky in interface 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:
      getLightFromBlocks in interface 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 World getWorld()
      Specified by:
      getWorld in interface Block
    • getX

      public int getX()
      Specified by:
      getX in interface Block
    • getY

      public int getY()
      Specified by:
      getY in interface Block
    • getZ

      public int getZ()
      Specified by:
      getZ in interface Block
    • getBlockKey

      @Deprecated(since="1.18") public long getBlockKey()
      Deprecated.
      Specified by:
      getBlockKey in interface Block
    • getLocation

      @NotNull public @NotNull Location getLocation()
      Specified by:
      getLocation in interface Block
    • getLocation

      public Location getLocation(@Nullable @Nullable Location loc)
      Specified by:
      getLocation in interface Block
    • getChunk

      @NotNull public @NotNull Chunk getChunk()
      Specified by:
      getChunk in interface Block
    • setType

      public void setType(@NotNull @NotNull Material type)
      Specified by:
      setType in interface Block
    • setType

      public void setType(@NotNull @NotNull Material type, boolean applyPhysics)
      Specified by:
      setType in interface Block
    • getFace

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

      @NotNull public @NotNull BlockState getState()
      Specified by:
      getState in interface Block
    • getBiome

      @NotNull public @NotNull Biome getBiome()
      Specified by:
      getBiome in interface Block
    • getComputedBiome

      @NotNull public @NotNull Biome getComputedBiome()
      Specified by:
      getComputedBiome in interface Block
    • getDestroySpeed

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

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

      public boolean isValidTool(@NotNull @NotNull ItemStack itemStack)
      Specified by:
      isValidTool in interface Block
    • setBiome

      public void setBiome(@NotNull @NotNull Biome bio)
      Specified by:
      setBiome in interface Block
    • isBlockPowered

      public boolean isBlockPowered()
      Specified by:
      isBlockPowered in interface Block
    • isBlockIndirectlyPowered

      public boolean isBlockIndirectlyPowered()
      Specified by:
      isBlockIndirectlyPowered in interface Block
    • isBlockFacePowered

      public boolean isBlockFacePowered(@NotNull @NotNull BlockFace face)
      Specified by:
      isBlockFacePowered in interface Block
    • isBlockFaceIndirectlyPowered

      public boolean isBlockFaceIndirectlyPowered(@NotNull @NotNull BlockFace face)
      Specified by:
      isBlockFaceIndirectlyPowered in interface Block
    • getBlockPower

      public int getBlockPower(@NotNull @NotNull BlockFace face)
      Specified by:
      getBlockPower in interface Block
    • getBlockPower

      public int getBlockPower()
      Specified by:
      getBlockPower in interface Block
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Block
    • isBurnable

      public boolean isBurnable()
      Specified by:
      isBurnable in interface Block
    • isSolid

      public boolean isSolid()
      Specified by:
      isSolid in interface Block
    • isCollidable

      public boolean isCollidable()
      Specified by:
      isCollidable in interface Block
    • isReplaceable

      public boolean isReplaceable()
      Specified by:
      isReplaceable in interface Block
    • isLiquid

      public boolean isLiquid()
      Specified by:
      isLiquid in interface Block
    • isBuildable

      public boolean isBuildable()
      Specified by:
      isBuildable in interface Block
    • getSoundGroup

      @Deprecated(forRemoval=true) @NotNull public @NotNull BlockSoundGroup getSoundGroup()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getSoundGroup in interface Block
    • getBlockSoundGroup

      @NotNull public @NotNull SoundGroup getBlockSoundGroup()
      Specified by:
      getBlockSoundGroup in interface Block
    • getTranslationKey

      @Deprecated(forRemoval=true) @NotNull public @NotNull String getTranslationKey()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getTranslationKey in interface Block
      Specified by:
      getTranslationKey in interface Translatable
    • getDestroySpeed

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

      public boolean breakNaturally(@NotNull @NotNull ItemStack tool, boolean triggerEffect)
      Specified by:
      breakNaturally in interface Block
    • tick

      public void tick()
      Specified by:
      tick in interface Block
    • fluidTick

      public void fluidTick()
      Specified by:
      fluidTick in interface Block
    • randomTick

      public void randomTick()
      Specified by:
      randomTick in interface Block
    • breakNaturally

      public boolean breakNaturally(boolean triggerEffect)
      Specified by:
      breakNaturally in interface Block
    • breakNaturally

      public boolean breakNaturally(@NotNull @NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience)
      Specified by:
      breakNaturally in interface Block
    • breakNaturally

      public boolean breakNaturally(boolean triggerEffect, boolean dropExperience)
      Specified by:
      breakNaturally in interface Block
    • getTemperature

      public double getTemperature()
      Specified by:
      getTemperature in interface Block
    • getHumidity

      public double getHumidity()
      Specified by:
      getHumidity in interface Block
    • getPistonMoveReaction

      @NotNull public @NotNull PistonMoveReaction getPistonMoveReaction()
      Specified by:
      getPistonMoveReaction in interface Block
    • breakNaturally

      public boolean breakNaturally()
      Specified by:
      breakNaturally in interface Block
    • breakNaturally

      public boolean breakNaturally(@Nullable @Nullable ItemStack tool)
      Specified by:
      breakNaturally in interface Block
    • getDrops

      @NotNull public @NotNull Collection<ItemStack> getDrops()
      Specified by:
      getDrops in interface Block
    • getDrops

      @NotNull public @NotNull Collection<ItemStack> getDrops(@Nullable @Nullable ItemStack tool)
      Specified by:
      getDrops in interface Block
    • getBlockData

      @NotNull public @NotNull BlockData getBlockData()
      Specified by:
      getBlockData in interface Block
    • setBlockData

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

      public void setBlockData(@NotNull @NotNull BlockData data, boolean applyPhysics)
      Specified by:
      setBlockData in interface Block
    • isPassable

      public boolean isPassable()
      Specified by:
      isPassable in interface Block
    • rayTrace

      public RayTraceResult rayTrace(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)
      Specified by:
      rayTrace in interface Block
    • getBoundingBox

      @NotNull public @NotNull BoundingBox getBoundingBox()
      Specified by:
      getBoundingBox in interface Block
    • getCollisionShape

      @NotNull public @NotNull VoxelShape getCollisionShape()
      Specified by:
      getCollisionShape in interface Block
    • getDrops

      @NotNull public @NotNull Collection<ItemStack> getDrops(@NotNull @NotNull ItemStack tool, Entity entity)
      Specified by:
      getDrops in interface 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(@NotNull @NotNull BlockFace face)
      Specified by:
      applyBoneMeal in interface Block
    • isPreferredTool

      public boolean isPreferredTool(@NotNull @NotNull ItemStack tool)
      Specified by:
      isPreferredTool in interface Block
    • getBreakSpeed

      public float getBreakSpeed(@NotNull @NotNull Player player)
      Specified by:
      getBreakSpeed in interface Block
    • canPlace

      public boolean canPlace(@NotNull @NotNull BlockData data)
      Specified by:
      canPlace in interface Block
    • translationKey

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