Files
minego/pkg/protocol/packet/game/client/stop_sound.go
2025-08-27 20:28:44 +08:00

36 lines
656 B
Go

package client
import (
"io"
pk "git.konjactw.dev/falloutBot/go-mc/net/packet"
)
type StopSound struct {
Flags int8
Source int32 `mc:"VarInt"`
Sound string `mc:"Identifier"`
}
func (s StopSound) WriteTo(w io.Writer) (n int64, err error) {
pk.Byte(s.Flags).WriteTo(w)
if s.Flags&0x01 != 0 {
pk.VarInt(s.Source).WriteTo(w)
}
if s.Flags&0x02 != 0 {
pk.Identifier(s.Sound).WriteTo(w)
}
return
}
func (s *StopSound) ReadFrom(r io.Reader) (n int64, err error) {
(*pk.Byte)(&s.Flags).ReadFrom(r)
if s.Flags&0x01 != 0 {
(*pk.VarInt)(&s.Source).ReadFrom(r)
}
if s.Flags&0x02 != 0 {
(*pk.Identifier)(&s.Sound).ReadFrom(r)
}
return
}