Support for flattening TAG_Byte and TAG_Int properties

this allows optimisation in upcoming versions.
This commit is contained in:
Dylan K. Taylor
2024-08-05 22:38:02 +01:00
parent bdb5845cec
commit be2437ac6e
5 changed files with 94 additions and 24 deletions

View File

@ -31,6 +31,7 @@ final class BlockStateUpgradeSchemaModelFlattenedName implements \JsonSerializab
public string $prefix;
/** @required */
public string $flattenedProperty;
public ?string $flattenedPropertyType = null;
/** @required */
public string $suffix;
/**
@ -43,11 +44,12 @@ final class BlockStateUpgradeSchemaModelFlattenedName implements \JsonSerializab
* @param string[] $flattenedValueRemaps
* @phpstan-param array<string, string> $flattenedValueRemaps
*/
public function __construct(string $prefix, string $flattenedProperty, string $suffix, array $flattenedValueRemaps){
public function __construct(string $prefix, string $flattenedProperty, string $suffix, array $flattenedValueRemaps, ?string $flattenedPropertyType = null){
$this->prefix = $prefix;
$this->flattenedProperty = $flattenedProperty;
$this->suffix = $suffix;
$this->flattenedValueRemaps = $flattenedValueRemaps;
$this->flattenedPropertyType = $flattenedPropertyType;
}
/**
@ -58,6 +60,9 @@ final class BlockStateUpgradeSchemaModelFlattenedName implements \JsonSerializab
if(count($this->flattenedValueRemaps) === 0){
unset($result["flattenedValueRemaps"]);
}
if($this->flattenedPropertyType === null){
unset($result["flattenedPropertyType"]);
}
return $result;
}
}