MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / Encode

Method Encode

protocol/net/packet/play/interact.go:28–53  ·  view source on GitHub ↗
(w encoding.Writer)

Source from the content-addressed store, hash-verified

26}
27
28func (i *Interact) Encode(w encoding.Writer) error {
29 if err := w.VarInt(i.EntityId); err != nil {
30 return err
31 }
32 if err := w.VarInt(i.Type); err != nil {
33 return err
34 }
35 if i.Type == InteractTypeInteractAt {
36 if err := w.Float(i.TargetX); err != nil {
37 return err
38 }
39 if err := w.Float(i.TargetY); err != nil {
40 return err
41 }
42 if err := w.Float(i.TargetZ); err != nil {
43 return err
44 }
45 }
46 if i.Type == InteractTypeInteractAt || i.Type == InteractTypeInteract {
47 if err := w.VarInt(i.Hand); err != nil {
48 return err
49 }
50 }
51
52 return w.Bool(i.Sneaking)
53}
54
55func (i *Interact) Decode(r encoding.Reader) error {
56 if _, err := r.VarInt(&i.EntityId); err != nil {

Callers

nothing calls this directly

Calls 3

VarIntMethod · 0.45
FloatMethod · 0.45
BoolMethod · 0.45

Tested by

no test coverage detected