From f84040a7ad42c2e02cdfe9fb3a148b9e98e186c6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 8 Jun 2019 17:55:50 +0100 Subject: [PATCH] FlowerPot (tile): Allow BlockFactory to determine id/data validity --- src/pocketmine/block/tile/FlowerPot.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/block/tile/FlowerPot.php b/src/pocketmine/block/tile/FlowerPot.php index db9bb28eb..d6641a1f3 100644 --- a/src/pocketmine/block/tile/FlowerPot.php +++ b/src/pocketmine/block/tile/FlowerPot.php @@ -43,9 +43,10 @@ class FlowerPot extends Spawnable{ public function readSaveData(CompoundTag $nbt) : void{ if($nbt->hasTag(self::TAG_ITEM, ShortTag::class) and $nbt->hasTag(self::TAG_ITEM_DATA, IntTag::class)){ - //prevent stupidity with wrong items - if(($id = $nbt->getShort(self::TAG_ITEM)) >= 0 and $id <= 255 and ($data = $nbt->getInt(self::TAG_ITEM_DATA)) >= 0 and $data <= 15){ - $this->setPlant(BlockFactory::get($id, $data)); + try{ + $this->setPlant(BlockFactory::get($nbt->getShort(self::TAG_ITEM), $nbt->getInt(self::TAG_ITEM_DATA))); + }catch(\InvalidArgumentException $e){ + //noop } }else{ //TODO: new PlantBlock tag