BaseNbtWorldData
in package
implements
WorldData
Interfaces, Classes, Traits and Enums
Table of Contents
- $compoundTag : CompoundTag
- $dataPath : string
- __construct() : mixed
- getCompoundTag() : CompoundTag
- getGenerator() : string
- Returns the generator name
- getGeneratorOptions() : string
- getName() : string
- getSeed() : int
- getSpawn() : Vector3
- getTime() : int
- setSpawn() : void
- setTime() : void
- fix() : void
- hackyFixForGeneratorClasspathInLevelDat() : null|string
- Hack to fix worlds broken previously by older versions of PocketMine-MP which incorrectly saved classpaths of generators into level.dat on imported (not generated) worlds.
- load() : CompoundTag
Properties
$compoundTag
protected
CompoundTag
$compoundTag
$dataPath
protected
string
$dataPath
Methods
__construct()
public
__construct(string $dataPath) : mixed
Parameters
- $dataPath : string
Tags
Return values
mixed —getCompoundTag()
public
getCompoundTag() : CompoundTag
Return values
CompoundTag —getGenerator()
Returns the generator name
public
getGenerator() : string
Return values
string —getGeneratorOptions()
public
getGeneratorOptions() : string
Return values
string —getName()
public
getName() : string
Return values
string —getSeed()
public
getSeed() : int
Return values
int —getSpawn()
public
getSpawn() : Vector3
Return values
Vector3 —getTime()
public
getTime() : int
Return values
int —setSpawn()
public
setSpawn(Vector3 $pos) : void
Parameters
- $pos : Vector3
Return values
void —setTime()
public
setTime(int $value) : void
Parameters
- $value : int
Return values
void —fix()
protected
abstract fix() : void
Tags
Return values
void —hackyFixForGeneratorClasspathInLevelDat()
Hack to fix worlds broken previously by older versions of PocketMine-MP which incorrectly saved classpaths of generators into level.dat on imported (not generated) worlds.
protected
static hackyFixForGeneratorClasspathInLevelDat(string $className) : null|string
This should only have affected leveldb worlds as far as I know, because PC format worlds include the generatorName tag by default. However, MCPE leveldb ones didn't, and so they would get filled in with something broken.
This bug took a long time to get found because previously the generator manager would just return the default generator silently on failure to identify the correct generator, which caused lots of unexpected bugs.
Only classnames which were written into the level.dat from "fixing" the level data are included here. These are hardcoded to avoid problems fixing broken worlds in the future if these classes get moved, renamed or removed.
Parameters
- $className : string
-
Classname saved in level.dat
Return values
null|string —Name of the correct generator to replace the broken value
load()
protected
abstract load() : CompoundTag