Class VirtualBlock

java.lang.Object
com.github.darksoulq.abyssallib.world.gen.VirtualBlock
All Implemented Interfaces:
net.kyori.adventure.translation.Translatable, org.bukkit.block.Block, org.bukkit.metadata.Metadatable, org.bukkit.Translatable

public class VirtualBlock extends Object implements org.bukkit.block.Block
A headless block implementation designed for firing block interaction events or applying logic without directly instantiating a full world state.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VirtualBlock(org.bukkit.World world, int x, int y, int z, org.bukkit.Material type)
    Constructs a new virtual block.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    applyBoneMeal(@NotNull org.bukkit.block.BlockFace face)
     
    boolean
     
    boolean
    breakNaturally(boolean triggerEffect)
     
    boolean
    breakNaturally(boolean triggerEffect, boolean dropExperience)
     
    boolean
    breakNaturally(@NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect)
     
    boolean
    breakNaturally(@NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect, boolean dropExperience)
     
    boolean
    breakNaturally(@NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect, boolean dropExperience, boolean forceEffect)
     
    boolean
    breakNaturally(@Nullable org.bukkit.inventory.ItemStack tool)
     
    boolean
    canPlace(@NotNull org.bukkit.block.data.BlockData data)
     
    void
     
    @NotNull org.bukkit.block.Biome
     
    @NotNull org.bukkit.block.data.BlockData
    Retrieves the block data for this virtual block based on its material.
    long
     
    int
     
    int
    getBlockPower(@NotNull org.bukkit.block.BlockFace face)
     
    @NotNull org.bukkit.SoundGroup
    Retrieves the core sound group associated with this block.
    @NotNull org.bukkit.util.BoundingBox
    Retrieves the bounding box for this virtual block.
    float
    getBreakSpeed(@NotNull org.bukkit.entity.Player player)
     
    @NotNull org.bukkit.Chunk
     
    @NotNull org.bukkit.util.VoxelShape
    Retrieves the collision shape of this virtual block.
    @NotNull org.bukkit.block.Biome
     
    byte
     
    float
    getDestroySpeed(@NotNull org.bukkit.inventory.ItemStack itemStack)
     
    float
    getDestroySpeed(@NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants)
     
    @NotNull Collection<org.bukkit.inventory.ItemStack>
     
    @NotNull Collection<org.bukkit.inventory.ItemStack>
    getDrops(@Nullable org.bukkit.inventory.ItemStack tool)
     
    @NotNull Collection<org.bukkit.inventory.ItemStack>
    getDrops(@Nullable org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity)
     
    @NotNull org.bukkit.block.BlockFace
    getFace(@NotNull org.bukkit.block.Block block)
     
    double
     
    byte
     
    byte
     
    byte
     
    @NotNull org.bukkit.Location
    Gets the location of this virtual block.
    @NotNull org.bukkit.Location
    getLocation(@Nullable org.bukkit.Location loc)
    Stores the location of this block into the provided object.
    @NotNull List<org.bukkit.metadata.MetadataValue>
    getMetadata(@NotNull String metadataKey)
     
    @NotNull org.bukkit.block.PistonMoveReaction
     
    @NotNull org.bukkit.block.Block
    getRelative(int modX, int modY, int modZ)
    Gets a virtual relative block relative to this block's coordinates.
    @NotNull org.bukkit.block.Block
    getRelative(@NotNull org.bukkit.block.BlockFace face)
    Gets a virtual relative block at the specified face.
    @NotNull org.bukkit.block.Block
    getRelative(@NotNull org.bukkit.block.BlockFace face, int distance)
    Gets a virtual relative block at the specified face and distance.
    @NotNull com.destroystokyo.paper.block.BlockSoundGroup
    Retrieves the sound group associated with this block's material.
    @NotNull org.bukkit.block.BlockState
     
    @NotNull org.bukkit.block.BlockState
    getState(boolean useSnapshot)
     
    double
     
    @NotNull String
     
    @NotNull org.bukkit.Material
    Retrieves the material type of this virtual block.
    @NotNull org.bukkit.World
     
    int
     
    int
     
    int
     
    boolean
    hasMetadata(@NotNull String metadataKey)
     
    boolean
    isBlockFaceIndirectlyPowered(@NotNull org.bukkit.block.BlockFace face)
     
    boolean
    isBlockFacePowered(@NotNull org.bukkit.block.BlockFace face)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    isPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    isValidTool(@NotNull org.bukkit.inventory.ItemStack itemStack)
     
    void
     
    @Nullable org.bukkit.util.RayTraceResult
    rayTrace(@NotNull org.bukkit.Location start, @NotNull org.bukkit.util.Vector direction, double maxDistance, @NotNull org.bukkit.FluidCollisionMode fluidCollisionMode)
     
    void
    removeMetadata(@NotNull String metadataKey, @NotNull org.bukkit.plugin.Plugin owningPlugin)
     
    void
    setBiome(@NotNull org.bukkit.block.Biome biome)
     
    void
    setBlockData(@NotNull org.bukkit.block.data.BlockData data)
    Sets the material of this virtual block based on the provided block data.
    void
    setBlockData(@NotNull org.bukkit.block.data.BlockData data, boolean applyPhysics)
    Sets the block data and ignores physics.
    void
    setMetadata(@NotNull String metadataKey, @NotNull org.bukkit.metadata.MetadataValue newMetadataValue)
     
    void
    setType(@NotNull org.bukkit.Material type)
    Sets the material type of this virtual block.
    void
    setType(@NotNull org.bukkit.Material type, boolean applyPhysics)
    Sets the material type and ignores physics application.
    void
     
    @NotNull String
     

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VirtualBlock

      public VirtualBlock(org.bukkit.World world, int x, int y, int z, org.bukkit.Material type)
      Constructs a new virtual block.
      Parameters:
      world - The world context.
      x - The X coordinate.
      y - The Y coordinate.
      z - The Z coordinate.
      type - The material type representing this block.
  • Method Details

    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation()
      Gets the location of this virtual block.
      Specified by:
      getLocation in interface org.bukkit.block.Block
      Returns:
      The location.
    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation(@Nullable @Nullable org.bukkit.Location loc)
      Stores the location of this block into the provided object.
      Specified by:
      getLocation in interface org.bukkit.block.Block
      Parameters:
      loc - The location to overwrite.
      Returns:
      The modified location object.
    • getType

      @NotNull public @NotNull org.bukkit.Material getType()
      Retrieves the material type of this virtual block.
      Specified by:
      getType in interface org.bukkit.block.Block
      Returns:
      The material.
    • setType

      public void setType(@NotNull @NotNull org.bukkit.Material type)
      Sets the material type of this virtual block.
      Specified by:
      setType in interface org.bukkit.block.Block
      Parameters:
      type - The new material.
    • setType

      public void setType(@NotNull @NotNull org.bukkit.Material type, boolean applyPhysics)
      Sets the material type and ignores physics application.
      Specified by:
      setType in interface org.bukkit.block.Block
      Parameters:
      type - The new material.
      applyPhysics - Ignored.
    • getBlockData

      @NotNull public @NotNull org.bukkit.block.data.BlockData getBlockData()
      Retrieves the block data for this virtual block based on its material.
      Specified by:
      getBlockData in interface org.bukkit.block.Block
      Returns:
      The generated block data.
    • setBlockData

      public void setBlockData(@NotNull @NotNull org.bukkit.block.data.BlockData data)
      Sets the material of this virtual block based on the provided block data.
      Specified by:
      setBlockData in interface org.bukkit.block.Block
      Parameters:
      data - The block data to apply.
    • setBlockData

      public void setBlockData(@NotNull @NotNull org.bukkit.block.data.BlockData data, boolean applyPhysics)
      Sets the block data and ignores physics.
      Specified by:
      setBlockData in interface org.bukkit.block.Block
      Parameters:
      data - The block data to apply.
      applyPhysics - Ignored.
    • getRelative

      @NotNull public @NotNull org.bukkit.block.Block getRelative(int modX, int modY, int modZ)
      Gets a virtual relative block relative to this block's coordinates.
      Specified by:
      getRelative in interface org.bukkit.block.Block
      Parameters:
      modX - The X modifier.
      modY - The Y modifier.
      modZ - The Z modifier.
      Returns:
      A new empty virtual block at the relative coordinates.
    • getRelative

      @NotNull public @NotNull org.bukkit.block.Block getRelative(@NotNull @NotNull org.bukkit.block.BlockFace face)
      Gets a virtual relative block at the specified face.
      Specified by:
      getRelative in interface org.bukkit.block.Block
      Parameters:
      face - The block face to check.
      Returns:
      The relative virtual block.
    • getRelative

      @NotNull public @NotNull org.bukkit.block.Block getRelative(@NotNull @NotNull org.bukkit.block.BlockFace face, int distance)
      Gets a virtual relative block at the specified face and distance.
      Specified by:
      getRelative in interface org.bukkit.block.Block
      Parameters:
      face - The block face direction.
      distance - The distance to multiply the offset by.
      Returns:
      The relative virtual block.
    • getBoundingBox

      @NotNull public @NotNull org.bukkit.util.BoundingBox getBoundingBox()
      Retrieves the bounding box for this virtual block.
      Specified by:
      getBoundingBox in interface org.bukkit.block.Block
      Returns:
      A 1x1x1 bounding box at this block's location.
    • getCollisionShape

      @NotNull public @NotNull org.bukkit.util.VoxelShape getCollisionShape()
      Retrieves the collision shape of this virtual block.
      Specified by:
      getCollisionShape in interface org.bukkit.block.Block
      Returns:
      A voxel shape encompassing the standard bounding box.
    • getSoundGroup

      @NotNull public @NotNull com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup()
      Retrieves the sound group associated with this block's material.
      Specified by:
      getSoundGroup in interface org.bukkit.block.Block
      Returns:
      The block sound group.
    • getBlockSoundGroup

      @NotNull public @NotNull org.bukkit.SoundGroup getBlockSoundGroup()
      Retrieves the core sound group associated with this block.
      Specified by:
      getBlockSoundGroup in interface org.bukkit.block.Block
      Returns:
      The sound group.
    • 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
    • getData

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

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

      @NotNull public @NotNull org.bukkit.block.BlockState getState()
      Specified by:
      getState 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
    • 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
    • setBiome

      public void setBiome(@NotNull @NotNull org.bukkit.block.Biome biome)
      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(@NotNull @NotNull org.bukkit.block.BlockFace face)
      Specified by:
      isBlockFacePowered in interface org.bukkit.block.Block
    • isBlockFaceIndirectlyPowered

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

      public int getBlockPower(@NotNull @NotNull 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
    • 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
    • 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

      @NotNull public @NotNull 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(@Nullable @Nullable org.bukkit.inventory.ItemStack tool)
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • breakNaturally

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

      public boolean breakNaturally(boolean triggerEffect, boolean dropExperience)
      Specified by:
      breakNaturally 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(@NotNull @NotNull org.bukkit.inventory.ItemStack tool, boolean triggerEffect, boolean dropExperience)
      Specified by:
      breakNaturally in interface org.bukkit.block.Block
    • breakNaturally

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

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

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

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

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

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

      @Nullable public @Nullable 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:
      rayTrace in interface org.bukkit.block.Block
    • canPlace

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

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

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

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

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

      public boolean isPreferredTool(@NotNull @NotNull 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
    • getWorld

      @NotNull public @NotNull 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

      public long getBlockKey()
      Specified by:
      getBlockKey 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
    • getChunk

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

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

      public void tick()
      Specified by:
      tick in interface org.bukkit.block.Block
    • fluidTick

      public void fluidTick()
      Specified by:
      fluidTick in interface org.bukkit.block.Block
    • randomTick

      public void randomTick()
      Specified by:
      randomTick in interface org.bukkit.block.Block
    • isBurnable

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

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

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

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

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

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

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

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