From bed68a012d91d868f20a3b2ec5f0f7a003165777 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 19 Aug 2017 21:29:24 +0100 Subject: [PATCH] Don't bother doing null checks for block copy This will never be null if the block factory was initialized correctly. This will also cause a crash if bugs like e88053faf452df60262aad3e40c83dfed7f5dfa3 occur again in the future instead of silently causing unexpected behaviour. --- src/pocketmine/block/Block.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index e10d7e61f..5cd2cfd03 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -377,12 +377,7 @@ class Block extends Position implements BlockIds, Metadatable{ */ public static function get(int $id, int $meta = 0, Position $pos = null) : Block{ try{ - $block = self::$fullList[($id << 4) | $meta]; - if($block !== null){ - $block = clone $block; - }else{ - $block = new UnknownBlock($id, $meta); - } + $block = clone self::$fullList[($id << 4) | $meta]; }catch(\RuntimeException $e){ //TODO: this probably should return null (out of bounds IDs may cause unexpected behaviour) $block = new UnknownBlock($id, $meta);