Added Entity Action handling, and A TSneak command that will Toggle Sneak.

This commit is contained in:
CarbonNeuron 2020-05-01 08:28:22 -05:00
parent 9dae40153c
commit 384c804e54
10 changed files with 176 additions and 5 deletions

View file

@ -17,6 +17,7 @@ namespace MinecraftClient.Protocol.Handlers
ClientSettings,
PluginMessage,
TabComplete,
EntityAction,
PlayerPosition,
PlayerPositionAndLook,
TeleportConfirm,
@ -27,4 +28,4 @@ namespace MinecraftClient.Protocol.Handlers
CloseWindow,
PlayerBlockPlacement
}
}
}

View file

@ -239,6 +239,10 @@ namespace MinecraftClient.Protocol.Handlers
}
else return "";
}
public bool SendEntityAction(int PlayerEntityID, int ActionID)
{
return true;
}
private byte[] readNextByteArray()
{

View file

@ -965,6 +965,22 @@ namespace MinecraftClient.Protocol.Handlers
catch (System.IO.IOException) { return false; }
catch (ObjectDisposedException) { return false; }
}
public bool SendEntityAction(int PlayerEntityID, int ActionID)
{
try
{
List<byte> fields = new List<byte>();
fields.AddRange(dataTypes.GetVarInt(PlayerEntityID));
fields.AddRange(dataTypes.GetVarInt(ActionID));
fields.AddRange(dataTypes.GetVarInt(0));
SendPacket(PacketOutgoingType.EntityAction, fields);
return true;
}
catch (SocketException) { return false; }
catch (System.IO.IOException) { return false; }
catch (ObjectDisposedException) { return false; }
}
/// <summary>
/// Send a respawn packet to the server