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

Method Encode

protocol/net/packet/play/damageEvent.go:24–52  ·  view source on GitHub ↗
(w encoding.Writer)

Source from the content-addressed store, hash-verified

22}
23
24func (d *DamageEvent) Encode(w encoding.Writer) error {
25 if err := w.VarInt(d.EntityId); err != nil {
26 return err
27 }
28 if err := w.VarInt(d.SourceTypeId); err != nil {
29 return err
30 }
31 if err := w.VarInt(d.SourceDirectId + 1); err != nil {
32 return err
33 }
34 if err := w.VarInt(d.SourceCauseId + 1); err != nil {
35 return err
36 }
37 if err := w.Bool(d.HasSourcePosition); err != nil {
38 return err
39 }
40 if d.HasSourcePosition {
41 if err := w.Double(d.SourceX); err != nil {
42 return err
43 }
44 if err := w.Double(d.SourceY); err != nil {
45 return err
46 }
47 if err := w.Double(d.SourceZ); err != nil {
48 return err
49 }
50 }
51 return nil
52}
53
54func (d *DamageEvent) Decode(r encoding.Reader) error {
55 return nil //TODO

Callers

nothing calls this directly

Calls 3

VarIntMethod · 0.45
BoolMethod · 0.45
DoubleMethod · 0.45

Tested by

no test coverage detected