Record Class BukkitWorldGenAccess

java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.world.gen.BukkitWorldGenAccess
Record Components:
world - Target Bukkit world.
random - Random instance for generation logic.
All Implemented Interfaces:
WorldGenAccess

public record BukkitWorldGenAccess(org.bukkit.World world, Random random) extends Record implements WorldGenAccess
Standard WorldGenAccess implementation using the Bukkit API.

This implementation is intended for use outside of chunk generation, where full Bukkit world access is safe and unrestricted.

Unlike NMSWorldGenAccess, this class does not rely on internal server mechanics and instead operates directly on live world data.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BukkitWorldGenAccess(@NotNull org.bukkit.World world, @NotNull Random random)
    Creates a new Bukkit-based world access wrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.bukkit.entity.Entity
    addEntity(double x, double y, double z, @NotNull SavedEntity entity)
    Spawns a SavedEntity.
    void
    addEntity(double x, double y, double z, @NotNull CustomEntity<?> entity)
    Spawns a CustomEntity.
    @NotNull org.bukkit.entity.Entity
    addEntity(double x, double y, double z, @NotNull org.bukkit.entity.EntityType type)
    Spawns a vanilla entity.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NotNull org.bukkit.block.Biome
    getBiome(int x, int y, int z)
    Gets the biome at a position.
    @NotNull org.bukkit.block.data.BlockData
    getBlockData(int x, int y, int z)
    Gets the BlockData at a position.
    @NotNull org.bukkit.block.BlockState
    getBlockState(int x, int y, int z)
    Gets the full BlockState.
    int
    getHighestBlockY(int x, int z, org.bukkit.HeightMap heightMap)
    Gets the highest Y coordinate using a HeightMap.
    @NotNull org.bukkit.Material
    getType(int x, int y, int z)
    Gets the material at a position.
    final int
    Returns a hash code value for this object.
    @NotNull Random
    Gets the random instance used for generation.
    void
    setBlock(int x, int y, int z, @NotNull CustomBlock block)
    Places a CustomBlock using its default state.
    void
    setBlock(int x, int y, int z, @NotNull CustomBlock block, @NotNull org.bukkit.block.data.BlockData data)
    Places a CustomBlock with explicit BlockData.
    void
    setBlock(int x, int y, int z, @NotNull org.bukkit.Material material)
    Sets a block using a Material.
    void
    setBlock(int x, int y, int z, @NotNull org.bukkit.block.data.BlockData data)
    Sets a block using BlockData.
    final String
    Returns a string representation of this record class.
    @NotNull org.bukkit.World
    Gets the Bukkit world.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BukkitWorldGenAccess

      public BukkitWorldGenAccess(@NotNull @NotNull org.bukkit.World world, @NotNull @NotNull Random random)
      Creates a new Bukkit-based world access wrapper.
      Parameters:
      world - Target world
      random - Random instance for generation
  • Method Details

    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull org.bukkit.Material material)
      Sets a block using a Material.
      Specified by:
      setBlock in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      material - Material to place
    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull org.bukkit.block.data.BlockData data)
      Sets a block using BlockData.
      Specified by:
      setBlock in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      data - Block data to apply
    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull CustomBlock block)
      Places a CustomBlock using its default state.
      Specified by:
      setBlock in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      block - Custom block instance
    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull CustomBlock block, @NotNull @NotNull org.bukkit.block.data.BlockData data)
      Places a CustomBlock with explicit BlockData.
      Specified by:
      setBlock in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      block - Custom block instance
      data - Block data to apply
    • addEntity

      @NotNull public @NotNull org.bukkit.entity.Entity addEntity(double x, double y, double z, @NotNull @NotNull org.bukkit.entity.EntityType type)
      Spawns a vanilla entity.
      Specified by:
      addEntity in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      type - Entity type
      Returns:
      Spawned entity
    • addEntity

      public void addEntity(double x, double y, double z, @NotNull @NotNull CustomEntity<?> entity)
      Spawns a CustomEntity.
      Specified by:
      addEntity in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      entity - Custom entity instance
    • addEntity

      @Nullable public @Nullable org.bukkit.entity.Entity addEntity(double x, double y, double z, @NotNull @NotNull SavedEntity entity)
      Spawns a SavedEntity.
      Specified by:
      addEntity in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      entity - Saved entity definition
      Returns:
      Spawned entity or null if failed
    • getType

      @NotNull public @NotNull org.bukkit.Material getType(int x, int y, int z)
      Gets the material at a position.
      Specified by:
      getType in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      Returns:
      Material
    • getBlockData

      @NotNull public @NotNull org.bukkit.block.data.BlockData getBlockData(int x, int y, int z)
      Gets the BlockData at a position.
      Specified by:
      getBlockData in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      Returns:
      Block data
    • getBlockState

      @NotNull public @NotNull org.bukkit.block.BlockState getBlockState(int x, int y, int z)
      Gets the full BlockState.

      Includes tile entity data such as inventories, names, etc.

      Specified by:
      getBlockState in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      Returns:
      Block state snapshot
    • getBiome

      @NotNull public @NotNull org.bukkit.block.Biome getBiome(int x, int y, int z)
      Gets the biome at a position.
      Specified by:
      getBiome in interface WorldGenAccess
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      Returns:
      Biome
    • getHighestBlockY

      public int getHighestBlockY(int x, int z, org.bukkit.HeightMap heightMap)
      Gets the highest Y coordinate using a HeightMap.
      Specified by:
      getHighestBlockY in interface WorldGenAccess
      Parameters:
      x - X coordinate
      z - Z coordinate
      heightMap - Heightmap type
      Returns:
      Highest Y value
    • world

      @NotNull public @NotNull org.bukkit.World world()
      Gets the Bukkit world.
      Specified by:
      world in interface WorldGenAccess
      Returns:
      World instance
    • random

      @NotNull public @NotNull Random random()
      Gets the random instance used for generation.
      Specified by:
      random in interface WorldGenAccess
      Returns:
      Random instance
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.