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.
This commit is contained in:
Dylan K. Taylor 2018-10-12 19:49:26 +01:00
parent 873b64259d
commit 0520598584

View File

@ -477,7 +477,7 @@ class BlockFactory{
$v = clone $block; $v = clone $block;
$v->readStateFromMeta($m & $stateMask); $v->readStateFromMeta($m & $stateMask);
if($v->getDamage() === $m){ //don't register anything that isn't the same when we read it back again
self::$fullList[$index] = $v; self::$fullList[$index] = $v;
self::$stateMasks[$index] = $stateMask; self::$stateMasks[$index] = $stateMask;
self::$lightFilter[$index] = min(15, $v->getLightFilter() + 1); //opacity plus 1 standard light filter self::$lightFilter[$index] = min(15, $v->getLightFilter() + 1); //opacity plus 1 standard light filter
@ -485,6 +485,7 @@ class BlockFactory{
self::$blastResistance[$index] = $v->getBlastResistance(); self::$blastResistance[$index] = $v->getBlastResistance();
} }
} }
}
/** /**
* Returns a new Block instance with the specified ID, meta and position. * Returns a new Block instance with the specified ID, meta and position.