mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
BlockStateUpgradeSchemaUtils: ensure that remapped values are generated in a consistent order
this uses lexical order, which isn't ideal for numeric values (1, 10, 2, etc), but it's good enough to ensure that the order is stable.
This commit is contained in:
parent
a8dec1adb1
commit
869c836e2d
@ -35,6 +35,7 @@ use pocketmine\utils\Filesystem;
|
||||
use pocketmine\utils\Utils;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function array_map;
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function get_debug_type;
|
||||
use function gettype;
|
||||
@ -175,6 +176,7 @@ final class BlockStateUpgradeSchemaUtils{
|
||||
foreach($remappedValues as $oldNew){
|
||||
$remappedValuesMap[$oldNew->old->toString()] = $oldNew;
|
||||
}
|
||||
ksort($remappedValuesMap);
|
||||
|
||||
foreach(Utils::stringifyKeys($dedupTableMap) as $dedupName => $dedupValuesMap){
|
||||
if(count($remappedValuesMap) !== count($dedupValuesMap)){
|
||||
@ -199,7 +201,7 @@ final class BlockStateUpgradeSchemaUtils{
|
||||
//no match, add the values to the table
|
||||
$newDedupName = $propertyName . "_" . str_pad(strval($counter++), 2, "0", STR_PAD_LEFT);
|
||||
$dedupTableMap[$newDedupName] = $remappedValuesMap;
|
||||
$dedupTable[$newDedupName] = $remappedValues;
|
||||
$dedupTable[$newDedupName] = array_values($remappedValuesMap);
|
||||
$dedupMapping[$blockName][$propertyName] = $newDedupName;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user