public byte[] GetBytes(bool unloader = false) { var writer = new MSGBuffer(new byte[0]); if (!unloader) { writer.WriteInt(X); writer.WriteInt(Z); writer.WriteBool(true); writer.WriteUShort(0xffff); // bitmap writer.WriteVarInt((Blocks.Length * 2) + Skylight.Data.Length + Blocklight.Data.Length + BiomeId.Length); for (var i = 0; i < Blocks.Length; i++) { //if (i == null) writer.WriteUShort((0 << 4) | 0); writer.WriteUShort((ushort)((Blocks[i] << 4) | Metadata[i])); } writer.Write(Blocklight.Data); writer.Write(Skylight.Data); writer.Write(BiomeId); } else { writer.WriteInt(X); writer.WriteInt(Z); writer.WriteBool(true); writer.WriteUShort(0); writer.WriteVarInt(0); } return(writer.ExportWriter); }
public void Write(ClientWrapper state, MSGBuffer buffer, object[] Arguments) { buffer.WriteVarInt(PacketID); buffer.WriteInt(state.Player.UniqueServerID); buffer.WriteByte((byte)state.Player.Gamemode); buffer.WriteInt(state.Player.Dimension); buffer.WriteByte((byte)Globals.Difficulty); buffer.WriteByte((byte)Globals.MaxPlayers); buffer.WriteString(Globals.LVLType); buffer.WriteBool(false); Globals.Logger.Log(Utils.LogType.Error, Globals.LVLType); buffer.FlushData(); }