mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add packet palettes (#1236)
* Add packet type palette * Fix * test new palette * Fix 1.16.2 palette * Add packet ID dumper * Add document * Update naming * Delete old implementation of packet type * Rename PacketTypeHandler to PacketType18Handler * Fix packet type namespace * Add dump to file method for packet type * Rename packet palette version number * Replace unknown packet type to explicit type name Prevent duplicated key while creating reverse mapping * Include packets ID in packet palette Add packet palette helper class * Remove packet ID dumper methods As packets ID are included in source code now
This commit is contained in:
parent
896cabb6ce
commit
3434d95b81
19 changed files with 1978 additions and 906 deletions
|
|
@ -152,10 +152,21 @@
|
||||||
<Compile Include="Protocol\EntityActionType.cs" />
|
<Compile Include="Protocol\EntityActionType.cs" />
|
||||||
<Compile Include="Protocol\Handlers\DataTypes.cs" />
|
<Compile Include="Protocol\Handlers\DataTypes.cs" />
|
||||||
<Compile Include="Protocol\Handlers\Forge\FMLVersion.cs" />
|
<Compile Include="Protocol\Handlers\Forge\FMLVersion.cs" />
|
||||||
<Compile Include="Protocol\Handlers\PacketIncomingType.cs" />
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette110.cs" />
|
||||||
<Compile Include="Protocol\Handlers\PacketOutgoingType.cs" />
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette112.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette1122.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette113.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette114.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette115.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette116.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette1162.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPalette17.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketPaletteHelper.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketType18Handler.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketPalettes\PacketTypePalette.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketTypesIn.cs" />
|
||||||
|
<Compile Include="Protocol\Handlers\PacketTypesOut.cs" />
|
||||||
<Compile Include="Protocol\Handlers\Protocol18Forge.cs" />
|
<Compile Include="Protocol\Handlers\Protocol18Forge.cs" />
|
||||||
<Compile Include="Protocol\Handlers\Protocol18PacketTypes.cs" />
|
|
||||||
<Compile Include="Protocol\Handlers\Protocol18Terrain.cs" />
|
<Compile Include="Protocol\Handlers\Protocol18Terrain.cs" />
|
||||||
<Compile Include="Protocol\Handlers\SocketWrapper.cs" />
|
<Compile Include="Protocol\Handlers\SocketWrapper.cs" />
|
||||||
<Compile Include="Protocol\DataTypeGenerator.cs" />
|
<Compile Include="Protocol\DataTypeGenerator.cs" />
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace MinecraftClient.Protocol.Handlers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Abstract incoming packet numbering
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Please add new entries at the bottom of the list (but above UnknownPakcket)
|
|
||||||
/// You'll also need to add them to Protocol18PacketTypes for all MC versions since MC 1.7
|
|
||||||
/// </remarks>
|
|
||||||
enum PacketIncomingType
|
|
||||||
{
|
|
||||||
KeepAlive,
|
|
||||||
JoinGame,
|
|
||||||
ChatMessage,
|
|
||||||
Respawn,
|
|
||||||
PlayerPositionAndLook,
|
|
||||||
ChunkData,
|
|
||||||
MultiBlockChange,
|
|
||||||
BlockChange,
|
|
||||||
MapChunkBulk,
|
|
||||||
UnloadChunk,
|
|
||||||
PlayerListUpdate,
|
|
||||||
TabCompleteResult,
|
|
||||||
PluginMessage,
|
|
||||||
KickPacket,
|
|
||||||
NetworkCompressionTreshold,
|
|
||||||
ResourcePackSend,
|
|
||||||
CloseWindow,
|
|
||||||
OpenWindow,
|
|
||||||
WindowItems,
|
|
||||||
WindowConfirmation,
|
|
||||||
SetSlot,
|
|
||||||
SpawnEntity,
|
|
||||||
SpawnLivingEntity,
|
|
||||||
SpawnPlayer,
|
|
||||||
DestroyEntities,
|
|
||||||
SetCooldown,
|
|
||||||
EntityPosition,
|
|
||||||
EntityPositionAndRotation,
|
|
||||||
EntityProperties,
|
|
||||||
EntityTeleport,
|
|
||||||
EntityEquipment,
|
|
||||||
EntityVelocity,
|
|
||||||
EntityEffect,
|
|
||||||
EntityMetadata,
|
|
||||||
TimeUpdate,
|
|
||||||
UpdateHealth,
|
|
||||||
SetExperience,
|
|
||||||
HeldItemChange,
|
|
||||||
Explosion,
|
|
||||||
MapData,
|
|
||||||
Title,
|
|
||||||
ScoreboardObjective,
|
|
||||||
UpdateScore,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a packet not implemented in MCC.
|
|
||||||
/// </summary>
|
|
||||||
UnknownPacket,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace MinecraftClient.Protocol.Handlers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Abstract outgoing packet numbering
|
|
||||||
/// </summary>
|
|
||||||
/// /// <remarks>
|
|
||||||
/// Please add new entries at the bottom of the list
|
|
||||||
/// You'll also need to add them to Protocol18PacketTypes for all MC versions since MC 1.7
|
|
||||||
/// </remarks>
|
|
||||||
enum PacketOutgoingType
|
|
||||||
{
|
|
||||||
KeepAlive,
|
|
||||||
ResourcePackStatus,
|
|
||||||
ChatMessage,
|
|
||||||
ClientStatus,
|
|
||||||
ClientSettings,
|
|
||||||
PluginMessage,
|
|
||||||
TabComplete,
|
|
||||||
EntityAction,
|
|
||||||
PlayerPosition,
|
|
||||||
PlayerPositionAndLook,
|
|
||||||
TeleportConfirm,
|
|
||||||
HeldItemChange,
|
|
||||||
InteractEntity,
|
|
||||||
UseItem,
|
|
||||||
ClickWindow,
|
|
||||||
CloseWindow,
|
|
||||||
WindowConfirmation,
|
|
||||||
PlayerBlockPlacement,
|
|
||||||
CreativeInventoryAction,
|
|
||||||
Animation,
|
|
||||||
PlayerDigging,
|
|
||||||
UpdateSign,
|
|
||||||
UpdateCommandBlock,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette110 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x0F, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x10, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x11, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x12, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x13, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x14, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x15, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x16, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x17, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x18, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x19, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1B, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1C, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1D, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1E, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1F, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x20, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x21, PacketTypesIn.Effect },
|
||||||
|
{ 0x22, PacketTypesIn.Particle },
|
||||||
|
{ 0x23, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x24, PacketTypesIn.MapData },
|
||||||
|
{ 0x25, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x26, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x27, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x28, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x29, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2A, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x2B, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x2C, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x2D, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x2E, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x2F, PacketTypesIn.UseBed },
|
||||||
|
{ 0x30, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x31, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x32, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x33, PacketTypesIn.Respawn },
|
||||||
|
{ 0x34, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x35, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x36, PacketTypesIn.Camera },
|
||||||
|
{ 0x37, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x38, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x39, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x3A, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x3B, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x3C, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x3D, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x3E, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x3F, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x40, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x41, PacketTypesIn.Teams },
|
||||||
|
{ 0x42, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x43, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x44, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x45, PacketTypesIn.Title },
|
||||||
|
{ 0x46, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x47, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x48, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x49, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x4A, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x4B, PacketTypesIn.EntityEffect },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x02, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x03, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x04, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x05, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x06, PacketTypesOut.EnchantItem },
|
||||||
|
{ 0x07, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x08, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x09, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0A, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0B, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x0C, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x0D, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x0E, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x0F, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x10, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x11, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x14, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x15, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x16, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x17, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x18, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x19, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x1A, PacketTypesOut.Animation },
|
||||||
|
{ 0x1B, PacketTypesOut.Spectate },
|
||||||
|
{ 0x1C, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x1D, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette112 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x0F, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x10, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x11, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x12, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x13, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x14, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x15, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x16, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x17, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x18, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x19, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1B, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1C, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1D, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1E, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1F, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x20, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x21, PacketTypesIn.Effect },
|
||||||
|
{ 0x22, PacketTypesIn.Particle },
|
||||||
|
{ 0x23, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x24, PacketTypesIn.MapData },
|
||||||
|
{ 0x25, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x26, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x27, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x28, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x29, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2A, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x2B, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x2C, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x2D, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x2E, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x2F, PacketTypesIn.UseBed },
|
||||||
|
{ 0x30, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x31, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x32, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x33, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x34, PacketTypesIn.Respawn },
|
||||||
|
{ 0x35, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x36, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x37, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x38, PacketTypesIn.Camera },
|
||||||
|
{ 0x39, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x3A, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x3B, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x3C, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x3D, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x3E, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x3F, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x40, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x41, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x42, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x43, PacketTypesIn.Teams },
|
||||||
|
{ 0x44, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x45, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x46, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x47, PacketTypesIn.Title },
|
||||||
|
{ 0x48, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x49, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x4A, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x4B, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x4C, PacketTypesIn.Advancements },
|
||||||
|
{ 0x4D, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x4E, PacketTypesIn.EntityEffect },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.Unknown },
|
||||||
|
{ 0x02, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x03, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x04, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x05, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x06, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x07, PacketTypesOut.EnchantItem },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x09, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0B, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0C, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x0D, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x0E, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x0F, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x10, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x11, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x12, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x15, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x16, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x17, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x18, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x19, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x1A, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x1B, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x1C, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x1D, PacketTypesOut.Animation },
|
||||||
|
{ 0x1E, PacketTypesOut.Spectate },
|
||||||
|
{ 0x1F, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x20, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette1122 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x0F, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x10, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x11, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x12, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x13, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x14, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x15, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x16, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x17, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x18, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x19, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1B, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1C, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1D, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1E, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1F, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x20, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x21, PacketTypesIn.Effect },
|
||||||
|
{ 0x22, PacketTypesIn.Particle },
|
||||||
|
{ 0x23, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x24, PacketTypesIn.MapData },
|
||||||
|
{ 0x25, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x26, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x27, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x28, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x29, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2A, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x2B, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x2C, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x2D, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x2E, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x2F, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x30, PacketTypesIn.UseBed },
|
||||||
|
{ 0x31, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x32, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x33, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x34, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x35, PacketTypesIn.Respawn },
|
||||||
|
{ 0x36, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x37, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x38, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x39, PacketTypesIn.Camera },
|
||||||
|
{ 0x3A, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x3B, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x3C, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x3D, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x3E, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x3F, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x40, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x41, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x42, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x43, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x44, PacketTypesIn.Teams },
|
||||||
|
{ 0x45, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x46, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x47, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x48, PacketTypesIn.Title },
|
||||||
|
{ 0x49, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x4A, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x4B, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x4C, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x4D, PacketTypesIn.Advancements },
|
||||||
|
{ 0x4E, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x4F, PacketTypesIn.EntityEffect },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x02, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x03, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x04, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x05, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x06, PacketTypesOut.EnchantItem },
|
||||||
|
{ 0x07, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x08, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x09, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0A, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0B, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x0C, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x0D, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x0E, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x0F, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x10, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x11, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x12, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x15, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x16, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x17, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x18, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x19, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x1A, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x1B, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x1C, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x1D, PacketTypesOut.Animation },
|
||||||
|
{ 0x1E, PacketTypesOut.Spectate },
|
||||||
|
{ 0x1F, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x20, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette113 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x0F, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x10, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x11, PacketTypesIn.DeclareCommands },
|
||||||
|
{ 0x12, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x13, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x14, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x15, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x16, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x17, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x18, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x19, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x1A, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1B, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1C, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1D, PacketTypesIn.NBTQueryResponse },
|
||||||
|
{ 0x1E, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1F, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x20, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x21, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x22, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x23, PacketTypesIn.Effect },
|
||||||
|
{ 0x24, PacketTypesIn.Particle },
|
||||||
|
{ 0x25, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x26, PacketTypesIn.MapData },
|
||||||
|
{ 0x27, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x28, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x29, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x2A, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x2B, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2C, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x2D, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x2E, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x2F, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x30, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x31, PacketTypesIn.FacePlayer },
|
||||||
|
{ 0x32, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x33, PacketTypesIn.UseBed },
|
||||||
|
{ 0x34, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x35, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x36, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x37, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x38, PacketTypesIn.Respawn },
|
||||||
|
{ 0x39, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x3A, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x3B, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x3C, PacketTypesIn.Camera },
|
||||||
|
{ 0x3D, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x3E, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x3F, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x40, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x41, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x42, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x43, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x44, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x45, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x46, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x47, PacketTypesIn.Teams },
|
||||||
|
{ 0x48, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x49, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x4A, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x4B, PacketTypesIn.Title },
|
||||||
|
{ 0x4C, PacketTypesIn.StopSound },
|
||||||
|
{ 0x4D, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x4E, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x4F, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x50, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x51, PacketTypesIn.Advancements },
|
||||||
|
{ 0x52, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x53, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x54, PacketTypesIn.DeclareRecipes },
|
||||||
|
{ 0x55, PacketTypesIn.Tags },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.QueryBlockNBT },
|
||||||
|
{ 0x02, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x03, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x04, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x05, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x06, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x07, PacketTypesOut.EnchantItem },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x09, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0B, PacketTypesOut.EditBook },
|
||||||
|
{ 0x0C, PacketTypesOut.EntityNBTRequest },
|
||||||
|
{ 0x0D, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0E, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x0F, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x10, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x11, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x13, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x14, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x15, PacketTypesOut.PickItem },
|
||||||
|
{ 0x16, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x17, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x18, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x19, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x1A, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x1B, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x1C, PacketTypesOut.NameItem },
|
||||||
|
{ 0x1D, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x1E, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x1F, PacketTypesOut.SelectTrade },
|
||||||
|
{ 0x20, PacketTypesOut.SetBeaconEffect },
|
||||||
|
{ 0x21, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x22, PacketTypesOut.UpdateCommandBlock },
|
||||||
|
{ 0x23, PacketTypesOut.UpdateCommandBlockMinecart },
|
||||||
|
{ 0x24, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x25, PacketTypesOut.UpdateStructureBlock },
|
||||||
|
{ 0x26, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x27, PacketTypesOut.Animation },
|
||||||
|
{ 0x28, PacketTypesOut.Spectate },
|
||||||
|
{ 0x29, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x2A, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,167 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette114 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x0F, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x10, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x11, PacketTypesIn.DeclareCommands },
|
||||||
|
{ 0x12, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x13, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x14, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x15, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x16, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x17, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x18, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x19, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1B, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1C, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1D, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1E, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1F, PacketTypesIn.OpenHorseWindow },
|
||||||
|
{ 0x20, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x21, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x22, PacketTypesIn.Effect },
|
||||||
|
{ 0x23, PacketTypesIn.Particle },
|
||||||
|
{ 0x24, PacketTypesIn.UpdateLight },
|
||||||
|
{ 0x25, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x26, PacketTypesIn.MapData },
|
||||||
|
{ 0x27, PacketTypesIn.TradeList },
|
||||||
|
{ 0x28, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x29, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x2A, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x2B, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x2C, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2D, PacketTypesIn.OpenBook },
|
||||||
|
{ 0x2E, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x2F, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x30, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x31, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x32, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x33, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x34, PacketTypesIn.FacePlayer },
|
||||||
|
{ 0x35, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x36, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x37, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x38, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x39, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x3A, PacketTypesIn.Respawn },
|
||||||
|
{ 0x3B, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x3C, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x3D, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x3E, PacketTypesIn.Camera },
|
||||||
|
{ 0x3F, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x40, PacketTypesIn.UpdateViewPosition },
|
||||||
|
{ 0x41, PacketTypesIn.UpdateViewDistance },
|
||||||
|
{ 0x42, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x43, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x44, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x45, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x46, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x47, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x48, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x49, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x4A, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x4B, PacketTypesIn.Teams },
|
||||||
|
{ 0x4C, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x4D, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x4E, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x4F, PacketTypesIn.Title },
|
||||||
|
{ 0x50, PacketTypesIn.EntitySoundEffect },
|
||||||
|
{ 0x51, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x52, PacketTypesIn.StopSound },
|
||||||
|
{ 0x53, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x54, PacketTypesIn.NBTQueryResponse },
|
||||||
|
{ 0x55, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x56, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x57, PacketTypesIn.Advancements },
|
||||||
|
{ 0x58, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x59, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x5A, PacketTypesIn.DeclareRecipes },
|
||||||
|
{ 0x5B, PacketTypesIn.Tags },
|
||||||
|
{ 0x5C, PacketTypesIn.AcknowledgePlayerDigging },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.QueryBlockNBT },
|
||||||
|
{ 0x02, PacketTypesOut.SetDifficulty },
|
||||||
|
{ 0x03, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x04, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x05, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x06, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x07, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindowButton },
|
||||||
|
{ 0x09, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0B, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0C, PacketTypesOut.EditBook },
|
||||||
|
{ 0x0D, PacketTypesOut.EntityNBTRequest },
|
||||||
|
{ 0x0E, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0F, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x10, PacketTypesOut.LockDifficulty },
|
||||||
|
{ 0x11, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x15, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x16, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x17, PacketTypesOut.PickItem },
|
||||||
|
{ 0x18, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x19, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x1A, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x1B, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x1C, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x1D, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x1E, PacketTypesOut.NameItem },
|
||||||
|
{ 0x1F, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x20, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x21, PacketTypesOut.SelectTrade },
|
||||||
|
{ 0x22, PacketTypesOut.SetBeaconEffect },
|
||||||
|
{ 0x23, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x24, PacketTypesOut.UpdateCommandBlock },
|
||||||
|
{ 0x25, PacketTypesOut.UpdateCommandBlockMinecart },
|
||||||
|
{ 0x26, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x27, PacketTypesOut.UpdateJigsawBlock },
|
||||||
|
{ 0x28, PacketTypesOut.UpdateStructureBlock },
|
||||||
|
{ 0x29, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x2A, PacketTypesOut.Animation },
|
||||||
|
{ 0x2B, PacketTypesOut.Spectate },
|
||||||
|
{ 0x2C, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x2D, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,167 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette115 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x06, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x07, PacketTypesIn.Statistics },
|
||||||
|
{ 0x08, PacketTypesIn.AcknowledgePlayerDigging },
|
||||||
|
{ 0x09, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0C, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0D, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0E, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0F, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x10, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x11, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x12, PacketTypesIn.DeclareCommands },
|
||||||
|
{ 0x13, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x14, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x15, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x16, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x17, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x18, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x19, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x1A, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1B, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1C, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1D, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1E, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1F, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x20, PacketTypesIn.OpenHorseWindow },
|
||||||
|
{ 0x21, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x22, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x23, PacketTypesIn.Effect },
|
||||||
|
{ 0x24, PacketTypesIn.Particle },
|
||||||
|
{ 0x25, PacketTypesIn.UpdateLight },
|
||||||
|
{ 0x26, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x27, PacketTypesIn.MapData },
|
||||||
|
{ 0x28, PacketTypesIn.TradeList },
|
||||||
|
{ 0x29, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x2A, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x2B, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x2C, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x2D, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2E, PacketTypesIn.OpenBook },
|
||||||
|
{ 0x2F, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x30, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x31, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x32, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x33, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x34, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x35, PacketTypesIn.FacePlayer },
|
||||||
|
{ 0x36, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x37, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x38, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x39, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x3A, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x3B, PacketTypesIn.Respawn },
|
||||||
|
{ 0x3C, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x3D, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x3E, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x3F, PacketTypesIn.Camera },
|
||||||
|
{ 0x40, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x41, PacketTypesIn.UpdateViewPosition },
|
||||||
|
{ 0x42, PacketTypesIn.UpdateViewDistance },
|
||||||
|
{ 0x43, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x44, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x45, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x46, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x47, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x48, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x49, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x4A, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x4B, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x4C, PacketTypesIn.Teams },
|
||||||
|
{ 0x4D, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x4E, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x4F, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x50, PacketTypesIn.Title },
|
||||||
|
{ 0x51, PacketTypesIn.EntitySoundEffect },
|
||||||
|
{ 0x52, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x53, PacketTypesIn.StopSound },
|
||||||
|
{ 0x54, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x55, PacketTypesIn.NBTQueryResponse },
|
||||||
|
{ 0x56, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x57, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x58, PacketTypesIn.Advancements },
|
||||||
|
{ 0x59, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x5A, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x5B, PacketTypesIn.DeclareRecipes },
|
||||||
|
{ 0x5C, PacketTypesIn.Tags },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.QueryBlockNBT },
|
||||||
|
{ 0x02, PacketTypesOut.SetDifficulty },
|
||||||
|
{ 0x03, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x04, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x05, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x06, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x07, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindowButton },
|
||||||
|
{ 0x09, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0B, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0C, PacketTypesOut.EditBook },
|
||||||
|
{ 0x0D, PacketTypesOut.EntityNBTRequest },
|
||||||
|
{ 0x0E, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0F, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x10, PacketTypesOut.LockDifficulty },
|
||||||
|
{ 0x11, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x15, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x16, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x17, PacketTypesOut.PickItem },
|
||||||
|
{ 0x18, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x19, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x1A, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x1B, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x1C, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x1D, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x1E, PacketTypesOut.NameItem },
|
||||||
|
{ 0x1F, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x20, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x21, PacketTypesOut.SelectTrade },
|
||||||
|
{ 0x22, PacketTypesOut.SetBeaconEffect },
|
||||||
|
{ 0x23, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x24, PacketTypesOut.UpdateCommandBlock },
|
||||||
|
{ 0x25, PacketTypesOut.UpdateCommandBlockMinecart },
|
||||||
|
{ 0x26, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x27, PacketTypesOut.UpdateJigsawBlock },
|
||||||
|
{ 0x28, PacketTypesOut.UpdateStructureBlock },
|
||||||
|
{ 0x29, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x2A, PacketTypesOut.Animation },
|
||||||
|
{ 0x2B, PacketTypesOut.Spectate },
|
||||||
|
{ 0x2C, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x2D, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,167 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette116 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x05, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x06, PacketTypesIn.Statistics },
|
||||||
|
{ 0x07, PacketTypesIn.AcknowledgePlayerDigging },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x0F, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x10, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x11, PacketTypesIn.DeclareCommands },
|
||||||
|
{ 0x12, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x13, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x14, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x15, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x16, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x17, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x18, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x19, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1B, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1C, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1D, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1E, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1F, PacketTypesIn.OpenHorseWindow },
|
||||||
|
{ 0x20, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x21, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x22, PacketTypesIn.Effect },
|
||||||
|
{ 0x23, PacketTypesIn.Particle },
|
||||||
|
{ 0x24, PacketTypesIn.UpdateLight },
|
||||||
|
{ 0x25, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x26, PacketTypesIn.MapData },
|
||||||
|
{ 0x27, PacketTypesIn.TradeList },
|
||||||
|
{ 0x28, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x29, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x2A, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x2B, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x2C, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2D, PacketTypesIn.OpenBook },
|
||||||
|
{ 0x2E, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x2F, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x30, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x31, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x32, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x33, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x34, PacketTypesIn.FacePlayer },
|
||||||
|
{ 0x35, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x36, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x37, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x38, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x39, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x3A, PacketTypesIn.Respawn },
|
||||||
|
{ 0x3B, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x3C, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x3D, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x3E, PacketTypesIn.Camera },
|
||||||
|
{ 0x3F, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x40, PacketTypesIn.UpdateViewPosition },
|
||||||
|
{ 0x41, PacketTypesIn.UpdateViewDistance },
|
||||||
|
{ 0x42, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x43, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x44, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x45, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x46, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x47, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x48, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x49, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x4A, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x4B, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x4C, PacketTypesIn.Teams },
|
||||||
|
{ 0x4D, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x4E, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x4F, PacketTypesIn.Title },
|
||||||
|
{ 0x50, PacketTypesIn.EntitySoundEffect },
|
||||||
|
{ 0x51, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x52, PacketTypesIn.StopSound },
|
||||||
|
{ 0x53, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x54, PacketTypesIn.NBTQueryResponse },
|
||||||
|
{ 0x55, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x56, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x57, PacketTypesIn.Advancements },
|
||||||
|
{ 0x58, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x59, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x5A, PacketTypesIn.DeclareRecipes },
|
||||||
|
{ 0x5B, PacketTypesIn.Tags },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.QueryBlockNBT },
|
||||||
|
{ 0x02, PacketTypesOut.SetDifficulty },
|
||||||
|
{ 0x03, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x04, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x05, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x06, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x07, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindowButton },
|
||||||
|
{ 0x09, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0B, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0C, PacketTypesOut.EditBook },
|
||||||
|
{ 0x0D, PacketTypesOut.EntityNBTRequest },
|
||||||
|
{ 0x0E, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0F, PacketTypesOut.GenerateStructure },
|
||||||
|
{ 0x10, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x11, PacketTypesOut.LockDifficulty },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x15, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x16, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x17, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x18, PacketTypesOut.PickItem },
|
||||||
|
{ 0x19, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x1A, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x1B, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x1C, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x1D, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x1E, PacketTypesOut.RecipeBookData },
|
||||||
|
{ 0x1F, PacketTypesOut.NameItem },
|
||||||
|
{ 0x20, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x21, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x22, PacketTypesOut.SelectTrade },
|
||||||
|
{ 0x23, PacketTypesOut.SetBeaconEffect },
|
||||||
|
{ 0x24, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x25, PacketTypesOut.UpdateCommandBlock },
|
||||||
|
{ 0x26, PacketTypesOut.UpdateCommandBlockMinecart },
|
||||||
|
{ 0x27, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x28, PacketTypesOut.UpdateJigsawBlock },
|
||||||
|
{ 0x29, PacketTypesOut.UpdateStructureBlock },
|
||||||
|
{ 0x2A, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x2B, PacketTypesOut.Animation },
|
||||||
|
{ 0x2C, PacketTypesOut.Spectate },
|
||||||
|
{ 0x2D, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x2E, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette1162 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x02, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x03, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x04, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x05, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x06, PacketTypesIn.Statistics },
|
||||||
|
{ 0x07, PacketTypesIn.AcknowledgePlayerDigging },
|
||||||
|
{ 0x08, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x09, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x0A, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x0B, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x0C, PacketTypesIn.BossBar },
|
||||||
|
{ 0x0D, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x0E, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x0F, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x10, PacketTypesIn.DeclareCommands },
|
||||||
|
{ 0x11, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x12, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x13, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x14, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x15, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x16, PacketTypesIn.SetCooldown },
|
||||||
|
{ 0x17, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x18, PacketTypesIn.NamedSoundEffect },
|
||||||
|
{ 0x19, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x1A, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1B, PacketTypesIn.Explosion },
|
||||||
|
{ 0x1C, PacketTypesIn.UnloadChunk },
|
||||||
|
{ 0x1D, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x1E, PacketTypesIn.OpenHorseWindow },
|
||||||
|
{ 0x1F, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x20, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x21, PacketTypesIn.Effect },
|
||||||
|
{ 0x22, PacketTypesIn.Particle },
|
||||||
|
{ 0x23, PacketTypesIn.UpdateLight },
|
||||||
|
{ 0x24, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x25, PacketTypesIn.MapData },
|
||||||
|
{ 0x26, PacketTypesIn.TradeList },
|
||||||
|
{ 0x27, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x28, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x29, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x2A, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x2B, PacketTypesIn.VehicleMove },
|
||||||
|
{ 0x2C, PacketTypesIn.OpenBook },
|
||||||
|
{ 0x2D, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x2E, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x2F, PacketTypesIn.CraftRecipeResponse },
|
||||||
|
{ 0x30, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x31, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x32, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x33, PacketTypesIn.FacePlayer },
|
||||||
|
{ 0x34, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x35, PacketTypesIn.UnlockRecipes },
|
||||||
|
{ 0x36, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x37, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x38, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x39, PacketTypesIn.Respawn },
|
||||||
|
{ 0x3A, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x3B, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x3C, PacketTypesIn.SelectAdvancementTab },
|
||||||
|
{ 0x3D, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x3E, PacketTypesIn.Camera },
|
||||||
|
{ 0x3F, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x40, PacketTypesIn.UpdateViewPosition },
|
||||||
|
{ 0x41, PacketTypesIn.UpdateViewDistance },
|
||||||
|
{ 0x42, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x43, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x44, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x45, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x46, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x47, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x48, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x49, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x4A, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x4B, PacketTypesIn.SetPassengers },
|
||||||
|
{ 0x4C, PacketTypesIn.Teams },
|
||||||
|
{ 0x4D, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x4E, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x4F, PacketTypesIn.Title },
|
||||||
|
{ 0x50, PacketTypesIn.EntitySoundEffect },
|
||||||
|
{ 0x51, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x52, PacketTypesIn.StopSound },
|
||||||
|
{ 0x53, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x54, PacketTypesIn.NBTQueryResponse },
|
||||||
|
{ 0x55, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x56, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x57, PacketTypesIn.Advancements },
|
||||||
|
{ 0x58, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x59, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x5A, PacketTypesIn.DeclareRecipes },
|
||||||
|
{ 0x5B, PacketTypesIn.Tags },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.TeleportConfirm },
|
||||||
|
{ 0x01, PacketTypesOut.QueryBlockNBT },
|
||||||
|
{ 0x02, PacketTypesOut.SetDifficulty },
|
||||||
|
{ 0x03, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x04, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x05, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x06, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x07, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x08, PacketTypesOut.ClickWindowButton },
|
||||||
|
{ 0x09, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x0A, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0B, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x0C, PacketTypesOut.EditBook },
|
||||||
|
{ 0x0D, PacketTypesOut.EntityNBTRequest },
|
||||||
|
{ 0x0E, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x0F, PacketTypesOut.GenerateStructure },
|
||||||
|
{ 0x10, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x11, PacketTypesOut.LockDifficulty },
|
||||||
|
{ 0x12, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x14, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x15, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x16, PacketTypesOut.VehicleMove },
|
||||||
|
{ 0x17, PacketTypesOut.SteerBoat },
|
||||||
|
{ 0x18, PacketTypesOut.PickItem },
|
||||||
|
{ 0x19, PacketTypesOut.CraftRecipeRequest },
|
||||||
|
{ 0x1A, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x1B, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x1C, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x1D, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x1E, PacketTypesOut.SetDisplayedRecipe },
|
||||||
|
{ 0x1F, PacketTypesOut.SetRecipeBookState },
|
||||||
|
{ 0x20, PacketTypesOut.NameItem },
|
||||||
|
{ 0x21, PacketTypesOut.ResourcePackStatus },
|
||||||
|
{ 0x22, PacketTypesOut.AdvancementTab },
|
||||||
|
{ 0x23, PacketTypesOut.SelectTrade },
|
||||||
|
{ 0x24, PacketTypesOut.SetBeaconEffect },
|
||||||
|
{ 0x25, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x26, PacketTypesOut.UpdateCommandBlock },
|
||||||
|
{ 0x27, PacketTypesOut.UpdateCommandBlockMinecart },
|
||||||
|
{ 0x28, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x29, PacketTypesOut.UpdateJigsawBlock },
|
||||||
|
{ 0x2A, PacketTypesOut.UpdateStructureBlock },
|
||||||
|
{ 0x2B, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x2C, PacketTypesOut.Animation },
|
||||||
|
{ 0x2D, PacketTypesOut.Spectate },
|
||||||
|
{ 0x2E, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x2F, PacketTypesOut.UseItem },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette17 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.KeepAlive },
|
||||||
|
{ 0x01, PacketTypesIn.JoinGame },
|
||||||
|
{ 0x02, PacketTypesIn.ChatMessage },
|
||||||
|
{ 0x03, PacketTypesIn.TimeUpdate },
|
||||||
|
{ 0x04, PacketTypesIn.EntityEquipment },
|
||||||
|
{ 0x05, PacketTypesIn.SpawnPosition },
|
||||||
|
{ 0x06, PacketTypesIn.UpdateHealth },
|
||||||
|
{ 0x07, PacketTypesIn.Respawn },
|
||||||
|
{ 0x08, PacketTypesIn.PlayerPositionAndLook },
|
||||||
|
{ 0x09, PacketTypesIn.HeldItemChange },
|
||||||
|
{ 0x0A, PacketTypesIn.UseBed },
|
||||||
|
{ 0x0B, PacketTypesIn.EntityAnimation },
|
||||||
|
{ 0x0C, PacketTypesIn.SpawnPlayer },
|
||||||
|
{ 0x0D, PacketTypesIn.CollectItem },
|
||||||
|
{ 0x0E, PacketTypesIn.SpawnEntity },
|
||||||
|
{ 0x0F, PacketTypesIn.SpawnLivingEntity },
|
||||||
|
{ 0x10, PacketTypesIn.SpawnPainting },
|
||||||
|
{ 0x11, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
{ 0x12, PacketTypesIn.EntityVelocity },
|
||||||
|
{ 0x13, PacketTypesIn.DestroyEntities },
|
||||||
|
{ 0x14, PacketTypesIn.EntityMovement },
|
||||||
|
{ 0x15, PacketTypesIn.EntityPosition },
|
||||||
|
{ 0x16, PacketTypesIn.EntityRotation },
|
||||||
|
{ 0x17, PacketTypesIn.EntityPositionAndRotation },
|
||||||
|
{ 0x18, PacketTypesIn.EntityTeleport },
|
||||||
|
{ 0x19, PacketTypesIn.EntityHeadLook },
|
||||||
|
{ 0x1A, PacketTypesIn.EntityStatus },
|
||||||
|
{ 0x1B, PacketTypesIn.AttachEntity },
|
||||||
|
{ 0x1C, PacketTypesIn.EntityMetadata },
|
||||||
|
{ 0x1D, PacketTypesIn.EntityEffect },
|
||||||
|
{ 0x1E, PacketTypesIn.RemoveEntityEffect },
|
||||||
|
{ 0x1F, PacketTypesIn.SetExperience },
|
||||||
|
{ 0x20, PacketTypesIn.EntityProperties },
|
||||||
|
{ 0x21, PacketTypesIn.ChunkData },
|
||||||
|
{ 0x22, PacketTypesIn.MultiBlockChange },
|
||||||
|
{ 0x23, PacketTypesIn.BlockChange },
|
||||||
|
{ 0x24, PacketTypesIn.BlockAction },
|
||||||
|
{ 0x25, PacketTypesIn.BlockBreakAnimation },
|
||||||
|
{ 0x26, PacketTypesIn.MapChunkBulk },
|
||||||
|
{ 0x27, PacketTypesIn.Explosion },
|
||||||
|
{ 0x28, PacketTypesIn.Effect },
|
||||||
|
{ 0x29, PacketTypesIn.SoundEffect },
|
||||||
|
{ 0x2A, PacketTypesIn.Particle },
|
||||||
|
{ 0x2B, PacketTypesIn.ChangeGameState },
|
||||||
|
{ 0x2C, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
{ 0x2D, PacketTypesIn.OpenWindow },
|
||||||
|
{ 0x2E, PacketTypesIn.CloseWindow },
|
||||||
|
{ 0x2F, PacketTypesIn.SetSlot },
|
||||||
|
{ 0x30, PacketTypesIn.WindowItems },
|
||||||
|
{ 0x31, PacketTypesIn.WindowProperty },
|
||||||
|
{ 0x32, PacketTypesIn.WindowConfirmation },
|
||||||
|
{ 0x33, PacketTypesIn.UpdateSign },
|
||||||
|
{ 0x34, PacketTypesIn.MapData },
|
||||||
|
{ 0x35, PacketTypesIn.BlockEntityData },
|
||||||
|
{ 0x36, PacketTypesIn.OpenSignEditor },
|
||||||
|
{ 0x37, PacketTypesIn.Statistics },
|
||||||
|
{ 0x38, PacketTypesIn.PlayerInfo },
|
||||||
|
{ 0x39, PacketTypesIn.PlayerAbilities },
|
||||||
|
{ 0x3A, PacketTypesIn.TabComplete },
|
||||||
|
{ 0x3B, PacketTypesIn.ScoreboardObjective },
|
||||||
|
{ 0x3C, PacketTypesIn.UpdateScore },
|
||||||
|
{ 0x3D, PacketTypesIn.DisplayScoreboard },
|
||||||
|
{ 0x3E, PacketTypesIn.Teams },
|
||||||
|
{ 0x3F, PacketTypesIn.PluginMessage },
|
||||||
|
{ 0x40, PacketTypesIn.Disconnect },
|
||||||
|
{ 0x41, PacketTypesIn.ServerDifficulty },
|
||||||
|
{ 0x42, PacketTypesIn.CombatEvent },
|
||||||
|
{ 0x43, PacketTypesIn.Camera },
|
||||||
|
{ 0x44, PacketTypesIn.WorldBorder },
|
||||||
|
{ 0x45, PacketTypesIn.Title },
|
||||||
|
{ 0x46, PacketTypesIn.SetCompression },
|
||||||
|
{ 0x47, PacketTypesIn.PlayerListHeaderAndFooter },
|
||||||
|
{ 0x48, PacketTypesIn.ResourcePackSend },
|
||||||
|
{ 0x49, PacketTypesIn.UpdateEntityNBT },
|
||||||
|
};
|
||||||
|
|
||||||
|
private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesOut.KeepAlive },
|
||||||
|
{ 0x01, PacketTypesOut.ChatMessage },
|
||||||
|
{ 0x02, PacketTypesOut.InteractEntity },
|
||||||
|
{ 0x03, PacketTypesOut.PlayerMovement },
|
||||||
|
{ 0x04, PacketTypesOut.PlayerPosition },
|
||||||
|
{ 0x05, PacketTypesOut.PlayerRotation },
|
||||||
|
{ 0x06, PacketTypesOut.PlayerPositionAndRotation },
|
||||||
|
{ 0x07, PacketTypesOut.PlayerDigging },
|
||||||
|
{ 0x08, PacketTypesOut.PlayerBlockPlacement },
|
||||||
|
{ 0x09, PacketTypesOut.HeldItemChange },
|
||||||
|
{ 0x0A, PacketTypesOut.Animation },
|
||||||
|
{ 0x0B, PacketTypesOut.EntityAction },
|
||||||
|
{ 0x0C, PacketTypesOut.SteerVehicle },
|
||||||
|
{ 0x0D, PacketTypesOut.CloseWindow },
|
||||||
|
{ 0x0E, PacketTypesOut.ClickWindow },
|
||||||
|
{ 0x0F, PacketTypesOut.WindowConfirmation },
|
||||||
|
{ 0x10, PacketTypesOut.CreativeInventoryAction },
|
||||||
|
{ 0x11, PacketTypesOut.EnchantItem },
|
||||||
|
{ 0x12, PacketTypesOut.UpdateSign },
|
||||||
|
{ 0x13, PacketTypesOut.PlayerAbilities },
|
||||||
|
{ 0x14, PacketTypesOut.TabComplete },
|
||||||
|
{ 0x15, PacketTypesOut.ClientSettings },
|
||||||
|
{ 0x16, PacketTypesOut.ClientStatus },
|
||||||
|
{ 0x17, PacketTypesOut.PluginMessage },
|
||||||
|
{ 0x18, PacketTypesOut.Spectate },
|
||||||
|
{ 0x19, PacketTypesOut.ResourcePackStatus },
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||||
|
{
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||||
|
{
|
||||||
|
return typeOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public static class PacketPaletteHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a code snippet of updated IDs from a modified packet palette (usually when you have updated packet item position)
|
||||||
|
/// </summary>
|
||||||
|
/// <example>
|
||||||
|
/// You have inserted a new packet type with ID 0x02 into the copied new packet palette:
|
||||||
|
/// { 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
/// { 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
/// { 0xFF, PacketTypesIn.IamNewPacket }, // use 0xFF because it has conflict with old packet ID, we will correct the IDs now
|
||||||
|
/// { 0x02, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
/// ...
|
||||||
|
///
|
||||||
|
/// Call this method with your new packet palette:
|
||||||
|
/// UpdatePacketIdByItemPosition(new PacketPaletteXXXX(), "code_snippet.txt");
|
||||||
|
/// And it will generate a Dictionary format with the Packet IDs corrected for you to copy and paste:
|
||||||
|
/// { 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
/// { 0x01, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
/// { 0x02, PacketTypesIn.IamNewPacket },
|
||||||
|
/// { 0x03, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
/// ...
|
||||||
|
/// </example>
|
||||||
|
/// <param name="palette"></param>
|
||||||
|
/// <param name="outputFile"></param>
|
||||||
|
public static void UpdatePacketIdByItemPosition(PacketTypePalette palette, string outputFile)
|
||||||
|
{
|
||||||
|
// I am just too tired to create another full .cs file so... please just copy and paste
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
lines.Add("=== Inbound Packets ===");
|
||||||
|
int i = 0;
|
||||||
|
foreach(var t in palette.GetMappingIn())
|
||||||
|
{
|
||||||
|
lines.Add(string.Format("{{ 0x{0}, {1} }},", i.ToString("X2"), t.Value));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
lines.Add("=== End of Inbound ===");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add("=== Outbound Packets ===");
|
||||||
|
i = 0;
|
||||||
|
foreach (var t in palette.GetMappingOut())
|
||||||
|
{
|
||||||
|
lines.Add(string.Format("{{ 0x{0}, {1} }},", i.ToString("X2"), t.Value));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
lines.Add("=== End of Outbound ===");
|
||||||
|
|
||||||
|
File.WriteAllText(outputFile, string.Join("\r\n", lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a code snippet of rearranged order of packet types from a modified packet palette (usually when you have updated packet IDs)
|
||||||
|
/// </summary>
|
||||||
|
/// <example>
|
||||||
|
/// You have changed some packet IDs:
|
||||||
|
/// { 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
/// { 0x02, PacketTypesIn.SpawnExperienceOrb }, // ID changed from 0x02 -> 0x01
|
||||||
|
/// { 0x01, PacketTypesIn.SpawnWeatherEntity }, // ID changed from 0x01 -> 0x02
|
||||||
|
/// ...
|
||||||
|
///
|
||||||
|
/// Call this method with your new packet palette:
|
||||||
|
/// UpdatePacketPositionToAscending(new PacketPaletteXXXX(), "code_snippet.txt");
|
||||||
|
/// And it will generate a Dictionary format with the ascending order of Packet IDs for you to copy and paste:
|
||||||
|
/// { 0x00, PacketTypesIn.SpawnEntity },
|
||||||
|
/// { 0x01, PacketTypesIn.SpawnWeatherEntity },
|
||||||
|
/// { 0x02, PacketTypesIn.SpawnExperienceOrb },
|
||||||
|
/// ...
|
||||||
|
/// </example>
|
||||||
|
/// <param name="palette"></param>
|
||||||
|
/// <param name="outputFile"></param>
|
||||||
|
public static void UpdatePacketPositionToAscending(PacketTypePalette palette, string outputFile)
|
||||||
|
{
|
||||||
|
// I am just too tired to create another full .cs file so... please just copy and paste
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
lines.Add("=== Inbound Packets ===");
|
||||||
|
for (int i = 0; i < palette.GetMappingIn().Count; i++)
|
||||||
|
{
|
||||||
|
lines.Add(string.Format("{{ 0x{0}, {1} }},", i.ToString("X2"), palette.GetMappingIn()[i]));
|
||||||
|
}
|
||||||
|
lines.Add("=== End of Inbound ===");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add("=== Outbound Packets ===");
|
||||||
|
for (int i = 0; i < palette.GetMappingOut().Count; i++)
|
||||||
|
{
|
||||||
|
lines.Add(string.Format("{{ 0x{0}, {1} }},", i.ToString("X2"), palette.GetMappingOut()[i]));
|
||||||
|
}
|
||||||
|
lines.Add("=== End of Outbound ===");
|
||||||
|
|
||||||
|
File.WriteAllText(outputFile, string.Join("\r\n", lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate PacketPaletteXXX.cs by feeding PacketTypesIn and PacketTypesOut list
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outputFile">The output file name</param>
|
||||||
|
/// <param name="namespaceToUse">The namespace to use in the generated class</param>
|
||||||
|
/// <param name="className">Class name</param>
|
||||||
|
/// <param name="pIn">List of PacketTypesIn</param>
|
||||||
|
/// <param name="pOut">List of PacketTypesOut</param>
|
||||||
|
/// <example>
|
||||||
|
/// You need to make sure the order of each item are all correct for that MC version
|
||||||
|
/// Example format:
|
||||||
|
/// List<PacketTypesIn> pIn = new List<PacketTypesIn>()
|
||||||
|
/// {
|
||||||
|
/// PacketTypesIn.SpawnEntity, // packet ID of 0x00
|
||||||
|
/// PacketTypesIn.SpawnExperienceOrb, // packet ID of 0x01 and so on
|
||||||
|
/// ...
|
||||||
|
/// }
|
||||||
|
/// </example>
|
||||||
|
public static void GenerateIDsPacketByList(string outputFile, string namespaceToUse, string className, List<PacketTypesIn> pIn, List<PacketTypesOut> pOut)
|
||||||
|
{
|
||||||
|
const string TAB = " ";
|
||||||
|
const string TAB2 = " ";
|
||||||
|
const string TAB3 = " ";
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
lines.Add("using System;");
|
||||||
|
lines.Add("using System.Collections.Generic;");
|
||||||
|
lines.Add("using System.Linq;");
|
||||||
|
lines.Add("using System.Text;");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add("namespace " + namespaceToUse);
|
||||||
|
lines.Add("{");
|
||||||
|
lines.Add(TAB + "public class " + className + " : PacketTypePalette");
|
||||||
|
lines.Add(TAB + "{");
|
||||||
|
lines.Add(TAB2 + "private Dictionary<int, PacketTypesIn> typeIn = new Dictionary<int, PacketTypesIn>()");
|
||||||
|
lines.Add(TAB2 + "{");
|
||||||
|
for (int i = 0; i < pIn.Count; i++)
|
||||||
|
{
|
||||||
|
lines.Add(TAB3 + string.Format("{{ 0x{0}, PacketTypesIn.{1} }},", i.ToString("X2"), pIn[i]));
|
||||||
|
}
|
||||||
|
lines.Add(TAB2 + "};");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add(TAB2 + "private Dictionary<int, PacketTypesOut> typeOut = new Dictionary<int, PacketTypesOut>()");
|
||||||
|
lines.Add(TAB2 + "{");
|
||||||
|
for (int i = 0; i < pOut.Count; i++)
|
||||||
|
{
|
||||||
|
lines.Add(TAB3 + string.Format("{{ 0x{0}, PacketTypesOut.{1} }},", i.ToString("X2"), pOut[i]));
|
||||||
|
}
|
||||||
|
lines.Add(TAB2 + "};");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add(TAB2 + "protected override Dictionary<int, PacketTypesIn> GetListIn()");
|
||||||
|
lines.Add(TAB2 + "{");
|
||||||
|
lines.Add(TAB3 + "return typeIn;");
|
||||||
|
lines.Add(TAB2 + "}");
|
||||||
|
lines.Add("");
|
||||||
|
lines.Add(TAB2 + "protected override Dictionary<int, PacketTypesOut> GetListOut()");
|
||||||
|
lines.Add(TAB2 + "{");
|
||||||
|
lines.Add(TAB3 + "return typeOut;");
|
||||||
|
lines.Add(TAB2 + "}");
|
||||||
|
lines.Add(TAB + "}");
|
||||||
|
lines.Add("}");
|
||||||
|
lines.Add("");
|
||||||
|
|
||||||
|
File.WriteAllText(outputFile, string.Join("\r\n", lines));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Packet type palette
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Steps for implementing palette for new Minecraft version:
|
||||||
|
/// 1. Check out https://wiki.vg/Pre-release_protocol to see if there is any packet got added/removed
|
||||||
|
/// 2. Add new packet type to PacketTypesIn.cs and PacketTypesOut.cs (if any)
|
||||||
|
/// 3. Create a new PacketPaletteXXX.cs by copying the latest version of existing PacketPaletteXXX.cs (could reduce massive works on writing a brand new one)
|
||||||
|
/// 4. Apply change to the copied PacketPaletteXXX.cs by either:
|
||||||
|
/// - Inserting new packet type to the correct position
|
||||||
|
/// - Removing packet type that got deleted
|
||||||
|
/// OR
|
||||||
|
/// - Changing the packet IDs manually
|
||||||
|
/// 5. Use PacketPaletteHelper to generate a code snippet and copy the generated code snippet back to PacketPaletteXXX.cs
|
||||||
|
/// - Use UpdatePacketPositionToAscending() if you changed the packet IDs manually
|
||||||
|
/// - Use UpdatePacketIdByItemPosition() if you inserted some packet type into the dictionary
|
||||||
|
/// Simply add the method call in Program.cs and run the program once. The code snippet will be generated
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// The way how Mojang change the packet ID is simple:
|
||||||
|
/// * Either adding/removing a packet from middle and cause packet ID below it get shifted
|
||||||
|
/// * Append a new packet at the end (but this is rare)
|
||||||
|
/// </remarks>
|
||||||
|
public abstract class PacketTypePalette
|
||||||
|
{
|
||||||
|
protected abstract Dictionary<int, PacketTypesIn> GetListIn();
|
||||||
|
protected abstract Dictionary<int, PacketTypesOut> GetListOut();
|
||||||
|
|
||||||
|
private Dictionary<PacketTypesIn, int> reverseMappingIn = new Dictionary<PacketTypesIn, int>();
|
||||||
|
|
||||||
|
private Dictionary<PacketTypesOut, int> reverseMappingOut = new Dictionary<PacketTypesOut, int>();
|
||||||
|
|
||||||
|
public PacketTypePalette()
|
||||||
|
{
|
||||||
|
foreach (var p in GetListIn())
|
||||||
|
{
|
||||||
|
reverseMappingIn.Add(p.Value, p.Key);
|
||||||
|
}
|
||||||
|
foreach (var p in GetListOut())
|
||||||
|
{
|
||||||
|
reverseMappingOut.Add(p.Value, p.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get incomming packet type by packet ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packetId">packet ID</param>
|
||||||
|
/// <returns>Packet type</returns>
|
||||||
|
public PacketTypesIn GetIncommingTypeById(int packetId)
|
||||||
|
{
|
||||||
|
return GetListIn()[packetId];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get incomming packet ID by packet type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packetType">Packet type</param>
|
||||||
|
/// <returns>packet ID</returns>
|
||||||
|
public int GetIncommingIdByType(PacketTypesIn packetType)
|
||||||
|
{
|
||||||
|
return reverseMappingIn[packetType];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get outgoing packet type by packet ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packetId">Packet ID</param>
|
||||||
|
/// <returns>Packet type</returns>
|
||||||
|
public PacketTypesOut GetOutgoingTypeById(int packetId)
|
||||||
|
{
|
||||||
|
return GetListOut()[packetId];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get outgoing packet ID by packet type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packetType">Packet type</param>
|
||||||
|
/// <returns>Packet ID</returns>
|
||||||
|
public int GetOutgoingIdByType(PacketTypesOut packetType)
|
||||||
|
{
|
||||||
|
return reverseMappingOut[packetType];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Public method for getting the type mapping
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>PacketTypesIn with packet ID as index</returns>
|
||||||
|
public Dictionary<int, PacketTypesIn> GetMappingIn()
|
||||||
|
{
|
||||||
|
return GetListIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Public method for getting the type mapping
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>PacketTypesOut with packet ID as index</returns>
|
||||||
|
public Dictionary<int ,PacketTypesOut> GetMappingOut()
|
||||||
|
{
|
||||||
|
return GetListOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
63
MinecraftClient/Protocol/Handlers/PacketType18Handler.cs
Normal file
63
MinecraftClient/Protocol/Handlers/PacketType18Handler.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using MinecraftClient.Protocol.Handlers;
|
||||||
|
using MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers
|
||||||
|
{
|
||||||
|
public class PacketTypeHandler
|
||||||
|
{
|
||||||
|
private int protocol;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize the handler
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocol">Protocol version to use</param>
|
||||||
|
public PacketTypeHandler(int protocol)
|
||||||
|
{
|
||||||
|
this.protocol = protocol;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize the handler
|
||||||
|
/// </summary>
|
||||||
|
public PacketTypeHandler() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the packet type palette
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PacketTypePalette GetTypeHandler()
|
||||||
|
{
|
||||||
|
return GetTypeHandler(this.protocol);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get the packet type palette
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocol">Protocol version to use</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PacketTypePalette GetTypeHandler(int protocol)
|
||||||
|
{
|
||||||
|
if (protocol > Protocol18Handler.MC1162Version)
|
||||||
|
throw new NotImplementedException("Please update packet type palette for this Minecraft version. See PacketTypePalette.cs");
|
||||||
|
if (protocol <= Protocol18Handler.MC18Version)
|
||||||
|
return new PacketPalette17();
|
||||||
|
else if (protocol <= Protocol18Handler.MC1112Version)
|
||||||
|
return new PacketPalette110();
|
||||||
|
else if (protocol <= Protocol18Handler.MC112Version)
|
||||||
|
return new PacketPalette112();
|
||||||
|
else if (protocol <= Protocol18Handler.MC1122Version)
|
||||||
|
return new PacketPalette1122();
|
||||||
|
else if (protocol <= Protocol18Handler.MC114Version)
|
||||||
|
return new PacketPalette113();
|
||||||
|
else if (protocol <= Protocol18Handler.MC115Version)
|
||||||
|
return new PacketPalette114();
|
||||||
|
else if (protocol <= Protocol18Handler.MC1152Version)
|
||||||
|
return new PacketPalette115();
|
||||||
|
else if (protocol <= Protocol18Handler.MC1161Version)
|
||||||
|
return new PacketPalette116();
|
||||||
|
else return new PacketPalette1162();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
113
MinecraftClient/Protocol/Handlers/PacketTypesIn.cs
Normal file
113
MinecraftClient/Protocol/Handlers/PacketTypesIn.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Incomming packet types
|
||||||
|
/// </summary>
|
||||||
|
public enum PacketTypesIn
|
||||||
|
{
|
||||||
|
SpawnEntity,
|
||||||
|
SpawnExperienceOrb,
|
||||||
|
SpawnWeatherEntity,
|
||||||
|
SpawnLivingEntity,
|
||||||
|
SpawnPainting,
|
||||||
|
SpawnPlayer,
|
||||||
|
EntityAnimation,
|
||||||
|
Statistics,
|
||||||
|
AcknowledgePlayerDigging,
|
||||||
|
BlockBreakAnimation,
|
||||||
|
BlockEntityData,
|
||||||
|
BlockAction,
|
||||||
|
BlockChange,
|
||||||
|
BossBar,
|
||||||
|
ServerDifficulty,
|
||||||
|
ChatMessage,
|
||||||
|
MultiBlockChange,
|
||||||
|
TabComplete,
|
||||||
|
DeclareCommands,
|
||||||
|
WindowConfirmation,
|
||||||
|
CloseWindow,
|
||||||
|
WindowItems,
|
||||||
|
WindowProperty,
|
||||||
|
SetSlot,
|
||||||
|
SetCooldown,
|
||||||
|
PluginMessage,
|
||||||
|
NamedSoundEffect,
|
||||||
|
Disconnect,
|
||||||
|
EntityStatus,
|
||||||
|
Explosion,
|
||||||
|
UnloadChunk,
|
||||||
|
ChangeGameState,
|
||||||
|
OpenHorseWindow,
|
||||||
|
KeepAlive,
|
||||||
|
ChunkData,
|
||||||
|
Effect,
|
||||||
|
Particle,
|
||||||
|
UpdateLight,
|
||||||
|
JoinGame,
|
||||||
|
MapData,
|
||||||
|
TradeList,
|
||||||
|
EntityPosition,
|
||||||
|
EntityPositionAndRotation,
|
||||||
|
EntityRotation,
|
||||||
|
EntityMovement,
|
||||||
|
VehicleMove,
|
||||||
|
OpenBook,
|
||||||
|
OpenWindow,
|
||||||
|
OpenSignEditor,
|
||||||
|
CraftRecipeResponse,
|
||||||
|
PlayerAbilities,
|
||||||
|
CombatEvent,
|
||||||
|
PlayerInfo,
|
||||||
|
FacePlayer,
|
||||||
|
PlayerPositionAndLook,
|
||||||
|
UnlockRecipes,
|
||||||
|
DestroyEntities,
|
||||||
|
RemoveEntityEffect,
|
||||||
|
ResourcePackSend,
|
||||||
|
Respawn,
|
||||||
|
EntityHeadLook,
|
||||||
|
SelectAdvancementTab,
|
||||||
|
WorldBorder,
|
||||||
|
Camera,
|
||||||
|
HeldItemChange,
|
||||||
|
UpdateViewPosition,
|
||||||
|
UpdateViewDistance,
|
||||||
|
DisplayScoreboard,
|
||||||
|
EntityMetadata,
|
||||||
|
AttachEntity,
|
||||||
|
EntityVelocity,
|
||||||
|
EntityEquipment,
|
||||||
|
SetExperience,
|
||||||
|
UpdateHealth,
|
||||||
|
ScoreboardObjective,
|
||||||
|
SetPassengers,
|
||||||
|
Teams,
|
||||||
|
UpdateScore,
|
||||||
|
SpawnPosition,
|
||||||
|
TimeUpdate,
|
||||||
|
Title,
|
||||||
|
EntitySoundEffect,
|
||||||
|
SoundEffect,
|
||||||
|
StopSound,
|
||||||
|
PlayerListHeaderAndFooter,
|
||||||
|
NBTQueryResponse,
|
||||||
|
CollectItem,
|
||||||
|
EntityTeleport,
|
||||||
|
Advancements,
|
||||||
|
EntityProperties,
|
||||||
|
EntityEffect,
|
||||||
|
DeclareRecipes,
|
||||||
|
Tags,
|
||||||
|
UseBed, // For 1.13.2 or below
|
||||||
|
MapChunkBulk, // For 1.8 or below
|
||||||
|
SetCompression, // For 1.8 or below
|
||||||
|
UpdateSign, // For 1.8 or below
|
||||||
|
UpdateEntityNBT, // For 1.8 or below
|
||||||
|
Unknown, // For old version packet that have been removed and not used by mcc
|
||||||
|
}
|
||||||
|
}
|
||||||
66
MinecraftClient/Protocol/Handlers/PacketTypesOut.cs
Normal file
66
MinecraftClient/Protocol/Handlers/PacketTypesOut.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Outgoing packet types
|
||||||
|
/// </summary>
|
||||||
|
public enum PacketTypesOut
|
||||||
|
{
|
||||||
|
TeleportConfirm,
|
||||||
|
QueryBlockNBT,
|
||||||
|
SetDifficulty,
|
||||||
|
ChatMessage,
|
||||||
|
ClientStatus,
|
||||||
|
ClientSettings,
|
||||||
|
TabComplete,
|
||||||
|
WindowConfirmation,
|
||||||
|
ClickWindowButton,
|
||||||
|
ClickWindow,
|
||||||
|
CloseWindow,
|
||||||
|
PluginMessage,
|
||||||
|
EditBook,
|
||||||
|
EntityNBTRequest,
|
||||||
|
InteractEntity,
|
||||||
|
KeepAlive,
|
||||||
|
LockDifficulty,
|
||||||
|
PlayerPosition,
|
||||||
|
PlayerPositionAndRotation,
|
||||||
|
PlayerRotation,
|
||||||
|
PlayerMovement,
|
||||||
|
VehicleMove,
|
||||||
|
SteerBoat,
|
||||||
|
PickItem,
|
||||||
|
CraftRecipeRequest,
|
||||||
|
PlayerAbilities,
|
||||||
|
PlayerDigging,
|
||||||
|
EntityAction,
|
||||||
|
SteerVehicle,
|
||||||
|
RecipeBookData,
|
||||||
|
NameItem,
|
||||||
|
ResourcePackStatus,
|
||||||
|
AdvancementTab,
|
||||||
|
SelectTrade,
|
||||||
|
SetBeaconEffect,
|
||||||
|
HeldItemChange,
|
||||||
|
UpdateCommandBlock,
|
||||||
|
UpdateCommandBlockMinecart,
|
||||||
|
CreativeInventoryAction,
|
||||||
|
UpdateJigsawBlock,
|
||||||
|
UpdateStructureBlock,
|
||||||
|
UpdateSign,
|
||||||
|
Animation,
|
||||||
|
Spectate,
|
||||||
|
PlayerBlockPlacement,
|
||||||
|
UseItem,
|
||||||
|
PrepareCraftingGrid, // For 1.12 - 1.12.1 only
|
||||||
|
EnchantItem, // For 1.13.2 or below
|
||||||
|
GenerateStructure, // Added in 1.16
|
||||||
|
SetDisplayedRecipe, // Added in 1.16.2
|
||||||
|
SetRecipeBookState, // Added in 1.16.2
|
||||||
|
Unknown // For old version packet that have been removed and not used by mcc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ using System.Windows.Forms;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using MinecraftClient.Inventory.ItemPalettes;
|
using MinecraftClient.Inventory.ItemPalettes;
|
||||||
|
using MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||||
|
|
||||||
namespace MinecraftClient.Protocol.Handlers
|
namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
|
|
@ -26,7 +27,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// Typical update steps for implementing protocol changes for a new Minecraft version:
|
/// Typical update steps for implementing protocol changes for a new Minecraft version:
|
||||||
/// - Perform a diff between latest supported version in MCC and new stable version to support on https://wiki.vg/Protocol
|
/// - Perform a diff between latest supported version in MCC and new stable version to support on https://wiki.vg/Protocol
|
||||||
/// - If there are any changes in packets implemented by MCC, add MCXXXVersion field below and implement new packet layouts
|
/// - If there are any changes in packets implemented by MCC, add MCXXXVersion field below and implement new packet layouts
|
||||||
/// - If packet IDs were changed, also update getPacketIncomingType() and getPacketOutgoingID() inside Protocol18PacketTypes.cs
|
/// - Add the packet type palette for that Minecraft version. Please see PacketTypePalette.cs for more information
|
||||||
/// - Also see Material.cs and ItemType.cs for updating block and item data inside MCC
|
/// - Also see Material.cs and ItemType.cs for updating block and item data inside MCC
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
class Protocol18Handler : IMinecraftCom
|
class Protocol18Handler : IMinecraftCom
|
||||||
|
|
@ -60,6 +61,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
IMinecraftComHandler handler;
|
IMinecraftComHandler handler;
|
||||||
EntityPalette entityPalette;
|
EntityPalette entityPalette;
|
||||||
ItemPalette itemPalette;
|
ItemPalette itemPalette;
|
||||||
|
PacketTypePalette packetPalette;
|
||||||
SocketWrapper socketWrapper;
|
SocketWrapper socketWrapper;
|
||||||
DataTypes dataTypes;
|
DataTypes dataTypes;
|
||||||
Thread netRead;
|
Thread netRead;
|
||||||
|
|
@ -74,6 +76,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.pForge = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
|
this.pForge = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
|
||||||
this.pTerrain = new Protocol18Terrain(protocolVersion, dataTypes, handler);
|
this.pTerrain = new Protocol18Terrain(protocolVersion, dataTypes, handler);
|
||||||
|
this.packetPalette = new PacketTypeHandler(protocolVersion).GetTypeHandler();
|
||||||
|
|
||||||
if (handler.GetTerrainEnabled() && protocolversion > MC1152Version)
|
if (handler.GetTerrainEnabled() && protocolversion > MC1152Version)
|
||||||
{
|
{
|
||||||
|
|
@ -241,13 +244,13 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Regular in-game packets
|
// Regular in-game packets
|
||||||
else switch (Protocol18PacketTypes.GetPacketIncomingType(packetID, protocolversion))
|
else switch (packetPalette.GetIncommingTypeById(packetID))
|
||||||
{
|
{
|
||||||
case PacketIncomingType.KeepAlive:
|
case PacketTypesIn.KeepAlive:
|
||||||
SendPacket(PacketOutgoingType.KeepAlive, packetData);
|
SendPacket(PacketTypesOut.KeepAlive, packetData);
|
||||||
handler.OnServerKeepAlive();
|
handler.OnServerKeepAlive();
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.JoinGame:
|
case PacketTypesIn.JoinGame:
|
||||||
handler.OnGameJoined();
|
handler.OnGameJoined();
|
||||||
int playerEntityID = dataTypes.ReadNextInt(packetData);
|
int playerEntityID = dataTypes.ReadNextInt(packetData);
|
||||||
handler.OnReceivePlayerEntityID(playerEntityID);
|
handler.OnReceivePlayerEntityID(playerEntityID);
|
||||||
|
|
@ -308,7 +311,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above
|
dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.ChatMessage:
|
case PacketTypesIn.ChatMessage:
|
||||||
string message = dataTypes.ReadNextString(packetData);
|
string message = dataTypes.ReadNextString(packetData);
|
||||||
if (protocolversion >= MC18Version)
|
if (protocolversion >= MC18Version)
|
||||||
{
|
{
|
||||||
|
|
@ -320,7 +323,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
handler.OnTextReceived(message, true);
|
handler.OnTextReceived(message, true);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.Respawn:
|
case PacketTypesIn.Respawn:
|
||||||
if (protocolversion >= MC116Version)
|
if (protocolversion >= MC116Version)
|
||||||
{
|
{
|
||||||
// TODO handle dimensions for 1.16+, needed for terrain handling
|
// TODO handle dimensions for 1.16+, needed for terrain handling
|
||||||
|
|
@ -351,7 +354,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
handler.OnRespawn();
|
handler.OnRespawn();
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.PlayerPositionAndLook:
|
case PacketTypesIn.PlayerPositionAndLook:
|
||||||
// These always need to be read, since we need the field after them for teleport confirm
|
// These always need to be read, since we need the field after them for teleport confirm
|
||||||
double x = dataTypes.ReadNextDouble(packetData);
|
double x = dataTypes.ReadNextDouble(packetData);
|
||||||
double y = dataTypes.ReadNextDouble(packetData);
|
double y = dataTypes.ReadNextDouble(packetData);
|
||||||
|
|
@ -378,10 +381,10 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
int teleportID = dataTypes.ReadNextVarInt(packetData);
|
int teleportID = dataTypes.ReadNextVarInt(packetData);
|
||||||
// Teleport confirm packet
|
// Teleport confirm packet
|
||||||
SendPacket(PacketOutgoingType.TeleportConfirm, dataTypes.GetVarInt(teleportID));
|
SendPacket(PacketTypesOut.TeleportConfirm, dataTypes.GetVarInt(teleportID));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.ChunkData:
|
case PacketTypesIn.ChunkData:
|
||||||
if (handler.GetTerrainEnabled())
|
if (handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
int chunkX = dataTypes.ReadNextInt(packetData);
|
int chunkX = dataTypes.ReadNextInt(packetData);
|
||||||
|
|
@ -409,7 +412,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.MapData:
|
case PacketTypesIn.MapData:
|
||||||
int mapid = dataTypes.ReadNextVarInt(packetData);
|
int mapid = dataTypes.ReadNextVarInt(packetData);
|
||||||
byte scale = dataTypes.ReadNextByte(packetData);
|
byte scale = dataTypes.ReadNextByte(packetData);
|
||||||
bool trackingposition = dataTypes.ReadNextBool(packetData);
|
bool trackingposition = dataTypes.ReadNextBool(packetData);
|
||||||
|
|
@ -421,7 +424,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
int iconcount = dataTypes.ReadNextVarInt(packetData);
|
int iconcount = dataTypes.ReadNextVarInt(packetData);
|
||||||
handler.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
handler.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.Title:
|
case PacketTypesIn.Title:
|
||||||
if (protocolversion >= MC18Version)
|
if (protocolversion >= MC18Version)
|
||||||
{
|
{
|
||||||
int action2 = dataTypes.ReadNextVarInt(packetData);
|
int action2 = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -478,7 +481,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnTitle(action2, titletext, subtitletext, actionbartext, fadein, stay, fadeout, json);
|
handler.OnTitle(action2, titletext, subtitletext, actionbartext, fadein, stay, fadeout, json);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.MultiBlockChange:
|
case PacketTypesIn.MultiBlockChange:
|
||||||
if (handler.GetTerrainEnabled())
|
if (handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
int chunkX = dataTypes.ReadNextInt(packetData);
|
int chunkX = dataTypes.ReadNextInt(packetData);
|
||||||
|
|
@ -513,7 +516,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.BlockChange:
|
case PacketTypesIn.BlockChange:
|
||||||
if (handler.GetTerrainEnabled())
|
if (handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
if (protocolversion < MC18Version)
|
if (protocolversion < MC18Version)
|
||||||
|
|
@ -528,7 +531,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
else handler.GetWorld().SetBlock(dataTypes.ReadNextLocation(packetData), new Block((ushort)dataTypes.ReadNextVarInt(packetData)));
|
else handler.GetWorld().SetBlock(dataTypes.ReadNextLocation(packetData), new Block((ushort)dataTypes.ReadNextVarInt(packetData)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.MapChunkBulk:
|
case PacketTypesIn.MapChunkBulk:
|
||||||
if (protocolversion < MC19Version && handler.GetTerrainEnabled())
|
if (protocolversion < MC19Version && handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
int chunkCount;
|
int chunkCount;
|
||||||
|
|
@ -571,7 +574,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
pTerrain.ProcessChunkColumnData(chunkXs[chunkColumnNo], chunkZs[chunkColumnNo], chunkMasks[chunkColumnNo], addBitmaps[chunkColumnNo], hasSkyLight, true, currentDimension, chunkData);
|
pTerrain.ProcessChunkColumnData(chunkXs[chunkColumnNo], chunkZs[chunkColumnNo], chunkMasks[chunkColumnNo], addBitmaps[chunkColumnNo], hasSkyLight, true, currentDimension, chunkData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.UnloadChunk:
|
case PacketTypesIn.UnloadChunk:
|
||||||
if (protocolversion >= MC19Version && handler.GetTerrainEnabled())
|
if (protocolversion >= MC19Version && handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
int chunkX = dataTypes.ReadNextInt(packetData);
|
int chunkX = dataTypes.ReadNextInt(packetData);
|
||||||
|
|
@ -579,7 +582,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.GetWorld()[chunkX, chunkZ] = null;
|
handler.GetWorld()[chunkX, chunkZ] = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.PlayerListUpdate:
|
case PacketTypesIn.PlayerInfo:
|
||||||
if (protocolversion >= MC18Version)
|
if (protocolversion >= MC18Version)
|
||||||
{
|
{
|
||||||
int action = dataTypes.ReadNextVarInt(packetData);
|
int action = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -636,7 +639,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
else handler.OnPlayerLeave(FakeUUID);
|
else handler.OnPlayerLeave(FakeUUID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.TabCompleteResult:
|
case PacketTypesIn.TabComplete:
|
||||||
if (protocolversion >= MC113Version)
|
if (protocolversion >= MC113Version)
|
||||||
{
|
{
|
||||||
autocomplete_transaction_id = dataTypes.ReadNextVarInt(packetData);
|
autocomplete_transaction_id = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -660,21 +663,21 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
|
|
||||||
autocomplete_received = true;
|
autocomplete_received = true;
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.PluginMessage:
|
case PacketTypesIn.PluginMessage:
|
||||||
String channel = dataTypes.ReadNextString(packetData);
|
String channel = dataTypes.ReadNextString(packetData);
|
||||||
// Length is unneeded as the whole remaining packetData is the entire payload of the packet.
|
// Length is unneeded as the whole remaining packetData is the entire payload of the packet.
|
||||||
if (protocolversion < MC18Version)
|
if (protocolversion < MC18Version)
|
||||||
pForge.ReadNextVarShort(packetData);
|
pForge.ReadNextVarShort(packetData);
|
||||||
handler.OnPluginChannelMessage(channel, packetData.ToArray());
|
handler.OnPluginChannelMessage(channel, packetData.ToArray());
|
||||||
return pForge.HandlePluginMessage(channel, packetData, ref currentDimension);
|
return pForge.HandlePluginMessage(channel, packetData, ref currentDimension);
|
||||||
case PacketIncomingType.KickPacket:
|
case PacketTypesIn.Disconnect:
|
||||||
handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick, ChatParser.ParseText(dataTypes.ReadNextString(packetData)));
|
handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick, ChatParser.ParseText(dataTypes.ReadNextString(packetData)));
|
||||||
return false;
|
return false;
|
||||||
case PacketIncomingType.NetworkCompressionTreshold:
|
case PacketTypesIn.SetCompression:
|
||||||
if (protocolversion >= MC18Version && protocolversion < MC19Version)
|
if (protocolversion >= MC18Version && protocolversion < MC19Version)
|
||||||
compression_treshold = dataTypes.ReadNextVarInt(packetData);
|
compression_treshold = dataTypes.ReadNextVarInt(packetData);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.OpenWindow:
|
case PacketTypesIn.OpenWindow:
|
||||||
if (handler.GetInventoryEnabled())
|
if (handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
if (protocolversion < MC114Version)
|
if (protocolversion < MC114Version)
|
||||||
|
|
@ -699,7 +702,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.CloseWindow:
|
case PacketTypesIn.CloseWindow:
|
||||||
if (handler.GetInventoryEnabled())
|
if (handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
byte windowID = dataTypes.ReadNextByte(packetData);
|
byte windowID = dataTypes.ReadNextByte(packetData);
|
||||||
|
|
@ -707,7 +710,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnInventoryClose(windowID);
|
handler.OnInventoryClose(windowID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.WindowItems:
|
case PacketTypesIn.WindowItems:
|
||||||
if (handler.GetInventoryEnabled())
|
if (handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
byte windowId = dataTypes.ReadNextByte(packetData);
|
byte windowId = dataTypes.ReadNextByte(packetData);
|
||||||
|
|
@ -722,7 +725,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnWindowItems(windowId, inventorySlots);
|
handler.OnWindowItems(windowId, inventorySlots);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.SetSlot:
|
case PacketTypesIn.SetSlot:
|
||||||
if (handler.GetInventoryEnabled())
|
if (handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
byte windowID = dataTypes.ReadNextByte(packetData);
|
byte windowID = dataTypes.ReadNextByte(packetData);
|
||||||
|
|
@ -731,7 +734,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnSetSlot(windowID, slotID, item);
|
handler.OnSetSlot(windowID, slotID, item);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.WindowConfirmation:
|
case PacketTypesIn.WindowConfirmation:
|
||||||
if (handler.GetInventoryEnabled())
|
if (handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
byte windowID = dataTypes.ReadNextByte(packetData);
|
byte windowID = dataTypes.ReadNextByte(packetData);
|
||||||
|
|
@ -743,7 +746,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.ResourcePackSend:
|
case PacketTypesIn.ResourcePackSend:
|
||||||
string url = dataTypes.ReadNextString(packetData);
|
string url = dataTypes.ReadNextString(packetData);
|
||||||
string hash = dataTypes.ReadNextString(packetData);
|
string hash = dataTypes.ReadNextString(packetData);
|
||||||
// Some server plugins may send invalid resource packs to probe the client and we need to ignore them (issue #1056)
|
// Some server plugins may send invalid resource packs to probe the client and we need to ignore them (issue #1056)
|
||||||
|
|
@ -753,17 +756,17 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
byte[] responseHeader = new byte[0];
|
byte[] responseHeader = new byte[0];
|
||||||
if (protocolversion < MC110Version) //MC 1.10 does not include resource pack hash in responses
|
if (protocolversion < MC110Version) //MC 1.10 does not include resource pack hash in responses
|
||||||
responseHeader = dataTypes.ConcatBytes(dataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash));
|
responseHeader = dataTypes.ConcatBytes(dataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash));
|
||||||
SendPacket(PacketOutgoingType.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack
|
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack
|
||||||
SendPacket(PacketOutgoingType.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded
|
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.SpawnEntity:
|
case PacketTypesIn.SpawnEntity:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, false);
|
Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, false);
|
||||||
handler.OnSpawnEntity(entity);
|
handler.OnSpawnEntity(entity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityEquipment:
|
case PacketTypesIn.EntityEquipment:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int entityid = dataTypes.ReadNextVarInt(packetData);
|
int entityid = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -788,7 +791,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.SpawnLivingEntity:
|
case PacketTypesIn.SpawnLivingEntity:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, true);
|
Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, true);
|
||||||
|
|
@ -798,7 +801,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnSpawnEntity(entity);
|
handler.OnSpawnEntity(entity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.SpawnPlayer:
|
case PacketTypesIn.SpawnPlayer:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -814,7 +817,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnSpawnPlayer(EntityID, UUID, EntityLocation, Yaw, Pitch);
|
handler.OnSpawnPlayer(EntityID, UUID, EntityLocation, Yaw, Pitch);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityEffect:
|
case PacketTypesIn.EntityEffect:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int entityid = dataTypes.ReadNextVarInt(packetData);
|
int entityid = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -828,7 +831,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.DestroyEntities:
|
case PacketTypesIn.DestroyEntities:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityCount = dataTypes.ReadNextVarInt(packetData);
|
int EntityCount = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -840,7 +843,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnDestroyEntities(EntitiesList);
|
handler.OnDestroyEntities(EntitiesList);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityPosition:
|
case PacketTypesIn.EntityPosition:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -854,7 +857,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround);
|
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityPositionAndRotation:
|
case PacketTypesIn.EntityPositionAndRotation:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -870,7 +873,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround);
|
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityProperties:
|
case PacketTypesIn.EntityProperties:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -905,7 +908,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnEntityProperties(EntityID, keys);
|
handler.OnEntityProperties(EntityID, keys);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityMetadata:
|
case PacketTypesIn.EntityMetadata:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -916,12 +919,12 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnEntityMetadata(EntityID, metadata);
|
handler.OnEntityMetadata(EntityID, metadata);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.TimeUpdate:
|
case PacketTypesIn.TimeUpdate:
|
||||||
long WorldAge = dataTypes.ReadNextLong(packetData);
|
long WorldAge = dataTypes.ReadNextLong(packetData);
|
||||||
long TimeOfday = dataTypes.ReadNextLong(packetData);
|
long TimeOfday = dataTypes.ReadNextLong(packetData);
|
||||||
handler.OnTimeUpdate(WorldAge, TimeOfday);
|
handler.OnTimeUpdate(WorldAge, TimeOfday);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.EntityTeleport:
|
case PacketTypesIn.EntityTeleport:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
|
@ -934,7 +937,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnEntityTeleport(EntityID, X, Y, Z, OnGround);
|
handler.OnEntityTeleport(EntityID, X, Y, Z, OnGround);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.UpdateHealth:
|
case PacketTypesIn.UpdateHealth:
|
||||||
float health = dataTypes.ReadNextFloat(packetData);
|
float health = dataTypes.ReadNextFloat(packetData);
|
||||||
int food;
|
int food;
|
||||||
if (protocolversion >= MC18Version)
|
if (protocolversion >= MC18Version)
|
||||||
|
|
@ -944,24 +947,24 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
dataTypes.ReadNextFloat(packetData); // Food Saturation
|
dataTypes.ReadNextFloat(packetData); // Food Saturation
|
||||||
handler.OnUpdateHealth(health, food);
|
handler.OnUpdateHealth(health, food);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.SetExperience:
|
case PacketTypesIn.SetExperience:
|
||||||
float experiencebar = dataTypes.ReadNextFloat(packetData);
|
float experiencebar = dataTypes.ReadNextFloat(packetData);
|
||||||
int level = dataTypes.ReadNextVarInt(packetData);
|
int level = dataTypes.ReadNextVarInt(packetData);
|
||||||
int totalexperience = dataTypes.ReadNextVarInt(packetData);
|
int totalexperience = dataTypes.ReadNextVarInt(packetData);
|
||||||
handler.OnSetExperience(experiencebar, level, totalexperience);
|
handler.OnSetExperience(experiencebar, level, totalexperience);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.Explosion:
|
case PacketTypesIn.Explosion:
|
||||||
Location explosionLocation = new Location(dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData));
|
Location explosionLocation = new Location(dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData));
|
||||||
float explosionStrength = dataTypes.ReadNextFloat(packetData);
|
float explosionStrength = dataTypes.ReadNextFloat(packetData);
|
||||||
int explosionBlockCount = dataTypes.ReadNextInt(packetData);
|
int explosionBlockCount = dataTypes.ReadNextInt(packetData);
|
||||||
// Ignoring additional fields (records, pushback)
|
// Ignoring additional fields (records, pushback)
|
||||||
handler.OnExplosion(explosionLocation, explosionStrength, explosionBlockCount);
|
handler.OnExplosion(explosionLocation, explosionStrength, explosionBlockCount);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.HeldItemChange:
|
case PacketTypesIn.HeldItemChange:
|
||||||
byte slot = dataTypes.ReadNextByte(packetData);
|
byte slot = dataTypes.ReadNextByte(packetData);
|
||||||
handler.OnHeldItemChange(slot);
|
handler.OnHeldItemChange(slot);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.ScoreboardObjective:
|
case PacketTypesIn.ScoreboardObjective:
|
||||||
string objectivename = dataTypes.ReadNextString(packetData);
|
string objectivename = dataTypes.ReadNextString(packetData);
|
||||||
byte mode = dataTypes.ReadNextByte(packetData);
|
byte mode = dataTypes.ReadNextByte(packetData);
|
||||||
string objectivevalue = String.Empty;
|
string objectivevalue = String.Empty;
|
||||||
|
|
@ -973,7 +976,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
handler.OnScoreboardObjective(objectivename, mode, objectivevalue, type2);
|
handler.OnScoreboardObjective(objectivename, mode, objectivevalue, type2);
|
||||||
break;
|
break;
|
||||||
case PacketIncomingType.UpdateScore:
|
case PacketTypesIn.UpdateScore:
|
||||||
string entityname = dataTypes.ReadNextString(packetData);
|
string entityname = dataTypes.ReadNextString(packetData);
|
||||||
byte action3 = dataTypes.ReadNextByte(packetData);
|
byte action3 = dataTypes.ReadNextByte(packetData);
|
||||||
string objectivename2 = null;
|
string objectivename2 = null;
|
||||||
|
|
@ -995,7 +998,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
throw; //Thread abort or Connection lost rather than invalid data
|
throw; //Thread abort or Connection lost rather than invalid data
|
||||||
throw new System.IO.InvalidDataException(
|
throw new System.IO.InvalidDataException(
|
||||||
String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).",
|
String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).",
|
||||||
Protocol18PacketTypes.GetPacketIncomingType(packetID, protocolversion),
|
packetPalette.GetIncommingTypeById(packetID),
|
||||||
packetID,
|
packetID,
|
||||||
protocolversion,
|
protocolversion,
|
||||||
login_phase,
|
login_phase,
|
||||||
|
|
@ -1035,9 +1038,9 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packet">packet type</param>
|
/// <param name="packet">packet type</param>
|
||||||
/// <param name="packetData">packet Data</param>
|
/// <param name="packetData">packet Data</param>
|
||||||
private void SendPacket(PacketOutgoingType packet, IEnumerable<byte> packetData)
|
private void SendPacket(PacketTypesOut packet, IEnumerable<byte> packetData)
|
||||||
{
|
{
|
||||||
SendPacket(Protocol18PacketTypes.GetPacketOutgoingID(packet, protocolversion), packetData);
|
SendPacket(packetPalette.GetOutgoingIdByType(packet), packetData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1232,7 +1235,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
autocomplete_received = false;
|
autocomplete_received = false;
|
||||||
autocomplete_result.Clear();
|
autocomplete_result.Clear();
|
||||||
autocomplete_result.Add(BehindCursor);
|
autocomplete_result.Add(BehindCursor);
|
||||||
SendPacket(PacketOutgoingType.TabComplete, tabcomplete_packet);
|
SendPacket(PacketTypesOut.TabComplete, tabcomplete_packet);
|
||||||
|
|
||||||
int wait_left = 50; //do not wait more than 5 seconds (50 * 100 ms)
|
int wait_left = 50; //do not wait more than 5 seconds (50 * 100 ms)
|
||||||
Thread t1 = new Thread(new ThreadStart(delegate
|
Thread t1 = new Thread(new ThreadStart(delegate
|
||||||
|
|
@ -1338,7 +1341,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] message_packet = dataTypes.GetString(message);
|
byte[] message_packet = dataTypes.GetString(message);
|
||||||
SendPacket(PacketOutgoingType.ChatMessage, message_packet);
|
SendPacket(PacketTypesOut.ChatMessage, message_packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1354,7 +1357,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
fields.AddRange(dataTypes.GetVarInt(PlayerEntityID));
|
fields.AddRange(dataTypes.GetVarInt(PlayerEntityID));
|
||||||
fields.AddRange(dataTypes.GetVarInt(ActionID));
|
fields.AddRange(dataTypes.GetVarInt(ActionID));
|
||||||
fields.AddRange(dataTypes.GetVarInt(0));
|
fields.AddRange(dataTypes.GetVarInt(0));
|
||||||
SendPacket(PacketOutgoingType.EntityAction, fields);
|
SendPacket(PacketTypesOut.EntityAction, fields);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1370,7 +1373,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SendPacket(PacketOutgoingType.ClientStatus, new byte[] { 0 });
|
SendPacket(PacketTypesOut.ClientStatus, new byte[] { 0 });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1429,7 +1432,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
else fields.Add(skinParts);
|
else fields.Add(skinParts);
|
||||||
if (protocolversion >= MC19Version)
|
if (protocolversion >= MC19Version)
|
||||||
fields.AddRange(dataTypes.GetVarInt(mainHand));
|
fields.AddRange(dataTypes.GetVarInt(mainHand));
|
||||||
SendPacket(PacketOutgoingType.ClientSettings, fields);
|
SendPacket(PacketTypesOut.ClientSettings, fields);
|
||||||
}
|
}
|
||||||
catch (SocketException) { }
|
catch (SocketException) { }
|
||||||
catch (System.IO.IOException) { return false; }
|
catch (System.IO.IOException) { return false; }
|
||||||
|
|
@ -1450,12 +1453,12 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (handler.GetTerrainEnabled())
|
if (handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
byte[] yawpitch = new byte[0];
|
byte[] yawpitch = new byte[0];
|
||||||
PacketOutgoingType packetType = PacketOutgoingType.PlayerPosition;
|
PacketTypesOut packetType = PacketTypesOut.PlayerPosition;
|
||||||
|
|
||||||
if (yaw.HasValue && pitch.HasValue)
|
if (yaw.HasValue && pitch.HasValue)
|
||||||
{
|
{
|
||||||
yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value));
|
yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value));
|
||||||
packetType = PacketOutgoingType.PlayerPositionAndLook;
|
packetType = PacketTypesOut.PlayerPositionAndRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
@ -1494,11 +1497,11 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
byte[] length = BitConverter.GetBytes((short)data.Length);
|
byte[] length = BitConverter.GetBytes((short)data.Length);
|
||||||
Array.Reverse(length);
|
Array.Reverse(length);
|
||||||
|
|
||||||
SendPacket(PacketOutgoingType.PluginMessage, dataTypes.ConcatBytes(dataTypes.GetString(channel), length, data));
|
SendPacket(PacketTypesOut.PluginMessage, dataTypes.ConcatBytes(dataTypes.GetString(channel), length, data));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendPacket(PacketOutgoingType.PluginMessage, dataTypes.ConcatBytes(dataTypes.GetString(channel), data));
|
SendPacket(PacketTypesOut.PluginMessage, dataTypes.ConcatBytes(dataTypes.GetString(channel), data));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1547,7 +1550,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (protocolversion >= MC116Version)
|
if (protocolversion >= MC116Version)
|
||||||
fields.AddRange(dataTypes.GetBool(false));
|
fields.AddRange(dataTypes.GetBool(false));
|
||||||
|
|
||||||
SendPacket(PacketOutgoingType.InteractEntity, fields);
|
SendPacket(PacketTypesOut.InteractEntity, fields);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1567,7 +1570,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
fields.AddRange(dataTypes.GetFloat(Y));
|
fields.AddRange(dataTypes.GetFloat(Y));
|
||||||
fields.AddRange(dataTypes.GetFloat(Z));
|
fields.AddRange(dataTypes.GetFloat(Z));
|
||||||
fields.AddRange(dataTypes.GetVarInt(hand));
|
fields.AddRange(dataTypes.GetVarInt(hand));
|
||||||
SendPacket(PacketOutgoingType.InteractEntity, fields);
|
SendPacket(PacketTypesOut.InteractEntity, fields);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1582,7 +1585,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
fields.AddRange(dataTypes.GetVarInt(EntityID));
|
fields.AddRange(dataTypes.GetVarInt(EntityID));
|
||||||
fields.AddRange(dataTypes.GetVarInt(type));
|
fields.AddRange(dataTypes.GetVarInt(type));
|
||||||
fields.AddRange(dataTypes.GetVarInt(hand));
|
fields.AddRange(dataTypes.GetVarInt(hand));
|
||||||
SendPacket(PacketOutgoingType.InteractEntity, fields);
|
SendPacket(PacketTypesOut.InteractEntity, fields);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1605,7 +1608,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
List<byte> packet = new List<byte>();
|
List<byte> packet = new List<byte>();
|
||||||
packet.AddRange(dataTypes.GetVarInt(hand));
|
packet.AddRange(dataTypes.GetVarInt(hand));
|
||||||
SendPacket(PacketOutgoingType.UseItem, packet);
|
SendPacket(PacketTypesOut.UseItem, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1621,7 +1624,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.AddRange(dataTypes.GetVarInt(status));
|
packet.AddRange(dataTypes.GetVarInt(status));
|
||||||
packet.AddRange(dataTypes.GetLocation(location));
|
packet.AddRange(dataTypes.GetLocation(location));
|
||||||
packet.AddRange(dataTypes.GetVarInt(dataTypes.GetBlockFace(face)));
|
packet.AddRange(dataTypes.GetVarInt(dataTypes.GetBlockFace(face)));
|
||||||
SendPacket(PacketOutgoingType.PlayerDigging, packet);
|
SendPacket(PacketTypesOut.PlayerDigging, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1643,7 +1646,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorY
|
packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorY
|
||||||
packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorZ
|
packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorZ
|
||||||
packet.Add(0); // insideBlock = false;
|
packet.Add(0); // insideBlock = false;
|
||||||
SendPacket(PacketOutgoingType.PlayerBlockPlacement, packet);
|
SendPacket(PacketTypesOut.PlayerBlockPlacement, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1657,7 +1660,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
List<byte> packet = new List<byte>();
|
List<byte> packet = new List<byte>();
|
||||||
packet.AddRange(dataTypes.GetShort(slot));
|
packet.AddRange(dataTypes.GetShort(slot));
|
||||||
SendPacket(PacketOutgoingType.HeldItemChange, packet);
|
SendPacket(PacketTypesOut.HeldItemChange, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1712,7 +1715,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
|
|
||||||
packet.AddRange(dataTypes.GetItemSlot(item, itemPalette));
|
packet.AddRange(dataTypes.GetItemSlot(item, itemPalette));
|
||||||
|
|
||||||
SendPacket(PacketOutgoingType.ClickWindow, packet);
|
SendPacket(PacketTypesOut.ClickWindow, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1727,7 +1730,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
List<byte> packet = new List<byte>();
|
List<byte> packet = new List<byte>();
|
||||||
packet.AddRange(dataTypes.GetShort((short)slot));
|
packet.AddRange(dataTypes.GetShort((short)slot));
|
||||||
packet.AddRange(dataTypes.GetItemSlot(new Item(itemType, count, nbt), itemPalette));
|
packet.AddRange(dataTypes.GetItemSlot(new Item(itemType, count, nbt), itemPalette));
|
||||||
SendPacket(PacketOutgoingType.CreativeInventoryAction, packet);
|
SendPacket(PacketTypesOut.CreativeInventoryAction, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1757,7 +1760,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.AddRange(dataTypes.GetVarInt(animation));
|
packet.AddRange(dataTypes.GetVarInt(animation));
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPacket(PacketOutgoingType.Animation, packet);
|
SendPacket(PacketTypesOut.Animation, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1779,7 +1782,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (window_actions.ContainsKey(windowId))
|
if (window_actions.ContainsKey(windowId))
|
||||||
window_actions[windowId] = 0;
|
window_actions[windowId] = 0;
|
||||||
}
|
}
|
||||||
SendPacket(PacketOutgoingType.CloseWindow, new[] { (byte)windowId });
|
SendPacket(PacketTypesOut.CloseWindow, new[] { (byte)windowId });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1806,7 +1809,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.AddRange(dataTypes.GetString(line2));
|
packet.AddRange(dataTypes.GetString(line2));
|
||||||
packet.AddRange(dataTypes.GetString(line3));
|
packet.AddRange(dataTypes.GetString(line3));
|
||||||
packet.AddRange(dataTypes.GetString(line4));
|
packet.AddRange(dataTypes.GetString(line4));
|
||||||
SendPacket(PacketOutgoingType.UpdateSign, packet);
|
SendPacket(PacketTypesOut.UpdateSign, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1825,7 +1828,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.AddRange(dataTypes.GetString(command));
|
packet.AddRange(dataTypes.GetString(command));
|
||||||
packet.AddRange(dataTypes.GetVarInt((int)mode));
|
packet.AddRange(dataTypes.GetVarInt((int)mode));
|
||||||
packet.Add((byte)flags);
|
packet.Add((byte)flags);
|
||||||
SendPacket(PacketOutgoingType.UpdateSign, packet);
|
SendPacket(PacketTypesOut.UpdateSign, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
@ -1843,7 +1846,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
packet.Add(windowID);
|
packet.Add(windowID);
|
||||||
packet.AddRange(dataTypes.GetShort(actionID));
|
packet.AddRange(dataTypes.GetShort(actionID));
|
||||||
packet.Add(accepted ? (byte)1 : (byte)0);
|
packet.Add(accepted ? (byte)1 : (byte)0);
|
||||||
SendPacket(PacketOutgoingType.WindowConfirmation, packet);
|
SendPacket(PacketTypesOut.WindowConfirmation, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
|
|
||||||
|
|
@ -1,722 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace MinecraftClient.Protocol.Handlers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Contains packet ID mappings for Protocol18
|
|
||||||
/// </summary>
|
|
||||||
class Protocol18PacketTypes
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Get abstract numbering of the specified packet ID
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// When adding a new packet, see https://wiki.vg/Protocol_version_numbers
|
|
||||||
/// For each switch below, see the corresponding page (e.g. MC 1.7, then 1.9) and add the ID
|
|
||||||
/// By the way, also look for packet layout changes across versions and handle them in Protocol18.cs
|
|
||||||
/// Please add entries in the same order as they are displayed in PacketIncomingType.cs
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="packetID">Packet ID</param>
|
|
||||||
/// <param name="protocol">Protocol version</param>
|
|
||||||
/// <returns>Abstract numbering</returns>
|
|
||||||
public static PacketIncomingType GetPacketIncomingType(int packetID, int protocol)
|
|
||||||
{
|
|
||||||
if (protocol <= Protocol18Handler.MC18Version) // MC 1.7 and 1.8
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x00: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x01: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x02: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x07: return PacketIncomingType.Respawn;
|
|
||||||
case 0x08: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x21: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x22: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x23: return PacketIncomingType.BlockChange;
|
|
||||||
case 0x26: return PacketIncomingType.MapChunkBulk;
|
|
||||||
// UnloadChunk does not exist prior to 1.9
|
|
||||||
case 0x38: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x3A: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x3F: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x40: return PacketIncomingType.KickPacket;
|
|
||||||
case 0x46: return PacketIncomingType.NetworkCompressionTreshold;
|
|
||||||
case 0x48: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x2E: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x2D: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x30: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x32: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x2F: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x0E: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x0F: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x13: return PacketIncomingType.DestroyEntities;
|
|
||||||
// SetCooldown does not exist prior to 1.9
|
|
||||||
case 0x15: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x17: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x20: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x18: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x12: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x04: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x1E: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x03: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x06: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x1F: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x09: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x27: return PacketIncomingType.Explosion;
|
|
||||||
case 0x34: return PacketIncomingType.MapData;
|
|
||||||
case 0x45: return PacketIncomingType.Title;
|
|
||||||
case 0x3B: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x3C: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1.10 and 1.11
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x1F: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x23: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0F: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x33: return PacketIncomingType.Respawn;
|
|
||||||
case 0x2E: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x20: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x10: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk has been removed in 1.9
|
|
||||||
case 0x1D: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x2D: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x0E: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x18: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1A: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold has been removed in 1.9
|
|
||||||
case 0x32: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x12: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x13: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x14: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x11: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x16: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x30: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x17: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x25: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x26: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x4A: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x49: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x3B: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x3C: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x4B: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x39: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x44: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x3E: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x3D: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x37: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
|
||||||
case 0x24: return PacketIncomingType.MapData;
|
|
||||||
case 0x45: return PacketIncomingType.Title;
|
|
||||||
case 0x3F: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x42: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12.0
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x1F: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x23: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0F: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x34: return PacketIncomingType.Respawn;
|
|
||||||
case 0x2E: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x20: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x10: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1D: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x2D: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x0E: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x18: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1A: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x33: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x12: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x13: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x14: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x11: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x16: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x31: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x17: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x26: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x4D: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x4B: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x3D: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x3E: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x4E: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x3B: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x46: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x40: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x3F: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x39: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
|
||||||
case 0x24: return PacketIncomingType.MapData;
|
|
||||||
case 0x47: return PacketIncomingType.Title;
|
|
||||||
case 0x41: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x44: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1122Version) // MC 1.12.2
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x1F: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x23: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0F: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x35: return PacketIncomingType.Respawn;
|
|
||||||
case 0x2F: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x20: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x10: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1D: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x2E: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x0E: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x18: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1A: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x34: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x12: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x13: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x14: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x11: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x16: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x32: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x17: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x26: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x4E: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x4C: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x3E: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x3F: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x4F: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x3C: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x47: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x41: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x40: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x3A: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
|
||||||
case 0x25: return PacketIncomingType.MapData;
|
|
||||||
case 0x48: return PacketIncomingType.Title;
|
|
||||||
case 0x42: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x45: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x21: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x25: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0E: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x38: return PacketIncomingType.Respawn;
|
|
||||||
case 0x32: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x22: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x0F: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1F: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x30: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x10: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x19: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1B: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x37: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x13: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x14: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x15: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x12: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x17: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x35: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x18: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x28: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x52: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x50: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x41: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x42: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x53: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x3F: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x4A: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x44: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x43: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x3D: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1E: return PacketIncomingType.Explosion;
|
|
||||||
case 0x26: return PacketIncomingType.MapData;
|
|
||||||
case 0x4B: return PacketIncomingType.Title;
|
|
||||||
case 0x45: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x48: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol < Protocol18Handler.MC115Version) // MC 1.14 to 1.14.4
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x20: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x25: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0E: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x3A: return PacketIncomingType.Respawn;
|
|
||||||
case 0x35: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x21: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x0F: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1D: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x33: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x10: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x18: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1A: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x39: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x13: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x2E: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x14: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x12: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x16: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x37: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x17: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x28: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x58: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x56: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x41: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x46: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x59: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x43: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x48: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x47: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x3F: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
|
||||||
case 0x26: return PacketIncomingType.MapData;
|
|
||||||
case 0x4F: return PacketIncomingType.Title;
|
|
||||||
case 0x49: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x4C: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1152Version) // MC 1.15 to 1.15.2
|
|
||||||
{
|
|
||||||
switch (packetID)
|
|
||||||
{
|
|
||||||
case 0x21: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x26: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0F: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x3B: return PacketIncomingType.Respawn;
|
|
||||||
case 0x36: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x22: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x10: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0C: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1E: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x34: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x11: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x19: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1B: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x3A: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x14: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x2F: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x15: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x13: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x17: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x05: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x38: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x18: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x29: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x2A: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x59: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x57: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x46: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x47: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x5A: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x44: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x4F: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x48: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x40: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1D: return PacketIncomingType.Explosion;
|
|
||||||
case 0x27: return PacketIncomingType.MapData;
|
|
||||||
case 0x50: return PacketIncomingType.Title;
|
|
||||||
case 0x4A: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x4D: return PacketIncomingType.UpdateScore;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1161Version)
|
|
||||||
{
|
|
||||||
switch (packetID) // MC 1.16 and 1.16.1
|
|
||||||
{
|
|
||||||
case 0x20: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x25: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0E: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x3A: return PacketIncomingType.Respawn;
|
|
||||||
case 0x35: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x21: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x0F: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1D: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x33: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x10: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x18: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x1A: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x39: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x13: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x2E: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x14: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x12: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x16: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x02: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x04: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x37: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x17: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x28: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x58: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x56: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x46: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x47: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x59: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x44: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x48: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x3F: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
|
||||||
case 0x26: return PacketIncomingType.MapData;
|
|
||||||
case 0x4F: return PacketIncomingType.Title;
|
|
||||||
case 0x4A: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x4D: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (packetID) // MC 1.16.2
|
|
||||||
{
|
|
||||||
case 0x1F: return PacketIncomingType.KeepAlive;
|
|
||||||
case 0x24: return PacketIncomingType.JoinGame;
|
|
||||||
case 0x0E: return PacketIncomingType.ChatMessage;
|
|
||||||
case 0x39: return PacketIncomingType.Respawn;
|
|
||||||
case 0x35: return PacketIncomingType.PlayerPositionAndLook;
|
|
||||||
case 0x20: return PacketIncomingType.ChunkData;
|
|
||||||
case 0x3B: return PacketIncomingType.MultiBlockChange;
|
|
||||||
case 0x0B: return PacketIncomingType.BlockChange;
|
|
||||||
// MapChunkBulk does not exist since 1.9
|
|
||||||
case 0x1C: return PacketIncomingType.UnloadChunk;
|
|
||||||
case 0x32: return PacketIncomingType.PlayerListUpdate;
|
|
||||||
case 0x0F: return PacketIncomingType.TabCompleteResult;
|
|
||||||
case 0x17: return PacketIncomingType.PluginMessage;
|
|
||||||
case 0x19: return PacketIncomingType.KickPacket;
|
|
||||||
// NetworkCompressionTreshold does not exist since 1.9
|
|
||||||
case 0x38: return PacketIncomingType.ResourcePackSend;
|
|
||||||
case 0x12: return PacketIncomingType.CloseWindow;
|
|
||||||
case 0x2D: return PacketIncomingType.OpenWindow;
|
|
||||||
case 0x13: return PacketIncomingType.WindowItems;
|
|
||||||
case 0x11: return PacketIncomingType.WindowConfirmation;
|
|
||||||
case 0x15: return PacketIncomingType.SetSlot;
|
|
||||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
|
||||||
case 0x02: return PacketIncomingType.SpawnLivingEntity;
|
|
||||||
case 0x04: return PacketIncomingType.SpawnPlayer;
|
|
||||||
case 0x36: return PacketIncomingType.DestroyEntities;
|
|
||||||
case 0x16: return PacketIncomingType.SetCooldown;
|
|
||||||
case 0x27: return PacketIncomingType.EntityPosition;
|
|
||||||
case 0x28: return PacketIncomingType.EntityPositionAndRotation;
|
|
||||||
case 0x58: return PacketIncomingType.EntityProperties;
|
|
||||||
case 0x56: return PacketIncomingType.EntityTeleport;
|
|
||||||
case 0x46: return PacketIncomingType.EntityVelocity;
|
|
||||||
case 0x47: return PacketIncomingType.EntityEquipment;
|
|
||||||
case 0x59: return PacketIncomingType.EntityEffect;
|
|
||||||
case 0x44: return PacketIncomingType.EntityMetadata;
|
|
||||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
|
||||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
|
||||||
case 0x48: return PacketIncomingType.SetExperience;
|
|
||||||
case 0x3F: return PacketIncomingType.HeldItemChange;
|
|
||||||
case 0x1B: return PacketIncomingType.Explosion;
|
|
||||||
case 0x25: return PacketIncomingType.MapData;
|
|
||||||
case 0x4F: return PacketIncomingType.Title;
|
|
||||||
case 0x4A: return PacketIncomingType.ScoreboardObjective;
|
|
||||||
case 0x4D: return PacketIncomingType.UpdateScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PacketIncomingType.UnknownPacket;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get packet ID of the specified outgoing packet
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// When adding a new packet, see https://wiki.vg/Protocol_version_numbers
|
|
||||||
/// For each switch below, see the corresponding page (e.g. MC 1.7, then 1.9) and add the ID
|
|
||||||
/// By the way, also look for packet layout changes across versions and handle them in Protocol18.cs
|
|
||||||
/// Please add entries in the same order as they are displayed in PacketOutgoingType.cs
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="packet">Abstract packet numbering</param>
|
|
||||||
/// <param name="protocol">Protocol version</param>
|
|
||||||
/// <returns>Packet ID</returns>
|
|
||||||
public static int GetPacketOutgoingID(PacketOutgoingType packet, int protocol)
|
|
||||||
{
|
|
||||||
if (protocol <= Protocol18Handler.MC18Version) // MC 1.7 and 1.8
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x00;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x19;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x01;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x16;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x15;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x17;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x14;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x0B;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x04;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x06;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: throw new InvalidOperationException("Teleport confirm is not supported in protocol " + protocol);
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x17;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x02;
|
|
||||||
case PacketOutgoingType.UseItem: throw new InvalidOperationException("Use item is not supported in protocol " + protocol);
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x0E;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x0D;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x0f;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x08;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x10;
|
|
||||||
case PacketOutgoingType.Animation: return 0x0A;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x07;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x12;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1,10 and 1.11
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x0B;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x16;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x02;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x04;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x09;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x01;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x14;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x0C;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x0D;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x17;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0A;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x1D;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x07;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x08;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x05;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x1C;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x18;
|
|
||||||
case PacketOutgoingType.Animation: return 0x1A;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x13;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x19;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x0C;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x18;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x04;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x05;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x0A;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x02;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x15;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x0E;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x0F;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x1A;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0B;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x20;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x07;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x08;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x06;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x1F;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
|
||||||
case PacketOutgoingType.Animation: return 0x1D;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x1C;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1122Version) // 1.12.2
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x0B;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x18;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x02;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x04;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x09;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x01;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x15;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x0D;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x0E;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x1F;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0A;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x20;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x07;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x08;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x05;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x1F;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
|
||||||
case PacketOutgoingType.Animation: return 0x1D;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x1C;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x0E;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x1D;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x02;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x04;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x0A;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x05;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x19;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x10;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x11;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x21;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0D;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x2A;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x08;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x09;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x06;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x29;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x24;
|
|
||||||
case PacketOutgoingType.Animation: return 0x27;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x18;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x26;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x22;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1152Version) //MC 1.14 to 1.15.2
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x0F;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x1F;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x04;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x05;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x0B;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x06;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x1B;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x11;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x12;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x23;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0E;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x2D;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x09;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x0A;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x07;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x2C;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x26;
|
|
||||||
case PacketOutgoingType.Animation: return 0x2A;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x1A;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x29;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (protocol <= Protocol18Handler.MC1161Version) // MC 1.16 and 1.16.1
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x10;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x20;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x04;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x05;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x0B;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x06;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x1C;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x12;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x13;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x24;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0E;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x2E;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x09;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x0A;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x07;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x2D;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x27;
|
|
||||||
case PacketOutgoingType.Animation: return 0x2B;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x1B;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x2A;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (packet)
|
|
||||||
{
|
|
||||||
case PacketOutgoingType.KeepAlive: return 0x10;
|
|
||||||
case PacketOutgoingType.ResourcePackStatus: return 0x21;
|
|
||||||
case PacketOutgoingType.ChatMessage: return 0x03;
|
|
||||||
case PacketOutgoingType.ClientStatus: return 0x04;
|
|
||||||
case PacketOutgoingType.ClientSettings: return 0x05;
|
|
||||||
case PacketOutgoingType.PluginMessage: return 0x0B;
|
|
||||||
case PacketOutgoingType.TabComplete: return 0x06;
|
|
||||||
case PacketOutgoingType.EntityAction: return 0x1C;
|
|
||||||
case PacketOutgoingType.PlayerPosition: return 0x12;
|
|
||||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x13;
|
|
||||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
|
||||||
case PacketOutgoingType.HeldItemChange: return 0x25;
|
|
||||||
case PacketOutgoingType.InteractEntity: return 0x0E;
|
|
||||||
case PacketOutgoingType.UseItem: return 0x2F;
|
|
||||||
case PacketOutgoingType.ClickWindow: return 0x09;
|
|
||||||
case PacketOutgoingType.CloseWindow: return 0x0A;
|
|
||||||
case PacketOutgoingType.WindowConfirmation: return 0x07;
|
|
||||||
case PacketOutgoingType.PlayerBlockPlacement: return 0x2E;
|
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x28;
|
|
||||||
case PacketOutgoingType.Animation: return 0x2C;
|
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x1B;
|
|
||||||
case PacketOutgoingType.UpdateSign: return 0x2B;
|
|
||||||
case PacketOutgoingType.UpdateCommandBlock: return 0x26;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new System.ComponentModel.InvalidEnumArgumentException("Unknown PacketOutgoingType (protocol=" + protocol + ")", (int)packet, typeof(PacketOutgoingType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue