mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
New, more efficient blockstate table format
this reduces the file size by ~90%.
This commit is contained in:
parent
898009a91b
commit
2bdbb9794c
@ -50,7 +50,20 @@ final class RuntimeBlockMapping{
|
|||||||
public static function init() : void{
|
public static function init() : void{
|
||||||
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "legacy_id_map.json"), true);
|
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "legacy_id_map.json"), true);
|
||||||
|
|
||||||
self::$bedrockKnownStates = self::randomizeTable(json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true));
|
$compressedTable = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
||||||
|
$decompressed = [];
|
||||||
|
|
||||||
|
foreach($compressedTable as $prefix => $entries){
|
||||||
|
foreach($entries as $shortStringId => $states){
|
||||||
|
foreach($states as $state){
|
||||||
|
$decompressed[] = [
|
||||||
|
"name" => "$prefix:$shortStringId",
|
||||||
|
"data" => $state
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$bedrockKnownStates = self::randomizeTable($decompressed);
|
||||||
|
|
||||||
foreach(self::$bedrockKnownStates as $k => $obj){
|
foreach(self::$bedrockKnownStates as $k => $obj){
|
||||||
//this has to use the json offset to make sure the mapping is consistent with what we send over network, even though we aren't using all the entries
|
//this has to use the json offset to make sure the mapping is consistent with what we send over network, even though we aren't using all the entries
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user