BlockTranslator: remove useless call to generateDataFromStateId()

BlockStateDictionary doesn't retain BlockStateData anymore, so this optimisation is just wasting CPU cycles.
This commit is contained in:
Dylan K. Taylor 2023-05-05 17:02:50 +01:00
parent f2c6a75145
commit 8a374df801
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -47,11 +47,9 @@ final class BlockTranslator{
private BlockStateDictionary $blockStateDictionary,
private BlockStateSerializer $blockStateSerializer
){
$this->fallbackStateId = $this->blockStateDictionary->lookupStateIdFromData(
BlockStateData::current(BlockTypeNames::INFO_UPDATE, [])
) ?? throw new AssumptionFailedError(BlockTypeNames::INFO_UPDATE . " should always exist");
//lookup the state data from the dictionary to avoid keeping two copies of the same data around
$this->fallbackStateData = $this->blockStateDictionary->generateDataFromStateId($this->fallbackStateId) ?? throw new AssumptionFailedError("We just looked up this state data, so it must exist");
$this->fallbackStateData = BlockStateData::current(BlockTypeNames::INFO_UPDATE, []);
$this->fallbackStateId = $this->blockStateDictionary->lookupStateIdFromData($this->fallbackStateData) ??
throw new AssumptionFailedError(BlockTypeNames::INFO_UPDATE . " should always exist");
}
public function internalIdToNetworkId(int $internalStateId) : int{