1.21.6 Clientbound PlayState Packets

This commit is contained in:
2025-06-20 04:22:08 +08:00
parent e40ed2e534
commit 195d34f32d
204 changed files with 10118 additions and 3287 deletions

View File

@ -0,0 +1,34 @@
package client
import (
pk "github.com/Tnze/go-mc/net/packet"
"io"
)
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
}