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
ConstructorsConstructorDescriptionBukkitWorldGenAccess(@NotNull org.bukkit.World world, @NotNull Random random) Creates a new Bukkit-based world access wrapper. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.entity.EntityaddEntity(double x, double y, double z, @NotNull SavedEntity entity) Spawns aSavedEntity.voidaddEntity(double x, double y, double z, @NotNull CustomEntity<?> entity) Spawns aCustomEntity.@NotNull org.bukkit.entity.EntityaddEntity(double x, double y, double z, @NotNull org.bukkit.entity.EntityType type) Spawns a vanilla entity.final booleanIndicates whether some other object is "equal to" this one.@NotNull org.bukkit.block.BiomegetBiome(int x, int y, int z) Gets the biome at a position.@NotNull org.bukkit.block.data.BlockDatagetBlockData(int x, int y, int z) Gets theBlockDataat a position.@NotNull org.bukkit.block.BlockStategetBlockState(int x, int y, int z) Gets the fullBlockState.intgetHighestBlockY(int x, int z, org.bukkit.HeightMap heightMap) Gets the highest Y coordinate using aHeightMap.@NotNull org.bukkit.MaterialgetType(int x, int y, int z) Gets the material at a position.final inthashCode()Returns a hash code value for this object.@NotNull Randomrandom()Gets the random instance used for generation.voidsetBlock(int x, int y, int z, @NotNull CustomBlock block) Places aCustomBlockusing its default state.voidsetBlock(int x, int y, int z, @NotNull CustomBlock block, @NotNull org.bukkit.block.data.BlockData data) Places aCustomBlockwith explicitBlockData.voidsetBlock(int x, int y, int z, @NotNull org.bukkit.Material material) Sets a block using aMaterial.voidsetBlock(int x, int y, int z, @NotNull org.bukkit.block.data.BlockData data) Sets a block usingBlockData.final StringtoString()Returns a string representation of this record class.@NotNull org.bukkit.Worldworld()Gets the Bukkit world.
-
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 worldrandom- 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 aMaterial.- Specified by:
setBlockin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinatematerial- Material to place
-
setBlock
public void setBlock(int x, int y, int z, @NotNull @NotNull org.bukkit.block.data.BlockData data) Sets a block usingBlockData.- Specified by:
setBlockin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinatedata- Block data to apply
-
setBlock
Places aCustomBlockusing its default state.- Specified by:
setBlockin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinateblock- 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 aCustomBlockwith explicitBlockData.- Specified by:
setBlockin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinateblock- Custom block instancedata- 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:
addEntityin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinatetype- Entity type- Returns:
- Spawned entity
-
addEntity
Spawns aCustomEntity.- Specified by:
addEntityin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinateentity- Custom entity instance
-
addEntity
@Nullable public @Nullable org.bukkit.entity.Entity addEntity(double x, double y, double z, @NotNull @NotNull SavedEntity entity) Spawns aSavedEntity.- Specified by:
addEntityin interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinateentity- Saved entity definition- Returns:
- Spawned entity or
nullif failed
-
getType
@NotNull public @NotNull org.bukkit.Material getType(int x, int y, int z) Gets the material at a position.- Specified by:
getTypein interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinate- Returns:
- Material
-
getBlockData
@NotNull public @NotNull org.bukkit.block.data.BlockData getBlockData(int x, int y, int z) Gets theBlockDataat a position.- Specified by:
getBlockDatain interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinate- Returns:
- Block data
-
getBlockState
@NotNull public @NotNull org.bukkit.block.BlockState getBlockState(int x, int y, int z) Gets the fullBlockState.Includes tile entity data such as inventories, names, etc.
- Specified by:
getBlockStatein interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- 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:
getBiomein interfaceWorldGenAccess- Parameters:
x- X coordinatey- Y coordinatez- Z coordinate- Returns:
- Biome
-
getHighestBlockY
public int getHighestBlockY(int x, int z, org.bukkit.HeightMap heightMap) Gets the highest Y coordinate using aHeightMap.- Specified by:
getHighestBlockYin interfaceWorldGenAccess- Parameters:
x- X coordinatez- Z coordinateheightMap- Heightmap type- Returns:
- Highest Y value
-
world
@NotNull public @NotNull org.bukkit.World world()Gets the Bukkit world.- Specified by:
worldin interfaceWorldGenAccess- Returns:
- World instance
-
random
Gets the random instance used for generation.- Specified by:
randomin interfaceWorldGenAccess- Returns:
- Random instance
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object).
-