note < 0 || $this->note > 255){ throw new \InvalidArgumentException("Note $note is outside accepted range"); } } public function encode(Vector3 $pos) : array{ $instrumentId = NoteInstrumentIdMap::getInstance()->toId($this->instrument); return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::NOTE, $pos, false, ($instrumentId << 8) | $this->note)]; } }