Reorganize methods in McClient.cs

Tyding up the class as it is becoming quite large
This commit is contained in:
ORelio 2020-06-20 15:18:34 +02:00
parent 2add4030f4
commit f30dc4464c
5 changed files with 880 additions and 866 deletions

View file

@ -741,7 +741,7 @@ namespace MinecraftClient
/// </summary> /// </summary>
private bool SendEntityAction(Protocol.EntityActionType entityAction) private bool SendEntityAction(Protocol.EntityActionType entityAction)
{ {
return Handler.sendEntityAction(entityAction); return Handler.SendEntityAction(entityAction);
} }
/// <summary> /// <summary>

View file

@ -15,14 +15,14 @@ namespace MinecraftClient.Commands
{ {
if (sneaking) if (sneaking)
{ {
var result = handler.sendEntityAction(Protocol.EntityActionType.StopSneaking); var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
if (result) if (result)
sneaking = false; sneaking = false;
return result ? "You aren't sneaking anymore" : "Fail"; return result ? "You aren't sneaking anymore" : "Fail";
} }
else else
{ {
var result = handler.sendEntityAction(Protocol.EntityActionType.StartSneaking); var result = handler.SendEntityAction(Protocol.EntityActionType.StartSneaking);
if (result) if (result)
sneaking = true; sneaking = true;
return result ? "You are sneaking now" : "Fail"; return result ? "You are sneaking now" : "Fail";

File diff suppressed because it is too large Load diff

View file

@ -216,7 +216,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketIncomingType.JoinGame: case PacketIncomingType.JoinGame:
handler.OnGameJoined(); handler.OnGameJoined();
int playerEntityID = dataTypes.ReadNextInt(packetData); int playerEntityID = dataTypes.ReadNextInt(packetData);
handler.SetPlayerEntityID(playerEntityID); handler.OnReceivePlayerEntityID(playerEntityID);
handler.OnGamemodeUpdate(Guid.Empty, dataTypes.ReadNextByte(packetData)); handler.OnGamemodeUpdate(Guid.Empty, dataTypes.ReadNextByte(packetData));
if (protocolversion >= MC191Version) if (protocolversion >= MC191Version)
this.currentDimension = dataTypes.ReadNextInt(packetData); this.currentDimension = dataTypes.ReadNextInt(packetData);

View file

@ -272,6 +272,6 @@ namespace MinecraftClient.Protocol
/// Called when the Player entity ID has been received from the server /// Called when the Player entity ID has been received from the server
/// </summary> /// </summary>
/// <param name="EntityID">Player entity ID</param> /// <param name="EntityID">Player entity ID</param>
void SetPlayerEntityID(int EntityID); void OnReceivePlayerEntityID(int EntityID);
} }
} }