createTemporaryWorldWithGenerator

public static World createTemporaryWorldWithGenerator(String worldName, World.Environment environment, ChunkGenerator generator)

Creates a fresh temporary world using a caller-supplied ChunkGenerator, with no template folder on disk. Unlike createVoidTemporaryWorld, this does NOT auto-append an identifier — the caller is responsible for choosing a unique final world name. If a world with worldName is already loaded, it is returned immediately (matching loadVoidTemporaryWorld).

Post-create settings mirror createVoidTemporaryWorld: spawn not kept in memory, difficulty HARD, autosave off (these worlds are ephemeral).

Return

the created World, or null on failure

Parameters

worldName

unique world folder name under getWorldContainer

environment

nether / end / normal

generator

the ChunkGenerator responsible for producing surface blocks