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

@ -52,7 +52,11 @@ class FlowerPot extends Spawnable{
$blockDataUpgrader = GlobalBlockStateHandlers::getUpgrader();
if(($itemIdTag = $nbt->getTag(self::TAG_ITEM)) instanceof ShortTag && ($itemMetaTag = $nbt->getTag(self::TAG_ITEM_DATA)) instanceof IntTag){
$blockStateData = $blockDataUpgrader->upgradeIntIdMeta($itemIdTag->getValue(), $itemMetaTag->getValue());
try{
$blockStateData = $blockDataUpgrader->upgradeIntIdMeta($itemIdTag->getValue(), $itemMetaTag->getValue());
}catch(BlockStateDeserializeException $e){
throw new SavedDataLoadingException("Error loading legacy flower pot item data: " . $e->getMessage(), 0, $e);
}
}elseif(($plantBlockTag = $nbt->getCompoundTag(self::TAG_PLANT_BLOCK)) !== null){
try{
$blockStateData = $blockDataUpgrader->upgradeBlockStateNbt($plantBlockTag);