func (t *JoinGame) Decode(rr io.Reader) (err error) { if err = binary.Read(rr, binary.BigEndian, t.EntityID); err != nil { return err } if err = binary.Read(rr, binary.BigEndian, t.Gamemode); err != nil { return err } if err = binary.Read(rr, binary.BigEndian, t.Dimension); err != nil { return err } if err = binary.Read(rr, binary.BigEndian, t.Difficulty); err != nil { return err } if err = binary.Read(rr, binary.BigEndian, t.MaxPlayers); err != nil { return err } if t.LevelType, err = packets.ReadString(rr); err != nil { return err } if t.ReducedDebug, err = packets.ReadBool(rr); err != nil { return err } return }
func (t *ClientTabComplete) Decode(rr io.Reader) (err error) { if t.Text, err = packets.ReadString(rr); err != nil { return err } if t.HasPosition, err = packets.ReadBool(rr); err != nil { return err } if t.HasPosition { if err = binary.Read(rr, binary.BigEndian, t.LookedAtBlock); err != nil { return err } } return }
func (t *PlayerListItem) Decode(rr io.Reader) (err error) { tmp0, err := packets.ReadVarint(rr) if err != nil { return err } t.Action = packets.VarInt(tmp0) tmp1, err := packets.ReadVarint(rr) if err != nil { return err } t.NumPlayers = packets.VarInt(tmp1) var tmp2 packets.VarInt tmp3, err := packets.ReadVarint(rr) if err != nil { return err } tmp2 = packets.VarInt(tmp3) if tmp2 < 0 { return fmt.Errorf("negative array size: %d < 0", tmp2) } t.Players = make([]Player, tmp2) for tmp4 := range t.Players { if err = binary.Read(rr, binary.BigEndian, t.Players[tmp4].UUID); err != nil { return err } if t.Players[tmp4].Name, err = packets.ReadString(rr); err != nil { return err } var tmp5 packets.VarInt tmp6, err := packets.ReadVarint(rr) if err != nil { return err } tmp5 = packets.VarInt(tmp6) if tmp5 < 0 { return fmt.Errorf("negative array size: %d < 0", tmp5) } t.Players[tmp4].Properties = make([]Property, tmp5) for tmp7 := range t.Players[tmp4].Properties { if t.Players[tmp4].Properties[tmp7].Name, err = packets.ReadString(rr); err != nil { return err } if t.Players[tmp4].Properties[tmp7].Value, err = packets.ReadString(rr); err != nil { return err } if t.Players[tmp4].Properties[tmp7].Signed, err = packets.ReadBool(rr); err != nil { return err } if t.Players[tmp4].Properties[tmp7].Signed { if t.Players[tmp4].Properties[tmp7].Signature, err = packets.ReadString(rr); err != nil { return err } } } tmp8, err := packets.ReadVarint(rr) if err != nil { return err } t.Players[tmp4].Gamemode = packets.VarInt(tmp8) tmp9, err := packets.ReadVarint(rr) if err != nil { return err } t.Players[tmp4].Ping = packets.VarInt(tmp9) if t.Players[tmp4].HasDisplayName, err = packets.ReadBool(rr); err != nil { return err } if t.Players[tmp4].HasDisplayName { var tmp10 string if tmp10, err = packets.ReadString(rr); err != nil { return err } if err = json.Unmarshal([]byte(tmp10), &t.Players[tmp4].DisplayName); err != nil { return err } } } return }