Fixed usages of BlockDataUpgrader which weren't accounting for thrown exceptions

This commit is contained in:
Dylan K. Taylor
2023-05-02 17:13:31 +01:00
parent 4d0cecbac2
commit 6beb80b8fe
5 changed files with 39 additions and 17 deletions

View File

@ -67,9 +67,10 @@ abstract class BaseWorldProvider implements WorldProvider{
$newPalette = [];
foreach($palette as $k => $legacyIdMeta){
$newStateData = $this->blockDataUpgrader->upgradeIntIdMeta($legacyIdMeta >> 4, $legacyIdMeta & 0xf);
if($newStateData === null){
//TODO: remember data for unknown states so we can implement them later
//TODO: remember data for unknown states so we can implement them later
try{
$newStateData = $this->blockDataUpgrader->upgradeIntIdMeta($legacyIdMeta >> 4, $legacyIdMeta & 0xf);
}catch(BlockStateDeserializeException $e){
$newStateData = GlobalBlockStateHandlers::getUnknownBlockStateData();
}