35 public const TAG_DIRECTION =
"Direction";
36 public const TAG_RINGING =
"Ringing";
37 public const TAG_TICKS =
"Ticks";
39 private bool $ringing =
false;
40 private Facing $facing = Facing::NORTH;
41 private int $ticks = 0;
43 public function isRinging() :
bool{
return $this->ringing; }
45 public function setRinging(
bool $ringing) :
void{ $this->ringing = $ringing; }
47 public function getFacing() :
Facing{
return $this->facing; }
49 public function setFacing(
Facing $facing) :
void{ $this->facing = $facing; }
51 public function getTicks() :
int{
return $this->ticks; }
53 public function setTicks(
int $ticks) :
void{ $this->ticks = $ticks; }
56 $nbt->setByte(self::TAG_RINGING, $this->ringing ? 1 : 0);
58 $nbt->
setInt(self::TAG_DIRECTION, $this->facing->value);
59 $nbt->
setInt(self::TAG_TICKS, $this->ticks);
62 public function readSaveData(
CompoundTag $nbt) : void{
63 $this->ringing = $nbt->getByte(self::TAG_RINGING, 0) !== 0;
65 $this->facing = Facing::tryFrom($nbt->getInt(self::TAG_DIRECTION, Facing::NORTH->value)) ??
throw new SavedDataLoadingException(
"Invalid facing value");
66 $this->ticks = $nbt->getInt(self::TAG_TICKS, 0);
70 $nbt->setByte(self::TAG_RINGING, $this->ringing ? 1 : 0);
72 $nbt->
setInt(self::TAG_DIRECTION, $this->facing->value);
73 $nbt->
setInt(self::TAG_TICKS, $this->ticks);
85 $nbt = $this->getSpawnCompound();
86 $nbt->
setByte(self::TAG_RINGING, 1);
87 $nbt->
setInt(self::TAG_DIRECTION, match($bellHitFace){
94 $nbt->
setInt(self::TAG_TICKS, 0);
95 return BlockActorDataPacket::create(BlockPosition::fromVector3($this->position),
new CacheableNbt($nbt));