From 8e5aca70b47fa77f8a7dd62942c9481606aa949c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 9 Jun 2018 17:06:15 +0100 Subject: [PATCH] Entity: Avoid using close() during initEntity() this simply conceals bugs and will cause astonishing behaviour. --- src/pocketmine/entity/object/FallingBlock.php | 3 +-- src/pocketmine/entity/object/ItemEntity.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/entity/object/FallingBlock.php b/src/pocketmine/entity/object/FallingBlock.php index 9a1a91841..e440fb6d0 100644 --- a/src/pocketmine/entity/object/FallingBlock.php +++ b/src/pocketmine/entity/object/FallingBlock.php @@ -64,8 +64,7 @@ class FallingBlock extends Entity{ } if($blockId === 0){ - $this->close(); - return; + throw new \UnexpectedValueException("Invalid " . get_class($this) . " entity: block ID is 0 or missing"); } $damage = $this->namedtag->getByte("Data", 0); diff --git a/src/pocketmine/entity/object/ItemEntity.php b/src/pocketmine/entity/object/ItemEntity.php index 00179186d..2e38a386a 100644 --- a/src/pocketmine/entity/object/ItemEntity.php +++ b/src/pocketmine/entity/object/ItemEntity.php @@ -66,8 +66,7 @@ class ItemEntity extends Entity{ $itemTag = $this->namedtag->getCompoundTag("Item"); if($itemTag === null){ - $this->close(); - return; + throw new \UnexpectedValueException("Invalid " . get_class($this) . " entity: expected \"Item\" NBT tag not found"); } $this->item = Item::nbtDeserialize($itemTag);