mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 05:40:01 +00:00
Moved runtime_block_states to vanilla
This commit is contained in:
parent
cd2b60a860
commit
5ebe9859e9
@ -316,16 +316,8 @@ class StartGamePacket extends DataPacket{
|
|||||||
$states->push($state);
|
$states->push($state);
|
||||||
}
|
}
|
||||||
($stream = new NetworkLittleEndianNBTStream())->writeTag($states);
|
($stream = new NetworkLittleEndianNBTStream())->writeTag($states);
|
||||||
return $stream->buffer;
|
|
||||||
|
|
||||||
/*$stream = new NetworkBinaryStream();
|
return $stream->buffer;
|
||||||
$stream->putUnsignedVarInt(count($table));
|
|
||||||
foreach($table as $v){
|
|
||||||
$stream->putString($v["name"]);
|
|
||||||
$stream->putLShort($v["data"]);
|
|
||||||
$stream->putLShort($v["legacy_id"]);
|
|
||||||
}
|
|
||||||
return $stream->getBuffer();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function serializeItemTable(array $table) : string{
|
private static function serializeItemTable(array $table) : string{
|
||||||
|
@ -53,11 +53,9 @@ final class RuntimeBlockMapping{
|
|||||||
public static function init() : void{
|
public static function init() : void{
|
||||||
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/block_id_map.json"), true);
|
$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{
|
try{
|
||||||
/** @var CompoundTag $tag */
|
/** @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){
|
}catch(BinaryDataException $e){
|
||||||
throw new \RuntimeException("", 0, $e);
|
throw new \RuntimeException("", 0, $e);
|
||||||
}
|
}
|
||||||
@ -65,29 +63,18 @@ final class RuntimeBlockMapping{
|
|||||||
$decompressed = [];
|
$decompressed = [];
|
||||||
|
|
||||||
$states = $tag->getListTag("Palette");
|
$states = $tag->getListTag("Palette");
|
||||||
foreach($states as $state){
|
|
||||||
/** @var CompoundTag $state */
|
/** @var CompoundTag $state */
|
||||||
$block = $state->getCompoundTag("block");
|
|
||||||
$decompressed[] = [
|
|
||||||
"name" => $block->getString("name"),
|
|
||||||
"states" => $block->getCompoundTag("states"),
|
|
||||||
"data" => $state->getShort("meta"),
|
|
||||||
"legacy_id" => $state->getShort("id"),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
foreach($compressedTable as $prefix => $entries){
|
|
||||||
foreach($entries as $shortStringId => $states){
|
|
||||||
foreach($states as $state){
|
foreach($states as $state){
|
||||||
$name = "$prefix:$shortStringId";
|
$block = $state->getCompoundTag("block");
|
||||||
|
$name = $block->getString("name");
|
||||||
$decompressed[] = [
|
$decompressed[] = [
|
||||||
"name" => $name,
|
"name" => $name,
|
||||||
"data" => $state,
|
"states" => $block->getCompoundTag("states"),
|
||||||
|
"data" => $state->getShort("meta"),
|
||||||
"legacy_id" => $legacyIdMap[$name]
|
"legacy_id" => $legacyIdMap[$name]
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
self::$bedrockKnownStates = self::randomizeTable($decompressed);
|
self::$bedrockKnownStates = self::randomizeTable($decompressed);
|
||||||
|
|
||||||
foreach(self::$bedrockKnownStates as $k => $obj){
|
foreach(self::$bedrockKnownStates as $k => $obj){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user