Moved runtime_block_states to vanilla

This commit is contained in:
Stephen 2019-11-04 21:47:44 -05:00
parent cd2b60a860
commit 5ebe9859e9
3 changed files with 7 additions and 28 deletions

View File

@ -316,16 +316,8 @@ class StartGamePacket extends DataPacket{
$states->push($state);
}
($stream = new NetworkLittleEndianNBTStream())->writeTag($states);
return $stream->buffer;
/*$stream = new NetworkBinaryStream();
$stream->putUnsignedVarInt(count($table));
foreach($table as $v){
$stream->putString($v["name"]);
$stream->putLShort($v["data"]);
$stream->putLShort($v["legacy_id"]);
}
return $stream->getBuffer();*/
return $stream->buffer;
}
private static function serializeItemTable(array $table) : string{

View File

@ -53,11 +53,9 @@ final class RuntimeBlockMapping{
public static function init() : void{
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/block_id_map.json"), true);
$compressedTable = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/required_block_states.json"), true);
try{
/** @var CompoundTag $tag */
$tag = (new BigEndianNBTStream())->read(file_get_contents(\pocketmine\RESOURCE_PATH . "runtime_block_states.dat"));
$tag = (new BigEndianNBTStream())->read(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/runtime_block_states.dat"));
}catch(BinaryDataException $e){
throw new \RuntimeException("", 0, $e);
}
@ -65,29 +63,18 @@ final class RuntimeBlockMapping{
$decompressed = [];
$states = $tag->getListTag("Palette");
/** @var CompoundTag $state */
foreach($states as $state){
/** @var CompoundTag $state */
$block = $state->getCompoundTag("block");
$name = $block->getString("name");
$decompressed[] = [
"name" => $block->getString("name"),
"name" => $name,
"states" => $block->getCompoundTag("states"),
"data" => $state->getShort("meta"),
"legacy_id" => $state->getShort("id"),
"legacy_id" => $legacyIdMap[$name]
];
}
/*
foreach($compressedTable as $prefix => $entries){
foreach($entries as $shortStringId => $states){
foreach($states as $state){
$name = "$prefix:$shortStringId";
$decompressed[] = [
"name" => $name,
"data" => $state,
"legacy_id" => $legacyIdMap[$name]
];
}
}*/
}
self::$bedrockKnownStates = self::randomizeTable($decompressed);
foreach(self::$bedrockKnownStates as $k => $obj){