record; } public function setRecord(?Record $record) : void{ $this->record = $record; } public function readSaveData(CompoundTag $nbt) : void{ if(($tag = $nbt->getCompoundTag(self::TAG_RECORD)) !== null){ $record = Item::nbtDeserialize($tag); if($record instanceof Record){ $this->record = $record; } } } protected function writeSaveData(CompoundTag $nbt) : void{ if($this->record !== null){ $nbt->setTag(self::TAG_RECORD, $this->record->nbtSerialize()); } } protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ //this is needed for the note particles to show on the client side if($this->record !== null){ $nbt->setTag(self::TAG_RECORD, $this->record->nbtSerialize()); } } protected function onBlockDestroyedHook() : void{ $this->position->getWorld()->addSound($this->position, new RecordStopSound()); } }