mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 19:06:35 +00:00
BlockFactory: split up static ID mapping registration from other things
this is actually HUGELY WASTEFUL on memory. An average of 3 MB is wasted per AsyncWorker on this.
This commit is contained in:
parent
515e4aabc4
commit
d535fe20a3
@ -1633,6 +1633,7 @@ class Server{
|
|||||||
Entity::init();
|
Entity::init();
|
||||||
Tile::init();
|
Tile::init();
|
||||||
BlockFactory::init();
|
BlockFactory::init();
|
||||||
|
BlockFactory::registerStaticRuntimeIdMappings();
|
||||||
Enchantment::init();
|
Enchantment::init();
|
||||||
ItemFactory::init();
|
ItemFactory::init();
|
||||||
Item::initCreativeItems();
|
Item::initCreativeItems();
|
||||||
|
@ -323,12 +323,6 @@ class BlockFactory{
|
|||||||
//TODO: STRUCTURE_BLOCK
|
//TODO: STRUCTURE_BLOCK
|
||||||
|
|
||||||
//TODO: RESERVED6
|
//TODO: RESERVED6
|
||||||
|
|
||||||
/** @var mixed[] $runtimeIdMap */
|
|
||||||
$runtimeIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
|
||||||
foreach($runtimeIdMap as $obj){
|
|
||||||
self::registerMapping($obj["runtimeID"], $obj["id"], $obj["data"]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -419,6 +413,14 @@ class BlockFactory{
|
|||||||
return $b !== null and !($b instanceof UnknownBlock);
|
return $b !== null and !($b instanceof UnknownBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function registerStaticRuntimeIdMappings() : void{
|
||||||
|
/** @var mixed[] $runtimeIdMap */
|
||||||
|
$runtimeIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
||||||
|
foreach($runtimeIdMap as $obj){
|
||||||
|
self::registerMapping($obj["runtimeID"], $obj["id"], $obj["data"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user