22declare(strict_types=1);
33 private const TAG_RECORD =
"RecordItem";
35 private ?
Record $record =
null;
37 public function getRecord() : ?
Record{
41 public function setRecord(?
Record $record) :
void{
42 $this->record = $record;
45 public function readSaveData(
CompoundTag $nbt) :
void{
48 if($record instanceof
Record){
49 $this->record = $record;
55 if($this->record !== null){
56 $nbt->
setTag(self::TAG_RECORD, $this->record->nbtSerialize());
62 if($this->record !== null){
63 $nbt->
setTag(self::TAG_RECORD, TypeConverter::getInstance()->getItemTranslator()->toNetworkNbt($this->record));
68 $this->position->getWorld()->addSound($this->position, new
RecordStopSound());
writeSaveData(CompoundTag $nbt)
addAdditionalSpawnData(CompoundTag $nbt)
static nbtDeserialize(CompoundTag $tag)
getCompoundTag(string $name)
setTag(string $name, Tag $tag)