mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 05:15:13 +00:00
BlockStateLookupCache: avoid allocating useless arrays for blocks with only 1 permutation
this saves about 120 KB of memory.
This commit is contained in:
parent
43fe819862
commit
d2c37d8bcf
@ -58,6 +58,7 @@ final class BlockStateLookupCache{
|
|||||||
foreach(Utils::stringifyKeys($this->nameToNetworkIdsLookup) as $name => $stateIds){
|
foreach(Utils::stringifyKeys($this->nameToNetworkIdsLookup) as $name => $stateIds){
|
||||||
if(count($stateIds) === 1){
|
if(count($stateIds) === 1){
|
||||||
$this->nameToSingleNetworkIdLookup[$name] = $stateIds[array_key_first($stateIds)];
|
$this->nameToSingleNetworkIdLookup[$name] = $stateIds[array_key_first($stateIds)];
|
||||||
|
unset($this->nameToNetworkIdsLookup[$name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user