Skip to main content

Overview

The Engine interface (implemented by IrisEngine) provides low-level access to Iris terrain generation, biome queries, and world manipulation.

Getting Engine Access

import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import org.bukkit.World;

World world = Bukkit.getWorld("myworld");
if (IrisToolbelt.isIrisWorld(world)) {
    Engine engine = IrisToolbelt.access(world).getEngine();
}

Core Methods

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

World Information

getWorld()
IrisWorld
Returns the Iris world wrapper
IrisWorld irisWorld = engine.getWorld();
World bukkitWorld = irisWorld.realWorld();
getDimension()
IrisDimension
Returns the dimension configuration
IrisDimension dimension = engine.getDimension();
String name = dimension.getName();
int height = dimension.getDimensionHeight();
getData()
IrisData
Returns the data loader for all dimension resources
IrisData data = engine.getData();
getTarget()
EngineTarget
Returns the engine target (world + dimension)

Biome Queries

getSurfaceBiome(int x, int z)
IrisBiome
Gets the surface biome at block coordinatesParameters:
  • x - Block X coordinate
  • z - Block Z coordinate
Returns: IrisBiome at the surface
IrisBiome biome = engine.getSurfaceBiome(100, 200);
System.out.println("Biome: " + biome.getName());
getCaveBiome(int x, int z)
IrisBiome
Gets the cave/underground biome at coordinatesParameters:
  • x - Block X coordinate
  • z - Block Z coordinate
Returns: IrisBiome for caves
getBiome(int x, int y, int z)
IrisBiome
Gets the biome at 3D coordinates (surface or cave depending on height)Parameters:
  • x - Block X coordinate
  • y - Block Y coordinate
  • z - Block Z coordinate
getAllBiomes()
KList<IrisBiome>
Returns all biomes in this dimension
KList<IrisBiome> biomes = engine.getAllBiomes();
for (IrisBiome biome : biomes) {
    System.out.println(biome.getName());
}

Region Queries

getRegion(int x, int z)
IrisRegion
Gets the region at block coordinatesParameters:
  • x - Block X coordinate
  • z - Block Z coordinate
Returns: IrisRegion

Height Queries

getHeight(int x, int z)
int
Gets the surface height at coordinates (ignores fluids by default)Parameters:
  • x - Block X coordinate
  • z - Block Z coordinate
Returns: Y coordinate of highest solid block
int height = engine.getHeight(0, 0);
getHeight(int x, int z, boolean ignoreFluid)
int
Gets surface height with fluid controlParameters:
  • x - Block X coordinate
  • z - Block Z coordinate
  • ignoreFluid - If true, returns highest solid block; if false, includes water/lava

Structure Queries

getStructureAt(int x, int z)
IrisJigsawStructure
Gets the jigsaw structure at chunk coordinatesParameters:
  • x - Chunk X coordinate
  • z - Chunk Z coordinate
Returns: IrisJigsawStructure or null
getStructureAt(int x, int y, int z)
IrisJigsawStructure
Gets the jigsaw structure at block coordinatesParameters:
  • x - Block X coordinate
  • y - Block Y coordinate
  • z - Block Z coordinate
getObjectsAt(int x, int z)
Set<String>
Gets object names at chunk coordinatesParameters:
  • x - Chunk X coordinate
  • z - Chunk Z coordinate
Returns: Set of object keys

Generation Stats

getGenerated()
int
Returns total chunks generated by this engine
getGeneratedPerSecond()
double
Returns current generation speed in chunks/second
System.out.println("Generating at " + engine.getGeneratedPerSecond() + " chunks/sec");
getBlockUpdatesPerSecond()
int
Returns block updates per second

Mantle & Data

getMantle()
EngineMantle
Returns the mantle system for chunk data storage
getComplex()
IrisComplex
Returns the complex system for advanced biome/height streams

Lifecycle

isStudio()
boolean
Returns true if this is a studio (development) world
isClosed()
boolean
Returns true if the engine has been shut down
close()
void
Shuts down the engine and saves all data
hotload()
void
Reloads dimension data from disk (studio mode only)
if (engine.isStudio()) {
    engine.hotload();  // Reload dimension files
}
save()
void
Saves mantle data and engine state

Advanced Features

Seed Management

getSeedManager()
SeedManager
Returns the seed manager for this world

Metrics

getMetrics()
EngineMetrics
Returns performance metrics
printMetrics(CommandSender)
void
Prints detailed performance metrics to a command sender

Script Execution

getExecution()
EngineEnvironment
Returns the script execution environment

Usage Examples

Find Biome Location

public Location findBiome(Engine engine, String biomeName) {
    IrisBiome targetBiome = engine.getData()
        .getBiomeLoader()
        .load(biomeName);
    
    if (targetBiome == null) {
        return null;
    }
    
    // Search random coordinates
    Random random = new Random();
    for (int i = 0; i < 1000; i++) {
        int x = random.nextInt(10000) - 5000;
        int z = random.nextInt(10000) - 5000;
        
        IrisBiome biome = engine.getSurfaceBiome(x, z);
        if (biome.getLoadKey().equals(biomeName)) {
            int y = engine.getHeight(x, z);
            return new Location(engine.getWorld().realWorld(), x, y, z);
        }
    }
    
    return null;
}

Monitor Generation

public void monitorGeneration(Engine engine) {
    Bukkit.getScheduler().runTaskTimer(plugin, () -> {
        double speed = engine.getGeneratedPerSecond();
        int total = engine.getGenerated();
        
        System.out.println(String.format(
            "Generated %d chunks (%.2f/sec)",
            total, speed
        ));
    }, 0L, 20L);
}

Custom Biome Distribution

public Map<String, Integer> analyzeBiomes(Engine engine, int radius) {
    Map<String, Integer> distribution = new HashMap<>();
    
    for (int x = -radius; x <= radius; x += 16) {
        for (int z = -radius; z <= radius; z += 16) {
            IrisBiome biome = engine.getSurfaceBiome(x, z);
            String name = biome.getName();
            distribution.put(name, distribution.getOrDefault(name, 0) + 1);
        }
    }
    
    return distribution;
}

See Also

Build docs developers (and LLMs) love