mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Added Entity Action handling, and A TSneak command that will Toggle Sneak.
This commit is contained in:
parent
9dae40153c
commit
384c804e54
10 changed files with 176 additions and 5 deletions
16
MinecraftClient/Protocol/Action.cs
Normal file
16
MinecraftClient/Protocol/Action.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MinecraftClient.Protocol
|
||||
{
|
||||
public enum ActionType
|
||||
{
|
||||
StartSneaking,
|
||||
StopSneaking,
|
||||
LeaveBed,
|
||||
StartSprinting,
|
||||
StopSprinting
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -239,6 +239,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else return "";
|
||||
}
|
||||
public bool SendEntityAction(int PlayerEntityID, int ActionID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private byte[] readNextByteArray()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -85,7 +85,15 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="data">packet Data</param>
|
||||
/// <returns>True if message was successfully sent</returns>
|
||||
bool SendPluginChannelPacket(string channel, byte[] data);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send Entity Action packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="entityID">PlayerID</param>
|
||||
/// <param name="type">Type of packet to send</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendEntityAction(int EntityID, int type);
|
||||
|
||||
/// <summary>
|
||||
/// Send a held item change packet to the server.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue