VanillaNativeBackend 5.46.0
The vanillagen helper process: native terrain core of the "vanilla" generator (Go program in native/vanillagen).
The server's main thread starts one process (when the first vanilla world is loaded) and publishes its loopback endpoint in the process environment; every generator instance, in every async worker thread, opens its own connection to it (see NativeTerrainFiller). The helper exits when its stdin pipe is closed, so it never outlives the server. If it cannot be started, nothing is published and the generator uses the PHP code.
Constants
ALGORITHM_VERSION
public const ALGORITHM_VERSION = 4Version of the generated terrain. Must match algorithmVersion in native/vanillagen/protocol.go: bump both whenever the chunks produced by the PHP stages (terrain, material rules, carvers), and so by the native ones, change.
ENV_ENDPOINT
public const ENV_ENDPOINT = "PM_VANILLAGEN_ENDPOINT"ENV_TOKEN
public const ENV_TOKEN = "PM_VANILLAGEN_TOKEN"PROTOCOL_VERSION
public const PROTOCOL_VERSION = 6Wire protocol version (must match native/vanillagen/protocol.go).
Methods
binaryName()
public static function binaryName() : stringendpoint()
public static function endpoint() : ?arrayEndpoint published by the main thread, if the helper is running.
getInstance()
public static function getInstance() : ?selfisRunning()
public function isRunning() : boollocateBinary()
public static function locateBinary(string $configured, string $dataPath) : ?stringFinds the program: the configured path if any, otherwise the binary shipped with the server for this platform (native/vanillagen/bin, copied out of the phar since a program cannot run from inside it), otherwise one placed by the server owner in <data>/bin/.
platformName()
public static function platformName() : stringPlatform suffix of the shipped binaries, e.g. "windows-amd64" or "linux-arm64".
prepareForServer()
public static function prepareForServer() : voidMain thread: starts the helper once, according to pocketmine.yml, and publishes its endpoint for the worker threads. Failures are logged and leave the PHP implementation in use.
publish()
public function publish() : voidMakes the endpoint visible to every thread of this process (worker threads read it with endpoint()).
start()
public static function start(string $binary, string $logFile, float $timeout = 10.0) : selfStarts the helper and waits until it listens.
stop()
public function stop() : voidCloses the helper's stdin (it exits), then kills it if it does not exit within two seconds.
