From b9542b49084cc57b7f5a63bf9717430d07abc5d3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 25 Jun 2022 15:52:43 +0100 Subject: [PATCH] ItemFactory: fix isRegistered() again we really need to get rid of the ItemFactory legacy nasties so we can burn this code --- src/block/utils/WallConnectionType.php | 48 ++++++++++++++++++++++++++ src/item/ItemFactory.php | 11 +++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/block/utils/WallConnectionType.php diff --git a/src/block/utils/WallConnectionType.php b/src/block/utils/WallConnectionType.php new file mode 100644 index 000000000..60f2d01af --- /dev/null +++ b/src/block/utils/WallConnectionType.php @@ -0,0 +1,48 @@ +upgradeIntIdMeta(self::itemToBlockId($id), $variant & 0xf) !== null; + $blockStateData = GlobalBlockStateHandlers::getUpgrader()->upgradeIntIdMeta(self::itemToBlockId($id), $variant & 0xf); + if($blockStateData === null){ + return false; + } + try{ + GlobalBlockStateHandlers::getDeserializer()->deserialize($blockStateData); + return true; + }catch(BlockStateDeserializeException){ + return false; + } } return isset($this->list[self::getListOffset($id, $variant)]);