From 220d2b7bee0e9987e4f2e3dce2496017a8a03730 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 15 Mar 2015 16:39:43 +0100 Subject: [PATCH] Fixed NBT IntArray off-by-one reading --- src/pocketmine/nbt/tag/IntArray.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/nbt/tag/IntArray.php b/src/pocketmine/nbt/tag/IntArray.php index 8eada159d..c1500fa23 100644 --- a/src/pocketmine/nbt/tag/IntArray.php +++ b/src/pocketmine/nbt/tag/IntArray.php @@ -34,7 +34,10 @@ class IntArray extends NamedTag{ public function read(NBT $nbt){ $this->value = []; $size = $nbt->getInt(); - $this->value = unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4)); + $value = unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4)); + foreach($value as $i => $v){ + $this->value[$i - 1] = $v; + } } public function write(NBT $nbt){