Skip to content

VanillaGenerator 5.46.0 ​

class · pocketmine\world\generator\vanilla\VanillaGenerator · source

Extends Generator

Vanilla (1.18+) world generator: exact terrain shape, noise caves, aquifers and biomes, following the Java 26.3 worldgen data (Bedrock shares the overworld algorithm since 1.18). This class generates the Overworld; the VanillaNetherGenerator and VanillaEndGenerator subclasses generate the other dimensions from the "nether" and "end" noise settings.

Includes the material rules (surface blocks, bedrock, deepslate, ore veins), the carvers (old-style caves and canyons), the decoration features (ores, trees, vegetation, lakes... read from the vanilla placed/configured feature data, placed like Java Edition for the same seed, see FeatureDecorator) and the structures (villages, temples, ruins... see StructureManager and STRUCTURES-PLAN.md).

Options (generator preset, ";"-separated key=value):

  • data=<dir> vanilla worldgen data cache (default: <working directory>/vanilla-worldgen), filled automatically from Mojang's Java Edition data generator on first use (see VanillaDataFetcher)
  • backend=auto|compiled|interpreted (auto: the native core when the server started it, else compiled)
  • carvers=on|off (default on; also off when the data cache has no carver definitions)
  • features=true|false (default true): decoration features
  • structures=true|false (default true): structures
  • structure-positions=bedrock|java (default bedrock): Bedrock's structure positions where known, or Java's
  • disabled-structures=<ids> comma-separated structure or structure set ids (or patterns like village_*) not to generate, e.g. disabled-structures=mansion,minecraft:ancient_city
  • decoration=native|php (default native): with the native core, the decoration features it implements are placed by it (same blocks as PHP, less CPU); php places every feature in PHP

Constants ​

DEFAULT_DATA_DIR ​

php
public const DEFAULT_DATA_DIR = "vanilla-worldgen"

DIMENSION ​

php
public const DIMENSION = "overworld"

Dimension generated by this class: the noise settings and biome source id ("overworld", "nether", "end").

php
public const RECOMMENDED_WORKER_MEMORY_LIMIT_MB = 384

Async worker memory limit (memory.async-worker-hard-limit, MB) recommended for vanilla worlds: a generator worker holds the three dimension generators with their feature and structure data (~175 MB) and reaches ~240 MB while generating big structures. A lower limit is only warned about, never changed.

Methods ​

__construct() ​

php
public function __construct(int $seed, string $preset)

dataDirectory() ​

php
public static function dataDirectory(array $options) : string

generateChunk() ​

php
public function generateChunk(\pocketmine\world\ChunkManager $world, int $chunkX, int $chunkZ) : void

getCarvingMask() ​

php
public function getCarvingMask(int $chunkX, int $chunkZ) : ?array

Blocks of a recently generated chunk visited by the carvers (index ((x << 4) | z) * height + (y - minY)), or null if this generator did not generate the chunk recently.

getDecorator() ​

php
public function getDecorator() : \pocketmine\world\generator\vanilla\feature\FeatureDecorator

getStructureManager() ​

php
public function getStructureManager() : ?\pocketmine\world\generator\vanilla\structure\StructureManager

The structures of this generator (positions, starts, placement), or null if they are disabled (structures=false) or the data cache has no structure data.

parseOptions() ​

php
public static function parseOptions(string $preset) : array

populateChunk() ​

php
public function populateChunk(\pocketmine\world\ChunkManager $world, int $chunkX, int $chunkZ) : void

prepareNativeBackend() ​

php
public static function prepareNativeBackend() : void

Main thread: starts the native terrain core for the worker threads, if the server is configured to use it. Called when a vanilla world is loaded or created; does nothing after the first call.

validatePreset() ​

php
public static function validatePreset(string $preset) : ?\pocketmine\world\generator\InvalidGeneratorOptionsException

Preset validator for GeneratorManager (main thread): checks the options and makes sure the vanilla data is ready, fetching it automatically if needed (see VanillaDataManager).

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.