From 49622cc2a59e1cde6da0e187abbad78218b1756c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 30 Mar 2018 11:07:29 +0100 Subject: [PATCH] NetworkBinaryStream: simplify read of canPlaceOn and canDestroy lists --- .../network/mcpe/NetworkBinaryStream.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index f126fe787..9b1236898 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -84,19 +84,13 @@ class NetworkBinaryStream extends BinaryStream{ } //TODO - $canPlaceOn = $this->getVarInt(); - if($canPlaceOn > 0){ - for($i = 0; $i < $canPlaceOn; ++$i){ - $this->getString(); - } + for($i = 0, $canPlaceOn = $this->getVarInt(); $i < $canPlaceOn; ++$i){ + $this->getString(); } //TODO - $canDestroy = $this->getVarInt(); - if($canDestroy > 0){ - for($i = 0; $i < $canDestroy; ++$i){ - $this->getString(); - } + for($i = 0, $canDestroy = $this->getVarInt(); $i < $canDestroy; ++$i){ + $this->getString(); } return ItemFactory::get($id, $data, $cnt, $nbt);