mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Tighten validity checks for block metadata
This filters out over 200 invalid states which were previously considered just fine, including zero-width cakes, buttons with broken facing values, furnace/chest with crazy values, and more.
This commit is contained in:
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\BlockDataValidator;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Bearing;
|
||||
use pocketmine\math\Facing;
|
||||
@ -49,7 +50,7 @@ class TripwireHook extends Flowable{
|
||||
}
|
||||
|
||||
public function readStateFromMeta(int $meta) : void{
|
||||
$this->facing = Bearing::toFacing($meta & 0x03);
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($meta & 0x03);
|
||||
$this->connected = ($meta & 0x04) !== 0;
|
||||
$this->powered = ($meta & 0x08) !== 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user