From 0aa0d77307dcc52b64c5c69b37aff2b62d124b70 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 27 Apr 2021 19:21:29 +0100 Subject: [PATCH] Skull: recognize noDrops flag --- src/block/BlockLegacyMetadata.php | 2 ++ src/block/Skull.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/block/BlockLegacyMetadata.php b/src/block/BlockLegacyMetadata.php index 57189ffbe..e226a0c65 100644 --- a/src/block/BlockLegacyMetadata.php +++ b/src/block/BlockLegacyMetadata.php @@ -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; diff --git a/src/block/Skull.php b/src/block/Skull.php index 8b60f5dea..80250ff58 100644 --- a/src/block/Skull.php +++ b/src/block/Skull.php @@ -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{