public override void Decode(MinecraftStream stream) { EntityId = stream.ReadInt(); IsHardcore = stream.ReadBool(); Gamemode = (byte)stream.ReadByte(); PreviousGamemode = (byte)stream.ReadByte(); int worldCount = stream.ReadVarInt(); WorldNames = new string[worldCount]; for (int i = 0; i < worldCount; i++) { WorldNames[i] = stream.ReadString(); } DimensionCodec = stream.ReadNbtCompound(); Dimension = stream.ReadNbtCompound(); //stream.ReadString(); WorldName = stream.ReadString(); HashedSeed = stream.ReadLong(); //Difficulty = (byte) stream.ReadByte(); stream.ReadByte(); ViewDistance = stream.ReadVarInt(); ReducedDebugInfo = stream.ReadBool(); EnableRespawnScreen = stream.ReadBool(); IsDebug = stream.ReadBool(); IsFlat = stream.ReadBool(); }
public void ReadPacket(MinecraftStream stream) { ProtocolVersion = stream.ReadUInt8(); PartyName = stream.ReadString(); KeyOrMOTD = stream.ReadString(); IsOP = stream.ReadUInt8() == 0x64; }
public virtual void Read(MinecraftStream stream) { TeamDisplayName = stream.ReadChatObject(); Flags = (byte)stream.ReadByte(); NameTagVisibility = stream.ReadString(); CollisionRule = stream.ReadString(); TeamColor = (TeamsPacket.TeamColor)stream.ReadVarInt(); TeamPrefix = stream.ReadChatObject(); TeamSuffix = stream.ReadChatObject(); }
public override void Decode(MinecraftStream stream) { Dimension = stream.ReadString(); WorldName = stream.ReadString(); HashedSeed = stream.ReadLong(); Gamemode = (Gamemode)stream.ReadByte(); PreviousGamemode = (Gamemode)stream.ReadByte(); IsDebug = stream.ReadBool(); IsFlat = stream.ReadBool(); CopyMetadata = stream.ReadBool(); }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { EntityName = stream.ReadString(); Action = (UpdateScoreAction)stream.ReadByte(); ObjectiveName = stream.ReadString(); if (Action == UpdateScoreAction.CreateOrUpdate) { Value = stream.ReadVarInt(); } }
public override void Decode(MinecraftStream stream) { Dimension = stream.ReadInt(); Difficulty = (byte)stream.ReadByte(); Gamemode = (Gamemode)stream.ReadByte(); LevelType = stream.ReadString(); }
public override void Decode(MinecraftStream stream) { Channel = stream.ReadString(); var l = stream.ReadVarInt(); Data = stream.Read(l); }
public override void Decode(MinecraftStream stream) { ProtocolVersion = stream.ReadVarInt(); ServerAddress = stream.ReadString(); ServerPort = stream.ReadUShort(); NextState = (ConnectionState)stream.ReadVarInt(); }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { TeamName = stream.ReadString(); PacketMode = (Mode)stream.ReadByte(); switch (PacketMode) { case Mode.CreateTeam: var a = new CreateTeam(); a.Read(stream); Payload = a; break; case Mode.RemoveTeam: break; case Mode.UpdateTeam: var upd = new UpdateTeam(); upd.Read(stream); Payload = upd; break; case Mode.AddPlayer: var add = new AddPlayers(); add.Read(stream); Payload = add; break; case Mode.RemovePlayer: var remove = new RemovePlayers(); remove.Read(stream); Payload = remove; break; } }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); int count = stream.ReadInt(); for (int i = 0; i < count; i++) { string key = stream.ReadString(); double value = stream.ReadDouble(); int propCount = stream.ReadVarInt(); Modifier[] modifiers = new Modifier[propCount]; for (int y = 0; y < modifiers.Length; y++) { UUID uuid = new UUID(stream.ReadUuid().ToByteArray()); double amount = stream.ReadDouble(); ModifierMode op = (ModifierMode)stream.ReadByte(); modifiers[y] = EntityProperty.Factory.CreateModifier(uuid, amount, op); } EntityProperty prop = EntityProperty.Factory.Create(key, value, modifiers); if (!Properties.ContainsKey(prop.Key)) { Properties.Add(prop.Key, prop); } } }
public PluginMessageStore Handle() { using var stream = new MinecraftStream(PluginData); var result = Channel switch { "minecraft:brand" => new PluginMessageStore { Type = PluginMessageType.Brand, Value = stream.ReadString() }, "minecraft:register" => new PluginMessageStore // Payload should be a list of strings { Type = PluginMessageType.Register, Value = Encoding.UTF8.GetString(PluginData) }, "minecraft:unregister" => new PluginMessageStore { Type = PluginMessageType.Unregister, Value = Encoding.UTF8.GetString(PluginData) }, _ => null }; return(result); }
public State ReadFrom(MinecraftStream stream, State state) { ProtocolVersion = stream.ReadVarInt(); ServerHostname = stream.ReadString(); ServerPort = stream.Read <ushort>(); NextState = (State)stream.ReadVarInt(); return(NextState); }
public override void Decode(MinecraftStream stream) { Message = stream.ReadString(); if (!ServerBound) { Position = (byte)stream.ReadByte(); } }
public override void Decode(MinecraftStream stream) { Locale = stream.ReadString(); ViewDistance = (byte)stream.ReadByte(); ChatMode = stream.ReadVarInt(); ChatColors = stream.ReadBool(); SkinParts = (byte)stream.ReadByte(); MainHand = stream.ReadVarInt(); }
public override void Decode(MinecraftStream stream) { ServerId = stream.ReadString(); int publicKeyLength = stream.ReadVarInt(); PublicKey = stream.Read(publicKeyLength); int verifyTokenLength = stream.ReadVarInt(); VerifyToken = stream.Read(verifyTokenLength); }
public override void Decode(MinecraftStream stream) { MessageId = stream.ReadVarInt(); Channel = stream.ReadString(); long length = stream.Length - stream.Position; byte[] buffer = new byte[length]; Data = stream.Read(buffer.Length); }
public void ReadPacket(MinecraftStream stream) { PlayerID = stream.ReadInt8(); Username = stream.ReadString(); X = stream.ReadInt16(); Y = stream.ReadInt16(); Z = stream.ReadInt16(); Yaw = stream.ReadUInt8(); Pitch = stream.ReadUInt8(); }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadInt(); Gamemode = (byte)stream.ReadByte(); Dimension = stream.ReadInt(); Difficulty = (byte)stream.ReadByte(); stream.ReadByte(); LevelType = stream.ReadString(); ReducedDebugInfo = stream.ReadBool(); }
public void Read(MinecraftStream stream) { int count = stream.ReadVarInt(); Entities = new string[count]; for (int i = 0; i < count; i++) { Entities[i] = stream.ReadString(); } }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { ObjectiveName = stream.ReadString(); Mode = (ObjectiveMode)stream.ReadByte(); if (Mode == ObjectiveMode.Create || Mode == ObjectiveMode.UpdateText) { Value = stream.ReadChatObject(); Type = (ObjectiveType)stream.ReadByte(); } }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadInt(); Gamemode = (byte)stream.ReadByte(); Dimension = stream.ReadInt(); HashedSeed = stream.ReadLong(); //Difficulty = (byte) stream.ReadByte(); stream.ReadByte(); LevelType = stream.ReadString(); ReducedDebugInfo = stream.ReadBool(); EnableRespawnScreen = stream.ReadBool(); }
public override void MessageRecieved(RemoteClient client, byte[] data) { if (ServerPingReceived != null) { var stream = new MinecraftStream(new MemoryStream(data)); var eventArgs = new ServerPingEventArgs( stream.ReadInt32(), stream.ReadString(), stream.ReadInt32()); ServerPingReceived(this, eventArgs); } }
public override Packet Read(byte[] data) { var ms = new MinecraftStream(data); var re = new LoginStart() { ID = ms.ReadVarInt() }; var l = ms.ReadVarInt(); re.Name = ms.ReadString(l); return(re); }
public override void Decode(MinecraftStream stream) { TransactionId = stream.ReadVarInt(); Start = stream.ReadVarInt(); Length = stream.ReadVarInt(); int c = stream.ReadVarInt(); Matches = new TabCompleteMatch[c]; for (int i = 0; i < c; i++) { var entry = new TabCompleteMatch(); entry.Match = stream.ReadString(); entry.HasTooltip = stream.ReadBool(); if (entry.HasTooltip) { ChatObject.TryParse(stream.ReadString(), out entry.Tooltip); } Matches[i] = entry; } }
private void ReadAddPlayerEntries(int count, MinecraftStream stream) { AddPlayerEntries = new AddPlayerEntry[count]; for (int i = 0; i < count; i++) { var newEntry = new AddPlayerEntry(); newEntry.UUID = stream.ReadUuid(); newEntry.Name = stream.ReadString(); int propertyLength = stream.ReadVarInt(); newEntry.Properties = new PlayerListProperty[propertyLength]; for (int ii = 0; ii < propertyLength; ii++) { newEntry.Properties[ii] = new PlayerListProperty() { Name = stream.ReadString(), Value = stream.ReadString(), IsSigned = stream.ReadBool() }; if (newEntry.Properties[ii].IsSigned) { newEntry.Properties[ii].Signature = stream.ReadString(); } } newEntry.Gamemode = stream.ReadVarInt(); newEntry.Ping = stream.ReadVarInt(); newEntry.HasDisplayName = stream.ReadBool(); if (newEntry.HasDisplayName) { newEntry.DisplayName = stream.ReadString(); } AddPlayerEntries[i] = newEntry; } }
private void ReadUpdateDisplayNameEntries(int count, MinecraftStream stream) { UpdateDisplayNameEntries = new UpdateDisplayNameEntry[count]; for (int i = 0; i < count; i++) { var entry = new UpdateDisplayNameEntry(); entry.UUID = stream.ReadUuid(); entry.HasDisplayName = stream.ReadBool(); if (entry.HasDisplayName) { entry.DisplayName = stream.ReadString(); } UpdateDisplayNameEntries[i] = entry; } }
public override Packet Read(byte[] data) { var re = new HandShake(); MinecraftStream ms = new MinecraftStream(data); re.ID = ms.ReadVarInt(); re.ProtocolVersion = ms.ReadVarInt(); var l = ms.ReadVarInt(); re.ServerAddress = ms.ReadString(l); re.ServerPort = ms.ReadUShort(); re.NextState = ms.ReadVarInt(); return(re); }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); int count = stream.ReadInt(); for (int i = 0; i < count; i++) { Property prop = new Property(); string key = stream.ReadString(); double value = stream.ReadDouble(); int propCount = stream.ReadVarInt(); Modifier[] modifiers = new Modifier[propCount]; for (int y = 0; y < modifiers.Length; y++) { UUID uuid = new UUID(stream.ReadUuid().ToByteArray()); double amount = stream.ReadDouble(); byte op = (byte)stream.ReadByte(); modifiers[y] = new Modifier() { Amount = amount, Operation = op, Uuid = uuid }; } prop.Value = value; prop.Modifiers = modifiers; prop.Key = key; if (!Properties.ContainsKey(key)) { Properties.Add(key, prop); } } }
public override void Decode(MinecraftStream stream) { Event = (CombatEvent)stream.ReadVarInt(); switch (Event) { case CombatEvent.EnterCombat: break; case CombatEvent.EndCombat: Duration = stream.ReadVarInt(); EntityId = stream.ReadInt(); break; case CombatEvent.EntityDead: PlayerId = stream.ReadVarInt(); EntityId = stream.ReadInt(); Message = stream.ReadString(); break; default: throw new ArgumentOutOfRangeException(); } }
public override void Decode(MinecraftStream stream) { Message = stream.ReadString(); }
public override void FromStream(MinecraftStream stream) { Value = stream.ReadString(); }