RuntimeBlockMapping is now a singleton instead of static class

this prepares for a fully dynamic block mapper, as well as allowing a small performance improvement to chunk encoding by eliding the constant lazy-init checks.
This commit is contained in:
Dylan K. Taylor
2020-04-23 21:09:58 +01:00
parent f3fed60d57
commit aa1828aa98
4 changed files with 34 additions and 36 deletions

View File

@ -289,7 +289,7 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{
if($this->blockTable === null){
if(self::$blockTableCache === null){
//this is a really nasty hack, but it'll do for now
self::$blockTableCache = (new NetworkNbtSerializer())->write(new TreeRoot(new ListTag(RuntimeBlockMapping::getBedrockKnownStates())));
self::$blockTableCache = (new NetworkNbtSerializer())->write(new TreeRoot(new ListTag(RuntimeBlockMapping::getInstance()->getBedrockKnownStates())));
}
$out->put(self::$blockTableCache);
}else{