From 05205985840b7cefe0f5a5314c5226e1e2fd03b3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 12 Oct 2018 19:49:26 +0100 Subject: [PATCH] BlockFactory: skip blockstates which corrupt the metadata if the metadata doesn't match what was inputted when reading back, it's an invalid state and should not be registered. --- src/pocketmine/block/BlockFactory.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index 28aa85cf0..b14259a82 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -477,12 +477,13 @@ class BlockFactory{ $v = clone $block; $v->readStateFromMeta($m & $stateMask); - - self::$fullList[$index] = $v; - self::$stateMasks[$index] = $stateMask; - self::$lightFilter[$index] = min(15, $v->getLightFilter() + 1); //opacity plus 1 standard light filter - self::$diffusesSkyLight[$index] = $v->diffusesSkyLight(); - self::$blastResistance[$index] = $v->getBlastResistance(); + if($v->getDamage() === $m){ //don't register anything that isn't the same when we read it back again + self::$fullList[$index] = $v; + self::$stateMasks[$index] = $stateMask; + self::$lightFilter[$index] = min(15, $v->getLightFilter() + 1); //opacity plus 1 standard light filter + self::$diffusesSkyLight[$index] = $v->diffusesSkyLight(); + self::$blastResistance[$index] = $v->getBlastResistance(); + } } }