mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
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:
parent
f2c6a75145
commit
8a374df801
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user