mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 00:29:54 +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 BlockStateDictionary $blockStateDictionary,
|
||||||
private BlockStateSerializer $blockStateSerializer
|
private BlockStateSerializer $blockStateSerializer
|
||||||
){
|
){
|
||||||
$this->fallbackStateId = $this->blockStateDictionary->lookupStateIdFromData(
|
$this->fallbackStateData = BlockStateData::current(BlockTypeNames::INFO_UPDATE, []);
|
||||||
BlockStateData::current(BlockTypeNames::INFO_UPDATE, [])
|
$this->fallbackStateId = $this->blockStateDictionary->lookupStateIdFromData($this->fallbackStateData) ??
|
||||||
) ?? throw new AssumptionFailedError(BlockTypeNames::INFO_UPDATE . " should always exist");
|
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function internalIdToNetworkId(int $internalStateId) : int{
|
public function internalIdToNetworkId(int $internalStateId) : int{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user