ringing; } public function setRinging(bool $ringing) : void{ $this->ringing = $ringing; } public function getFacing() : int{ return $this->facing; } public function setFacing(int $facing) : void{ $this->facing = $facing; } public function getTicks() : int{ return $this->ticks; } public function setTicks(int $ticks) : void{ $this->ticks = $ticks; } protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_RINGING, $this->ringing ? 1 : 0); $nbt->setInt(self::TAG_DIRECTION, $this->facing); $nbt->setInt(self::TAG_TICKS, $this->ticks); } public function readSaveData(CompoundTag $nbt) : void{ $this->ringing = $nbt->getByte(self::TAG_RINGING, 0) !== 0; $this->facing = $nbt->getInt(self::TAG_DIRECTION, Facing::NORTH); $this->ticks = $nbt->getInt(self::TAG_TICKS, 0); } protected function writeSaveData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_RINGING, $this->ringing ? 1 : 0); $nbt->setInt(self::TAG_DIRECTION, $this->facing); $nbt->setInt(self::TAG_TICKS, $this->ticks); } /** * TODO: HACK! * Creates a BlockActorDataPacket that triggers the ringing animation on a bell block. * * Bedrock team overcomplicated making bells ring when they implemented this; this would have been better and much * simpler as a BlockEventPacket. It's simpler to implement bells with this hack than to follow Mojang's complicated * mess. */ public function createFakeUpdatePacket(int $bellHitFace) : BlockActorDataPacket{ $nbt = $this->getSpawnCompound(); $nbt->setByte(self::TAG_RINGING, 1); $nbt->setInt(self::TAG_DIRECTION, BlockDataSerializer::writeLegacyHorizontalFacing($bellHitFace)); $nbt->setInt(self::TAG_TICKS, 0); return BlockActorDataPacket::create(BlockPosition::fromVector3($this->position), new CacheableNbt($nbt)); } }