From 6bc79149c3e7d11f2d1b1094ad418b477961d7f6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 22 Nov 2018 16:46:42 +0000 Subject: [PATCH] SubChunk: Fixed $changed not getting set in setBlock() when only block data changed it was comparing a string and an int. This now compares the integer values first. --- src/pocketmine/level/format/SubChunk.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/level/format/SubChunk.php b/src/pocketmine/level/format/SubChunk.php index 650a566c5..dec363737 100644 --- a/src/pocketmine/level/format/SubChunk.php +++ b/src/pocketmine/level/format/SubChunk.php @@ -106,13 +106,14 @@ class SubChunk implements SubChunkInterface{ if($data !== null){ $i >>= 1; - $byte = ord($this->data{$i}); + $oldPair = ord($this->data{$i}); if(($y & 1) === 0){ - $this->data{$i} = chr(($byte & 0xf0) | ($data & 0x0f)); + $newPair = ($oldPair & 0xf0) | ($data & 0x0f); }else{ - $this->data{$i} = chr((($data & 0x0f) << 4) | ($byte & 0x0f)); + $newPair = (($data & 0x0f) << 4) | ($oldPair & 0x0f); } - if($this->data{$i} !== $byte){ + if($newPair !== $oldPair){ + $this->data{$i} = chr($newPair); $changed = true; } }