mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 19:24:12 +00:00
as seen in pmmp/BedrockBlockUpgradeSchema@ebd768e5b2, this enables use of newFlattenedName in more places (by allowing the flattened values to be transformed before building the new ID), as well as reducing the number of remappedStates in general by compacting stuff which was partially transformed like color silver -> light_gray.
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
*
|
|
* ____ _ _ __ __ _ __ __ ____
|
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* @author PocketMine Team
|
|
* @link http://www.pocketmine.net/
|
|
*
|
|
*
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace pocketmine\data\bedrock\block\upgrade;
|
|
|
|
use function ksort;
|
|
use const SORT_STRING;
|
|
|
|
final class BlockStateUpgradeSchemaFlattenedName{
|
|
|
|
/**
|
|
* @param string[] $flattenedValueRemaps
|
|
* @phpstan-param array<string, string> $flattenedValueRemaps
|
|
*/
|
|
public function __construct(
|
|
public string $prefix,
|
|
public string $flattenedProperty,
|
|
public string $suffix,
|
|
public array $flattenedValueRemaps
|
|
){
|
|
ksort($this->flattenedValueRemaps, SORT_STRING);
|
|
}
|
|
|
|
public function equals(self $that) : bool{
|
|
return $this->prefix === $that->prefix &&
|
|
$this->flattenedProperty === $that->flattenedProperty &&
|
|
$this->suffix === $that->suffix &&
|
|
$this->flattenedValueRemaps === $that->flattenedValueRemaps;
|
|
}
|
|
}
|