Overview
TheTellusIntegration class provides integration with the Tellus mod (Terra 1-to-1 Earth) to generate real-world terrain data and ingest it into Voxy’s LOD system. It manages asynchronous terrain generation using a dedicated thread pool and builds detailed voxel data including terrain, water bodies, vegetation, and biome-specific surface blocks.
Package: com.ethan.voxyworldgenv2.integration.tellus
Architecture
The integration consists of several components:- TellusIntegration (main API): Manages initialization, worker threads, and generation queue
- TellusSampler: Samples real-world terrain data (heights, cover classes, slopes, water)
- VoxyIngester: Directly interfaces with Voxy’s internal engine for low-level voxel insertion
- TellusWorldFeatures: Places procedural trees and vegetation
Methods
isTellusWorld
Checks if a given level is a Tellus (Terra 1-to-1) world.The server level to check
true if the level uses Tellus’s EarthChunkGenerator, false otherwise- Initializes the integration on first call
- Checks if Tellus is present via
TellusSampler - Inspects the chunk generator class name for “EarthChunkGenerator”
- Returns
falseif Tellus is not installed
enqueueGenerate
Enqueues asynchronous LOD generation for a specific chunk position in a Tellus world.The Tellus world to generate LOD data for
The chunk position to generate
Callback invoked after generation completes (on worker thread). Pass
null if no callback is needed- Submits generation to a dedicated worker thread pool
- Prevents duplicate generation requests for the same chunk
- Invokes callback immediately if chunk is already being processed
- Thread pool uses caller-runs policy when queue is full (max 10,000 tasks)
- Worker threads run at
NORM_PRIORITY - 1to avoid blocking game logic
- Prefetch: Calls
TellusSampler.prefetch()to warm up data caches - Sample: Retrieves terrain heights, cover classes, slopes, water data
- Build: Constructs voxel sections with terrain, water, and vegetation
- Ingest: Directly inserts sections into Voxy’s world engine
- Cleanup: Removes chunk from tracking set and invokes callback
- Thread count:
max(1, availableProcessors / 2) - Queue capacity: 10,000 tasks
- Rejection policy: Caller-runs (tasks execute on calling thread when queue is full)
- Thread naming:
tellus-voxy-worker-N
shutdown
Shuts down the integration, stopping all worker threads and clearing state.- Forcibly terminates the worker thread pool (
shutdownNow()) - Waits up to 2 seconds for threads to terminate
- Clears the set of in-progress chunks
- Resets initialization state
- Logs shutdown completion
Generation Details
Terrain Surface Rules
The integration applies biome-specific surface blocks based on ESA cover classes and slopes:Default for most land biomes (grass block top, dirt filler)
Deserts, beaches (sand top, sandstone filler)
High slopes (≥3) above sea level (stone top and filler)
ESA class 70 regions (snow block top, deepslate filler)
Oceans use gravel (10%), clay (5%), or sand (85%) based on random variation
Mangrove swamps (mud top and filler)
Water Handling
Water bodies are processed with shoreline detection:- Expanded Grid: Samples a 24×24 grid (includes 4-block border) to detect shorelines beyond chunk boundaries
- Distance to Shore: Calculates distance to nearest land within 5 blocks
- Shallow Slopes: Lowers underwater terrain near shores (
targetHeight = waterLevel - distanceToShore) - Ocean Depth: Ensures ocean floors are at least 8 blocks below sea level
- Water Surface: Uses sampled water head heights from Tellus data
Vegetation Placement
The integration places three types of vegetation:Large trees placed based on Tellus forest cover data, using various oak/birch/spruce log and leaf blocks
Grass, flowers, mushrooms placed on grass blocks in non-badlands/desert biomes
Kelp, seagrass placed in water columns
Map<BlockPos, Long> and placed during voxel section building.
Lighting and Biomes
All voxel data includes:- Block ID: From Voxy’s
BlockStateMapper - Biome ID: Sampled from Minecraft’s biome source at each quart-position
- Sky Light: Full brightness (level 15) for all blocks
Performance Characteristics
Tellus data is pre-cached via
prefetch() before samplingProcesses up to ~384 sections per chunk (24 vertical sections × 16×16 columns)
Bypasses normal chunk pipelines, directly inserting into Voxy’s world engine
Worker pool processes multiple chunks in parallel (default: CPU cores / 2)
Implementation Details
Initialization
On first API call:- Initializes
TellusSampler(detects Tellus classes via reflection) - Initializes
VoxyIngester(resolves Voxy internal API) - Creates thread pool with daemon threads
- Logs initialization status
Duplicate Prevention
ThebuildingChunks concurrent set prevents duplicate work:
add(pos)returnsfalseif chunk is already being processed- Chunk is removed from set in
finallyblock after completion - Thread-safe across multiple worker threads
Error Handling
- Tellus Detection Failures: Return
falsefromisTellusWorld, log info - Generation Failures: Log error with chunk position, continue processing other chunks
- Voxy Unavailable: Return early from generation, no ingestion occurs
Utility Methods
seedFromCoords
Generates a pseudo-random seed from world coordinates (used internally for biome-based randomization).World X coordinate
World Y coordinate
World Z coordinate
Deterministic pseudo-random seed based on coordinates
Source Reference
SeeTellusIntegration.java:20-329 for the complete implementation.