diff --git a/src/network/mcpe/convert/BlockStateDictionaryEntry.php b/src/network/mcpe/convert/BlockStateDictionaryEntry.php index 994695df2..57cc29c0c 100644 --- a/src/network/mcpe/convert/BlockStateDictionaryEntry.php +++ b/src/network/mcpe/convert/BlockStateDictionaryEntry.php @@ -33,6 +33,11 @@ use function ksort; use const SORT_STRING; final class BlockStateDictionaryEntry{ + /** + * @var string[] + * @phpstan-var array + */ + private static array $uniqueRawStates = []; private string $rawStateProperties; @@ -44,7 +49,8 @@ final class BlockStateDictionaryEntry{ array $stateProperties, private int $meta ){ - $this->rawStateProperties = self::encodeStateProperties($stateProperties); + $rawStateProperties = self::encodeStateProperties($stateProperties); + $this->rawStateProperties = self::$uniqueRawStates[$rawStateProperties] ??= $rawStateProperties; } public function getStateName() : string{ return $this->stateName; }