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

Method Encode

protocol/net/packet/play/chunkData.go:36–101  ·  view source on GitHub ↗
(w encoding.Writer)

Source from the content-addressed store, hash-verified

34}
35
36func (c *ChunkDataUpdateLight) Encode(w encoding.Writer) error {
37 if err := w.Int(c.CX); err != nil {
38 return err
39 }
40 if err := w.Int(c.CZ); err != nil {
41 return err
42 }
43 if err := w.NBT(c.Heightmaps); err != nil {
44 return err
45 }
46 if err := w.VarInt(int32(c.Data.Len())); err != nil {
47 return err
48 }
49 if _, err := c.Data.WriteTo(w); err != nil {
50 return err
51 }
52 if err := w.VarInt(int32(len(c.BlockEntities))); err != nil {
53 return err
54 }
55 for _, blockEntity := range c.BlockEntities {
56 if err := w.Ubyte(((byte(blockEntity.X) & 0x0f) << 4) | (byte(blockEntity.Z) & 0x0f)); err != nil {
57 return err
58 }
59 if err := w.Short(int16(blockEntity.Y)); err != nil {
60 return err
61 }
62 if err := w.VarInt(blockEntity.Type); err != nil {
63 return err
64 }
65 if err := w.NBT(blockEntity.Data); err != nil {
66 return err
67 }
68 }
69
70 if err := w.BitSet(c.SkyLightMask); err != nil {
71 return err
72 }
73 if err := w.BitSet(c.BlockLightMask); err != nil {
74 return err
75 }
76 if err := w.BitSet(c.EmptySkyLightMask); err != nil {
77 return err
78 }
79 if err := w.BitSet(c.EmptyBlockLightMask); err != nil {
80 return err
81 }
82
83 if err := w.VarInt(int32(len(c.SkyLightArrays))); err != nil {
84 return err
85 }
86 for _, array := range c.SkyLightArrays {
87 if err := w.ByteArray(array); err != nil {
88 return err
89 }
90 }
91
92 if err := w.VarInt(int32(len(c.BlockLightArrays))); err != nil {
93 return err

Callers

nothing calls this directly

Calls 8

LenMethod · 0.80
IntMethod · 0.45
NBTMethod · 0.45
VarIntMethod · 0.45
UbyteMethod · 0.45
ShortMethod · 0.45
BitSetMethod · 0.45
ByteArrayMethod · 0.45

Tested by

no test coverage detected