BedrockWorldData: do not load worlds with a newer NetworkVersion than we support

often, protocol updates are done without consideration for the current world format version. We don't want to require the world support to be updated at the same time, since this might delay updates.
This commit is contained in:
Dylan K. Taylor 2023-05-01 17:53:08 +01:00
parent 096daef0d0
commit d80f65ae7c
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -156,6 +156,12 @@ class BedrockWorldData extends BaseNbtWorldData{
if($version > self::CURRENT_STORAGE_VERSION){
throw new UnsupportedWorldFormatException("LevelDB world format version $version is currently unsupported");
}
//StorageVersion is rarely updated - instead, the game relies on the NetworkVersion tag, which is synced with
//the network protocol version for that version.
$protocolVersion = $worldData->getInt(self::TAG_NETWORK_VERSION, Limits::INT32_MAX);
if($protocolVersion > self::CURRENT_STORAGE_NETWORK_VERSION){
throw new UnsupportedWorldFormatException("LevelDB world protocol version $protocolVersion is currently unsupported");
}
return $worldData;
}