mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +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\entity\Entity;
|
||||
use pocketmine\event\block\BlockFormEvent;
|
||||
use pocketmine\event\block\BlockSpreadEvent;
|
||||
@ -69,7 +70,7 @@ abstract class Liquid extends Transparent{
|
||||
}
|
||||
|
||||
public function readStateFromMeta(int $meta) : void{
|
||||
$this->decay = $meta & 0x07;
|
||||
$this->decay = BlockDataValidator::readBoundedInt("decay", $meta & 0x07, 0, 7);
|
||||
$this->falling = ($meta & 0x08) !== 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user