Jump to content

Recommended Posts

Posted

Hi, I'm new to WorldGen modding and I'm trying to understand how the Event system works.
The issue I’m running into is that the ChunkColumnGenerationRequest values for ChunkX and ChunkZ are always very far away, and never close to the player or the spawn.

A sample of my console:

4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511664, 120, 511920
4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511664, 120, 512112
4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511920, 120, 511728
4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511952, 120, 511728
4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511984, 120, 511728
4.9.2025 15:36:33 [Server Notification] [testmod] place block at 511792, 120, 512304


Here a snippet of my code:

public override void StartServerSide(ICoreServerAPI api)
{
	api.Event.ChunkColumnGeneration(OnCaveGeneration, EnumWorldGenPass.Terrain, "standard");
}

private void OnCaveGeneration(IChunkColumnGenerateRequest request)
{
    Block blockType = _api.World.GetBlock(new AssetLocation("game:rock-granite"));
    BlockPos blockPos = new BlockPos(
        request.ChunkX * GlobalConstants.ChunkSize + GlobalConstants.ChunkSize / 2,
        120,
        request.ChunkZ * GlobalConstants.ChunkSize + GlobalConstants.ChunkSize / 2
    );
        
    bool isPlaced = blockType.TryPlaceBlockForWorldGen(_chunkGenBlockAccessor, blockPos, BlockFacing.UP, null);
    if(isPlaced)
        Mod.Logger.Notification($"place block at {blockPos}");
}


If you need anything else to help, tell me.

Posted

I got an answer from Discord.
Basically, the engine’s coordinates are not centered on the spawn point but on the corner of the map. But, the in-game coordinated are displayed with an offset of 512000. So the spawn shows up as 0,0 even if internally that’s not the case.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.