Skip to main content

Overview

The PlatformChunkGenerator interface provides access to the Iris engine and dimension data for a world.

Getting Generator Access

import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import org.bukkit.World;

World world = Bukkit.getWorld("myworld");

// Check if world uses Iris
if (IrisToolbelt.isIrisWorld(world)) {
    PlatformChunkGenerator generator = IrisToolbelt.access(world);
    // Use generator methods
}

PlatformChunkGenerator Interface

Location: core/src/main/java/com/volmit/iris/engine/platform/PlatformChunkGenerator.java

Methods

getEngine()
Engine
Returns the Iris engine instance for this worldReturns: Engine or null if not initialized
Engine engine = generator.getEngine();
if (engine != null) {
    IrisDimension dim = engine.getDimension();
}
getTarget()
EngineTarget
Returns the engine target containing world and dimension informationReturns: EngineTarget (never null)
EngineTarget target = generator.getTarget();
IrisWorld irisWorld = target.getWorld();
IrisDimension dimension = target.getDimension();
getData()
IrisData
Returns the data loader for this dimensionReturns: IrisData - provides access to all dimension resources
IrisData data = generator.getData();
IrisBiome biome = data.getBiomeLoader().load("plains");
isStudio()
boolean
Checks if this is a studio world (hotloadable, development mode)Returns: true if studio mode is enabled
close()
void
Closes and cleans up the generator. Called automatically on world unload.
touch(World)
void
Updates internal references to the Bukkit worldParameters:
  • world - The Bukkit world instance
injectChunkReplacement(World, int, int, Executor)
void
Injects a chunk replacement at the specified coordinatesParameters:
  • world - The target world
  • x - Chunk X coordinate
  • z - Chunk Z coordinate
  • syncExecutor - Executor for synchronous operations
getSpawnChunks()
CompletableFuture<Integer>
Returns a future that completes with the number of spawn chunks to generateReturns: CompletableFuture<Integer> with spawn chunk count
generator.getSpawnChunks().thenAccept(count -> {
    System.out.println("Generating " + count + " spawn chunks");
});

DataProvider Interface

PlatformChunkGenerator extends DataProvider, giving access to:
getData()
IrisData
Access to all dimension data loaders (biomes, regions, objects, etc.)

Hotloadable Interface

PlatformChunkGenerator extends Hotloadable for live reloading:
hotload()
void
Reloads dimension data without restarting the server (studio mode only)

Usage Examples

Check World Type

public boolean isIrisStudioWorld(World world) {
    if (!IrisToolbelt.isIrisWorld(world)) {
        return false;
    }
    return IrisToolbelt.access(world).isStudio();
}

Access Dimension Data

public void printDimensionInfo(World world) {
    PlatformChunkGenerator gen = IrisToolbelt.access(world);
    if (gen == null) {
        System.out.println("Not an Iris world");
        return;
    }
    
    Engine engine = gen.getEngine();
    if (engine == null) {
        System.out.println("Engine not ready");
        return;
    }
    
    IrisDimension dim = engine.getDimension();
    System.out.println("Dimension: " + dim.getName());
    System.out.println("Height: " + dim.getDimensionHeight());
    System.out.println("Biomes: " + dim.getAllBiomes(engine).size());
}

Wait for Spawn Generation

public void waitForSpawn(PlatformChunkGenerator generator) {
    generator.getSpawnChunks().thenAccept(chunkCount -> {
        Engine engine = generator.getEngine();
        while (engine.getGenerated() < chunkCount) {
            System.out.println("Progress: " + engine.getGenerated() + "/" + chunkCount);
            Thread.sleep(1000);
        }
        System.out.println("Spawn generation complete!");
    });
}

See Also

Build docs developers (and LLMs) love