From 75a38699e2be500bcb46156871110a84c47cf179 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 23 Jan 2017 13:11:39 +0000 Subject: [PATCH] Fix metadata block coords (signed Y coordinate), close #286 --- src/pocketmine/utils/Binary.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/utils/Binary.php b/src/pocketmine/utils/Binary.php index 95330abca..954497245 100644 --- a/src/pocketmine/utils/Binary.php +++ b/src/pocketmine/utils/Binary.php @@ -116,7 +116,9 @@ class Binary{ break; case Entity::DATA_TYPE_POS: //TODO: change this implementation (use objects) - $stream->putBlockCoords($d[1][0], $d[1][1], $d[1][2]); //x, y, z + $stream->putVarInt($d[1][0]); //x + $stream->putVarInt($d[1][1]); //y (SIGNED) + $stream->putVarInt($d[1][2]); //z break; case Entity::DATA_TYPE_LONG: $stream->putVarInt($d[1]); //TODO: varint64 support @@ -165,14 +167,17 @@ class Binary{ break; case Entity::DATA_TYPE_SLOT: //TODO: use objects directly + $value = []; $item = $stream->getSlot(); $value[0] = $item->getId(); $value[1] = $item->getCount(); $value[2] = $item->getDamage(); break; case Entity::DATA_TYPE_POS: - $value = [0, 0, 0]; - $stream->getBlockCoords($value[0], $value[1], $value[2]); + $value = []; + $value[0] = $stream->getVarInt(); //x + $value[1] = $stream->getVarInt(); //y (SIGNED) + $value[2] = $stream->getVarInt(); //z break; case Entity::DATA_TYPE_LONG: $value = $stream->getVarInt(); //TODO: varint64 proper support