Add support for creating replay mod capture files (#1246)

* Add test replay handler
* Fix incorrect built raw packet
* Fix incorrect built raw packet
* Add filter
* Add not working zip lib
* Add dotNetZip lib and complete basic function
* Update ReplayHandler.cs
* Complete Replay handler
Without client player handling
* Complete replay mod
- New ChatBot OnNetworkPacket event
* Add auto-backup and command for Replay Mod
* Add ReplayMod description to readme
* Small naming changes, fix compile error on .NET4.0
* ReplayHandler slight optimizations
Use Path.Combine to automatically use Windows '\' or Linux '/'
Move re-usable common parts outside the Replay handler
Small optimizations in building JSON strings
Co-authored-by: ORelio <oreliogitantispam.l0gin@spamgourmet.com>
This commit is contained in:
ReinforceZwei 2020-09-07 03:51:42 +08:00 committed by GitHub
parent cd1badb9d6
commit 7e20e409a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 32732 additions and 21 deletions

View file

@ -212,6 +212,12 @@ namespace MinecraftClient.Protocol.Handlers
}
packetID = dataTypes.ReadNextVarInt(packetData); //Packet ID
if (handler.GetNetworkPacketCaptureEnabled())
{
List<byte> clone = packetData.ToList();
handler.OnNetworkPacket(packetID, clone, login_phase, true);
}
}
/// <summary>
@ -1050,6 +1056,12 @@ namespace MinecraftClient.Protocol.Handlers
/// <param name="packetData">packet Data</param>
private void SendPacket(int packetID, IEnumerable<byte> packetData)
{
if (handler.GetNetworkPacketCaptureEnabled())
{
List<byte> clone = packetData.ToList();
handler.OnNetworkPacket(packetID, clone, login_phase, false);
}
//The inner packet
byte[] the_packet = dataTypes.ConcatBytes(dataTypes.GetVarInt(packetID), packetData.ToArray());
@ -1329,6 +1341,18 @@ namespace MinecraftClient.Protocol.Handlers
: 100;
}
/// <summary>
/// Get the current protocol version.
/// </summary>
/// <remarks>
/// Version-specific operations should be handled inside the Protocol handled whenever possible.
/// </remarks>
/// <returns>Minecraft Protocol version number</returns>
public int GetProtocolVersion()
{
return protocolversion;
}
/// <summary>
/// Send a chat message to the server
/// </summary>