RuntimeBlockStateRegistry: throw a hard error on blockstates that return different state data than they were given

this suggests improper validation of state data.
This commit is contained in:
Dylan K. Taylor 2023-02-16 15:44:58 +00:00
parent 4c3892b2d6
commit e6f1cb69d1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -100,7 +100,7 @@ class RuntimeBlockStateRegistry{
$v->decodeStateData($stateData);
if($v->computeStateData() !== $stateData){
//TODO: this should probably be a hard error
throw new InvalidSerializedRuntimeDataException(get_class($block) . "::decodeStateData() accepts invalid state data (returned " . $v->computeStateData() . " for input $stateData)");
throw new \LogicException(get_class($block) . "::decodeStateData() accepts invalid state data (returned " . $v->computeStateData() . " for input $stateData)");
}
}catch(InvalidSerializedRuntimeDataException){ //invalid property combination, leave it
continue;