BlockStateLookupCache: avoid allocating useless arrays for blocks with only 1 permutation

this saves about 120 KB of memory.
This commit is contained in:
Dylan K. Taylor 2023-05-04 15:16:18 +01:00
parent 43fe819862
commit d2c37d8bcf
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -58,6 +58,7 @@ final class BlockStateLookupCache{
foreach(Utils::stringifyKeys($this->nameToNetworkIdsLookup) as $name => $stateIds){
if(count($stateIds) === 1){
$this->nameToSingleNetworkIdLookup[$name] = $stateIds[array_key_first($stateIds)];
unset($this->nameToNetworkIdsLookup[$name]);
}
}
}