Merge branch 'next-major' into modern-world-support

This commit is contained in:
Dylan K. Taylor
2022-04-20 14:29:22 +01:00
13 changed files with 68 additions and 26 deletions

View File

@ -28,6 +28,7 @@ use pocketmine\data\bedrock\blockstate\BlockStateSerializeException;
use pocketmine\data\bedrock\blockstate\BlockStateSerializer;
use pocketmine\data\bedrock\blockstate\BlockTypeNames;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\SimulationTypePacket;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\SingletonTrait;
use pocketmine\utils\Utils;
@ -53,8 +54,12 @@ final class RuntimeBlockMapping{
private BlockStateData $fallbackStateData;
private int $fallbackStateId;
private function __construct(){
$contents = Utils::assumeNotFalse(file_get_contents(Path::join(\pocketmine\BEDROCK_DATA_PATH, "canonical_block_states.nbt")), "Missing required resource file");
private static function make() : self{
return new self(Path::join(\pocketmine\BEDROCK_DATA_PATH, "canonical_block_states.nbt"));
}
public function __construct(string $canonicalBlockStatesFile){
$contents = Utils::assumeNotFalse(file_get_contents($canonicalBlockStatesFile), "Missing required resource file");
$this->blockStateDictionary = BlockStateDictionary::loadFromString($contents);
$this->blockStateSerializer = GlobalBlockStateHandlers::getSerializer();