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) { Position = stream.ReadPosition(); Block = stream.ReadVarInt(); Status = (DigStatus)stream.ReadVarInt(); Successful = stream.ReadBool(); }
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 override void Decode(MinecraftStream stream) { ChunkX = stream.ReadInt(); ChunkZ = stream.ReadInt(); GroundUp = stream.ReadBool(); //IgnoreOldData = stream.ReadBool(); PrimaryBitmask = stream.ReadVarInt(); HeightMaps = stream.ReadNbtCompound(); if (GroundUp) { int biomeCount = stream.ReadVarInt(); int[] biomeIds = new int[biomeCount]; for (int idx = 0; idx < biomeIds.Length; idx++) { biomeIds[idx] = stream.ReadVarInt(); } Biomes = biomeIds; } int i = stream.ReadVarInt(); Buffer = new Memory <byte>(new byte[i]); stream.Read(Buffer.Span, Buffer.Length); int tileEntities = stream.ReadVarInt(); for (int k = 0; k < tileEntities; k++) { TileEntities.Add(stream.ReadNbtCompound()); } }
public override void Decode(MinecraftStream stream) { ChunkX = stream.ReadInt(); ChunkZ = stream.ReadInt(); GroundUp = stream.ReadBool(); PrimaryBitmask = stream.ReadVarInt(); HeightMaps = stream.ReadNbtCompound(); if (GroundUp) { int[] biomeIds = new int[1024]; for (int idx = 0; idx < biomeIds.Length; idx++) { biomeIds[idx] = stream.ReadInt(); } } int i = stream.ReadVarInt(); Buffer = new byte[i]; stream.Read(Buffer, 0, Buffer.Length); int tileEntities = stream.ReadVarInt(); for (int k = 0; k < tileEntities; k++) { TileEntities.Add(stream.ReadNbtCompound()); } }
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 override void Decode(MinecraftStream stream) { Action = (PlayerListAction)stream.ReadVarInt(); int count = stream.ReadVarInt(); if (Action == PlayerListAction.AddPlayer) { ReadAddPlayerEntries(count, stream); return; } if (Action == PlayerListAction.UpdateLatency) { ReadUpdateLatencyEntries(count, stream); return; } if (Action == PlayerListAction.RemovePlayer) { RemovePlayerEntries = new RemovePlayerEntry[count]; for (int i = 0; i < RemovePlayerEntries.Length; i++) { var entry = new RemovePlayerEntry(); entry.UUID = stream.ReadUuid(); RemovePlayerEntries[i] = entry; } } if (Action == PlayerListAction.UpdateDisplayName) { ReadUpdateDisplayNameEntries(count, stream); } }
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) { int sharedSecretLength = stream.ReadVarInt(); SharedSecret = stream.Read(sharedSecretLength); int verifyTokenLength = stream.ReadVarInt(); VerifyToken = stream.Read(verifyTokenLength); }
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 State ReadFrom(MinecraftStream stream, State state) { int sharedSecretLength = stream.ReadVarInt(); SharedSecret = stream.ReadBytes(sharedSecretLength); int verificationTokenLength = stream.ReadVarInt(); VerificationToken = stream.ReadBytes(verificationTokenLength); return(state); }
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) { int count = stream.ReadVarInt(); EntityIds = new int[count]; for (int i = 0; i < count; i++) { EntityIds[i] = stream.ReadVarInt(); } }
public void Read(MinecraftStream ms) { var blockCount = ms.ReadShort(); var bitsPerBlock = (byte)ms.ReadByte(); int palleteLength = 0;// = ms.ReadVarInt(); if (bitsPerBlock <= 4) { bitsPerBlock = 4; } if (bitsPerBlock <= 8) { _bits = bitsPerBlock; palleteLength = ms.ReadVarInt(); Pallette = new IntIdentityHashBiMap(palleteLength); Pallette.Add(Air); for (int id = 0; id < palleteLength; id++) { uint stateId = (uint)ms.ReadVarInt(); BlockState state = BlockFactory.GetBlockState(stateId); Pallette.Put(state, (uint)id); } } else { _bits = (int)Math.Ceiling(Math.Log2(BlockFactory.AllBlockstates.Count)); Pallette = new DirectPallete(); } int length = ms.ReadVarInt(); long[] dataArray = new long[length]; for (int i = 0; i < dataArray.Length; i++) { dataArray[i] = ms.ReadLong(); } Storage = new FlexibleStorage(_bits, 4096); var valueMask = (uint)((1L << _bits) - 1); for (int index = 0; index < 4096; index++) { var state = index / (64 / _bits); var data = dataArray[state]; var shiftedData = data >> (index % (64 / _bits) * _bits); Storage[index] = (uint)(shiftedData & valueMask); } }
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 void Read(MinecraftStream ms) { var blockCount = ms.ReadShort(); var bitsPerBlock = (byte)ms.ReadByte(); int palleteLength = 0;// = ms.ReadVarInt(); if (bitsPerBlock <= 4) { bitsPerBlock = 4; } if (bitsPerBlock <= 8) { _bits = bitsPerBlock; palleteLength = ms.ReadVarInt(); Pallette = new IntIdentityHashBiMap <BlockState>(palleteLength); Pallette.Add(Air); //else // palleteLength = for (int id = 0; id < palleteLength; id++) { uint stateId = (uint)ms.ReadVarInt(); BlockState state = BlockFactory.GetBlockState(stateId); Pallette.Put(state, (uint)id); // idToState.Set(id, state); // stateToId.Set(state, id); } } else { _bits = (int)Math.Ceiling(Math.Log2(BlockFactory.AllBlockstates.Count)); Pallette = new DirectPallete(); } int length = ms.ReadVarInt(); long[] dataArray = new long[length]; for (int i = 0; i < dataArray.Length; i++) { dataArray[i] = ms.ReadLong(); } Storage = new FlexibleStorage(_bits, dataArray); //Storage._data = dataArray; }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); Uuid = stream.ReadUuid(); Type = stream.ReadVarInt(); X = stream.ReadDouble(); Y = stream.ReadDouble(); Z = stream.ReadDouble(); Yaw = (byte)stream.ReadByte(); Pitch = (byte)stream.ReadByte(); HeadPitch = (byte)stream.ReadByte(); VelocityX = stream.ReadShort(); VelocityY = stream.ReadShort(); VelocityZ = stream.ReadShort(); }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { AimWithHead = stream.ReadVarInt() == 1; var x = (float)stream.ReadDouble(); var y = (float)stream.ReadDouble(); var z = (float)stream.ReadDouble(); Target = new Vector3(x, y, z); IsEntity = stream.ReadBool(); if (IsEntity) { EntityId = stream.ReadVarInt(); LookAtEyes = stream.ReadVarInt() == 1; } }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); Yaw = (sbyte)stream.ReadByte(); Pitch = (sbyte)stream.ReadByte(); OnGround = stream.ReadBool(); }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { Location = stream.ReadPosition(); ActionId = (byte)stream.ReadByte(); Parameter = (byte)stream.ReadByte(); BlockType = stream.ReadVarInt(); }
public override void Decode(MinecraftStream stream) { Channel = stream.ReadString(); var l = stream.ReadVarInt(); Data = stream.Read(l); }
public override void Decode(MinecraftStream stream) { Action = (ActionEnum)stream.ReadVarInt(); switch (Action) { case ActionEnum.SetTitle: TitleText = stream.ReadChatObject(); break; case ActionEnum.SetSubTitle: SubtitleText = stream.ReadChatObject(); break; case ActionEnum.SetActionBar: ActionBarText = stream.ReadChatObject(); break; case ActionEnum.SetTimesAndDisplay: FadeIn = stream.ReadInt(); Stay = stream.ReadInt(); FadeOut = stream.ReadInt(); break; case ActionEnum.Hide: break; case ActionEnum.Reset: break; } }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); VelocityX = stream.ReadShort(); VelocityY = stream.ReadShort(); VelocityZ = stream.ReadShort(); }
public virtual Packet Read(byte[] data) { var re = new Packet(); MinecraftStream ms = new MinecraftStream(data); re.ID = ms.ReadVarInt(); return(re); }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); DeltaX = stream.ReadShort(); DeltaY = stream.ReadShort(); DeltaZ = stream.ReadShort(); OnGround = stream.ReadBool(); }
public override Packet Read(byte[] data) { var re = new Ping(); MinecraftStream ms = new MinecraftStream(data); re.ID = ms.ReadVarInt(); re.Payload = ms.ReadLong(); return(re); }
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) { MessageId = stream.ReadVarInt(); Channel = stream.ReadString(); long length = stream.Length - stream.Position; byte[] buffer = new byte[length]; Data = stream.Read(buffer.Length); }
public override void Decode(MinecraftStream stream) { X = stream.ReadDouble(); Y = stream.ReadDouble(); Z = stream.ReadDouble(); Yaw = stream.ReadFloat(); Pitch = stream.ReadFloat(); Flags = (byte)stream.ReadByte(); TeleportId = stream.ReadVarInt(); }
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); }