func (this *packetServerClientSettingsCodec) Decode(reader io.Reader, util []byte) (decode packet.Packet, err error) { packetServerClientSettings := new(PacketServerClientSettings) packetServerClientSettings.Locale, err = packet.ReadString(reader, util) if err != nil { return } packetServerClientSettings.ViewDistance, err = packet.ReadUint8(reader, util) if err != nil { return } packetServerClientSettings.ChatFlags, err = packet.ReadUint8(reader, util) if err != nil { return } packetServerClientSettings.ChatColours, err = packet.ReadBool(reader, util) if err != nil { return } packetServerClientSettings.ShowCape, err = packet.ReadBool(reader, util) if err != nil { return } decode = packetServerClientSettings return }
func (this *PacketServerClientSettingsCodec) Decode(reader io.Reader, util []byte) (decode packet.Packet, err error) { packetServerClientSettings := &PacketServerClientSettings{} packetServerClientSettings.Locale, err = packet.ReadString(reader, util) if err != nil { return } packetServerClientSettings.ViewDistance, err = packet.ReadUint8(reader, util) if err != nil { return } packetServerClientSettings.ChatFlags, err = packet.ReadUint8(reader, util) if err != nil { return } packetServerClientSettings.Unused, err = packet.ReadBool(reader, util) if err != nil { return } packetServerClientSettings.Difficulty, err = packet.ReadUint8(reader, util) if err != nil { return } packetServerClientSettings.ShowCape, err = packet.ReadBool(reader, util) if err != nil { return } return packetServerClientSettings, nil }
func (this *packetClientJoinGameCodec) Decode(reader io.Reader, util []byte) (decode packet.Packet, err error) { packetClientJoinGame := new(PacketClientJoinGame) packetClientJoinGame.EntityId, err = packet.ReadInt32(reader, util) if err != nil { return } packetClientJoinGame.Gamemode, err = packet.ReadInt8(reader, util) if err != nil { return } packetClientJoinGame.Dimension, err = packet.ReadInt8(reader, util) if err != nil { return } packetClientJoinGame.Difficulty, err = packet.ReadInt8(reader, util) if err != nil { return } packetClientJoinGame.MaxPlayers, err = packet.ReadInt8(reader, util) if err != nil { return } packetClientJoinGame.LevelType, err = packet.ReadString(reader, util) if err != nil { return } packetClientJoinGame.ReducedDebugInfo, err = packet.ReadBool(reader, util) if err != nil { return } decode = packetClientJoinGame return }
func (this *packetServerEventCodec) Decode(reader io.Reader) (decode packet.Packet, err error) { packetServerEvent := new(PacketServerEvent) packetServerEvent.Add, err = packet.ReadBool(reader) if err != nil { return } packetServerEvent.Server, err = packet.ReadString(reader) if err != nil { return } if packetServerEvent.Add { packetServerEvent.SecurityKey, err = packet.ReadString(reader) if err != nil { return } packetServerEvent.Address, err = packet.ReadString(reader) if err != nil { return } packetServerEvent.Port, err = packet.ReadUint16(reader) if err != nil { return } } decode = packetServerEvent return }
func (this *resultGetPlayersCodec) Decode(reader io.Reader) (result Result, err error) { resultGetPlayers := new(ResultGetPlayers) resultGetPlayers.List, err = packet.ReadBool(reader) if err != nil { return } resultGetPlayers.CurrentPlayers, err = packet.ReadUint16(reader) if err != nil { return } resultGetPlayers.MaxPlayers, err = packet.ReadUint16(reader) if err != nil { return } if resultGetPlayers.List { resultGetPlayers.Players = make([]string, resultGetPlayers.CurrentPlayers) var i uint16 for i = 0; i < resultGetPlayers.CurrentPlayers; i++ { if err != nil { return } resultGetPlayers.Players[i], err = packet.ReadString(reader) } } result = resultGetPlayers return }
func (this *ResultGetPlayersCodec) Decode(reader io.Reader, util []byte) (result Result, err error) { resultGetPlayers := &ResultGetPlayers{} resultGetPlayers.List, err = packet.ReadBool(reader, util) if err != nil { return } resultGetPlayers.CurrentPlayers, err = packet.ReadUint16(reader, util) if err != nil { return } resultGetPlayers.MaximumPlayers, err = packet.ReadUint16(reader, util) if err != nil { return } if resultGetPlayers.List { resultGetPlayers.Players = make([]string, resultGetPlayers.CurrentPlayers) var i uint16 for i = 0; i < resultGetPlayers.CurrentPlayers; i++ { if err != nil { return } resultGetPlayers.Players[i], err = packet.ReadString(reader, util) } } return resultGetPlayers, nil }
func (this *PacketServerEventCodec) Decode(reader io.Reader, util []byte) (decode packet.Packet, err error) { packetServerEvent := &PacketServerEvent{} packetServerEvent.Add, err = packet.ReadBool(reader, util) if err != nil { return } packetServerEvent.Server, err = packet.ReadString(reader, util) if err != nil { return } if packetServerEvent.Add { packetServerEvent.SecurityKey, err = packet.ReadString(reader, util) if err != nil { return } packetServerEvent.Address, err = packet.ReadString(reader, util) if err != nil { return } packetServerEvent.Port, err = packet.ReadUint16(reader, util) if err != nil { return } } return packetServerEvent, nil }
func (this *packetServerClientSettingsCodec17) Decode(reader io.Reader) (decode packet.Packet, err error) { packetServerClientSettings := new(PacketServerClientSettings) packetServerClientSettings.Locale, err = packet.ReadString(reader) if err != nil { return } packetServerClientSettings.ViewDistance, err = packet.ReadUint8(reader) if err != nil { return } packetServerClientSettings.ChatFlags, err = packet.ReadUint8(reader) if err != nil { return } packetServerClientSettings.ChatColours, err = packet.ReadBool(reader) if err != nil { return } packetServerClientSettings.difficulty17, err = packet.ReadUint8(reader) if err != nil { return } packetServerClientSettings.SkinParts, err = packet.ReadUint8(reader) if err != nil { return } decode = packetServerClientSettings return }
func (this *RequestGetPlayersCodec) Decode(reader io.Reader, util []byte) (request Request, err error) { requestGetPlayers := &RequestGetPlayers{} requestGetPlayers.List, err = packet.ReadBool(reader, util) if err != nil { return } return requestGetPlayers, nil }
func (this *requestGetPlayersCodec) Decode(reader io.Reader) (request Request, err error) { requestGetPlayers := new(RequestGetPlayers) requestGetPlayers.List, err = packet.ReadBool(reader) if err != nil { return } request = requestGetPlayers return }
func (this *RequestNotifyPlayerCodec) Decode(reader io.Reader, util []byte) (request Request, err error) { requestNotifyPlayer := &RequestNotifyPlayer{} requestNotifyPlayer.Add, err = packet.ReadBool(reader, util) if err != nil { return } requestNotifyPlayer.Player, err = packet.ReadString(reader, util) if err != nil { return } return requestNotifyPlayer, nil }
func (this *PacketClientPlayerListItemCodec) Decode(reader io.Reader, util []byte) (decode packet.Packet, err error) { packetClientPlayerListItem := &PacketClientPlayerListItem{} packetClientPlayerListItem.Name, err = packet.ReadString(reader, util) if err != nil { return } packetClientPlayerListItem.Online, err = packet.ReadBool(reader, util) if err != nil { return } packetClientPlayerListItem.Ping, err = packet.ReadInt16(reader, util) if err != nil { return } return packetClientPlayerListItem, nil }
func (this *packetClientPlayerListCodec17) Decode(reader io.Reader) (decode packet.Packet, err error) { packetClientPlayerList := new(PacketClientPlayerList17) packetClientPlayerList.Name, err = packet.ReadString(reader) if err != nil { return } packetClientPlayerList.Online, err = packet.ReadBool(reader) if err != nil { return } packetClientPlayerList.Ping, err = packet.ReadInt16(reader) if err != nil { return } decode = packetClientPlayerList return }
func (this *requestNotifyPlayerCodec) Decode(reader io.Reader) (request Request, err error) { requestNotifyPlayer := new(RequestNotifyPlayer) requestNotifyPlayer.Add, err = packet.ReadBool(reader) if err != nil { return } requestNotifyPlayer.Player, err = packet.ReadString(reader) if err != nil { return } requestNotifyPlayer.Uuid, err = packet.ReadUUID(reader) if err != nil { return } request = requestNotifyPlayer return }
func (this *packetClientPlayerListCodec) Decode(reader io.Reader) (decode packet.Packet, err error) { packetClientPlayerList := new(PacketClientPlayerList) packetClientPlayerList.Action, err = packet.ReadVarInt(reader) if err != nil { return } itemLength, err := packet.ReadVarInt(reader) if err != nil { return } if itemLength < 0 { err = errors.New(fmt.Sprintf("Decode, Item length is below zero: %d", itemLength)) return } if itemLength > 65535 { err = errors.New(fmt.Sprintf("Decode, Item length is above maximum: %d", itemLength)) return } packetClientPlayerList.Items = make([]PacketClientPlayerListItem, itemLength) for i, _ := range packetClientPlayerList.Items { item := &packetClientPlayerList.Items[i] item.UUID, err = packet.ReadUUID(reader) if err != nil { return } switch packetClientPlayerList.Action { case PACKET_CLIENT_PLAYER_LIST_ACTION_ADD: addPlayer := PacketClientPlayerListAddPlayer{} addPlayer.Name, err = packet.ReadString(reader) if err != nil { return } var propertiesLength int propertiesLength, err = packet.ReadVarInt(reader) if err != nil { return } if propertiesLength < 0 { err = errors.New(fmt.Sprintf("Decode, Properties length is below zero: %d", propertiesLength)) return } if propertiesLength > 65535 { err = errors.New(fmt.Sprintf("Decode, Properties length is above maximum: %d", propertiesLength)) return } addPlayer.Properties = make([]PacketClientPlayerListAddPlayerProperty, propertiesLength) for j, _ := range addPlayer.Properties { property := &addPlayer.Properties[j] property.Name, err = packet.ReadString(reader) if err != nil { return } property.Value, err = packet.ReadString(reader) if err != nil { return } var signed bool signed, err = packet.ReadBool(reader) if err != nil { return } if signed { property.Signature, err = packet.ReadString(reader) if err != nil { return } } } addPlayer.Gamemode, err = packet.ReadVarInt(reader) if err != nil { return } addPlayer.Latency, err = packet.ReadVarInt(reader) if err != nil { return } var hasDisplayName bool hasDisplayName, err = packet.ReadBool(reader) if err != nil { return } if hasDisplayName { addPlayer.DisplayName, err = packet.ReadString(reader) if err != nil { return } } item.Info = addPlayer case PACKET_CLIENT_PLAYER_LIST_ACTION_UPDATE_GAMEMODE: updateGamemode := PacketClientPlayerListUpdateGamemode{} updateGamemode.Gamemode, err = packet.ReadVarInt(reader) if err != nil { return } item.Info = updateGamemode case PACKET_CLIENT_PLAYER_LIST_ACTION_UPDATE_LATENCY: updateLatency := PacketClientPlayerListUpdateLatency{} updateLatency.Latency, err = packet.ReadVarInt(reader) if err != nil { return } item.Info = updateLatency case PACKET_CLIENT_PLAYER_LIST_ACTION_UPDATE_DISPLAY_NAME: updateDisplayName := PacketClientPlayerListUpdateDisplayName{} var hasDisplayName bool hasDisplayName, err = packet.ReadBool(reader) if err != nil { return } if hasDisplayName { updateDisplayName.DisplayName, err = packet.ReadString(reader) if err != nil { return } } item.Info = updateDisplayName case PACKET_CLIENT_PLAYER_LIST_ACTION_REMOVE: // no payload default: err = errors.New(fmt.Sprintf("Decode, PacketClientPlayerList action is not valid: %d", packetClientPlayerList.Action)) } } decode = packetClientPlayerList return }