Fix EntityAction packet ID and tiny improve of sneak command

This commit is contained in:
ReinforceZwei 2020-05-23 21:16:28 +08:00 committed by ORelio
parent cdb217840d
commit d6a3ea0726
2 changed files with 6 additions and 7 deletions

View file

@ -13,18 +13,17 @@ namespace MinecraftClient.Commands
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
{
Console.WriteLine(command);
if (sneaking)
{
var result = handler.sendEntityAction(Protocol.EntityActionType.StopSneaking);
sneaking = false;
return result ? "Success" : "Fail";
return result ? "You aren't sneaking anymore" : "Fail";
}
else
{
var result = handler.sendEntityAction(Protocol.EntityActionType.StartSneaking);
sneaking = true;
return result ? "Success" : "Fail";
return result ? "You are sneaking now" : "Fail";
}
}

View file

@ -331,7 +331,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.InteractEntity: return 0x0A;
case PacketOutgoingType.ClickWindow: return 0x07;
case PacketOutgoingType.CloseWindow: return 0x08;
case PacketOutgoingType.EntityAction: return 0x0B;
case PacketOutgoingType.EntityAction: return 0x14;
}
}
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12
@ -352,7 +352,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.InteractEntity: return 0x0B;
case PacketOutgoingType.ClickWindow: return 0x07;
case PacketOutgoingType.CloseWindow: return 0x08;
case PacketOutgoingType.EntityAction: return 0x0B;
case PacketOutgoingType.EntityAction: return 0x15;
}
}
else if (protocol <= Protocol18Handler.MC1122Version) // 1.12.2
@ -373,7 +373,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.InteractEntity: return 0x0A;
case PacketOutgoingType.ClickWindow: return 0x07;
case PacketOutgoingType.CloseWindow: return 0x08;
case PacketOutgoingType.EntityAction: return 0x0B;
case PacketOutgoingType.EntityAction: return 0x15;
}
}
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
@ -417,7 +417,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.PlayerBlockPlacement: return 0x2C;
case PacketOutgoingType.ClickWindow: return 0x09;
case PacketOutgoingType.CloseWindow: return 0x0A;
case PacketOutgoingType.EntityAction: return 0x19;
case PacketOutgoingType.EntityAction: return 0x1B;
}
}