mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 21:35:21 +00:00
Skull: recognize noDrops flag
This commit is contained in:
parent
017ca55a58
commit
0aa0d77307
@ -201,6 +201,8 @@ final class BlockLegacyMetadata{
|
||||
|
||||
public const SEA_PICKLE_FLAG_NOT_UNDERWATER = 0x04;
|
||||
|
||||
public const SKULL_FLAG_NO_DROPS = 0x08;
|
||||
|
||||
public const SLAB_FLAG_UPPER = 0x08;
|
||||
|
||||
public const SPONGE_FLAG_WET = 0x01;
|
||||
|
@ -45,6 +45,8 @@ class Skull extends Flowable{
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
|
||||
protected bool $noDrops = false;
|
||||
|
||||
/** @var int */
|
||||
protected $rotation = 0; //TODO: split this into floor skull and wall skull handling
|
||||
|
||||
@ -54,15 +56,17 @@ class Skull extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->facing === Facing::UP ? 1 : BlockDataSerializer::writeHorizontalFacing($this->facing);
|
||||
return ($this->facing === Facing::UP ? 1 : BlockDataSerializer::writeHorizontalFacing($this->facing)) |
|
||||
($this->noDrops ? BlockLegacyMetadata::SKULL_FLAG_NO_DROPS : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = $stateMeta === 1 ? Facing::UP : BlockDataSerializer::readHorizontalFacing($stateMeta);
|
||||
$this->noDrops = ($stateMeta & BlockLegacyMetadata::SKULL_FLAG_NO_DROPS) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
return 0b111;
|
||||
return 0b1111;
|
||||
}
|
||||
|
||||
public function readStateFromWorld() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user