Fix AutoDig

This commit is contained in:
BruceChen 2022-11-01 16:37:50 +08:00
parent d7471e3741
commit e954801a0d
5 changed files with 55 additions and 24 deletions

View file

@ -749,9 +749,12 @@ namespace MinecraftClient.Protocol.Handlers
// Teleport confirm packet
SendPacket(PacketTypesOut.TeleportConfirm, dataTypes.GetVarInt(teleportID));
SendLocationUpdate(location, true, yaw, pitch, true);
if (teleportID == 1)
if (Config.Main.Advanced.TemporaryFixBadpacket)
{
SendLocationUpdate(location, true, yaw, pitch, true);
if (teleportID == 1)
SendLocationUpdate(location, true, yaw, pitch, true);
}
}
else
{
@ -2550,7 +2553,7 @@ namespace MinecraftClient.Protocol.Handlers
/// <returns>True if the location update was successfully sent</returns>
public bool SendLocationUpdate(Location location, bool onGround, float? yaw, float? pitch)
{
return SendLocationUpdate(location, onGround, yaw, pitch, false);
return SendLocationUpdate(location, onGround, yaw, pitch, true);
}
public bool SendLocationUpdate(Location location, bool onGround, float? yaw = null, float? pitch = null, bool forceUpdate = false)
@ -2560,12 +2563,25 @@ namespace MinecraftClient.Protocol.Handlers
byte[] yawpitch = Array.Empty<byte>();
PacketTypesOut packetType = PacketTypesOut.PlayerPosition;
if (yaw.HasValue && pitch.HasValue && (forceUpdate || yaw.Value != LastYaw || pitch.Value != LastPitch))
if (Config.Main.Advanced.TemporaryFixBadpacket)
{
yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value));
packetType = PacketTypesOut.PlayerPositionAndRotation;
if (yaw.HasValue && pitch.HasValue && (forceUpdate || yaw.Value != LastYaw || pitch.Value != LastPitch))
{
yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value));
packetType = PacketTypesOut.PlayerPositionAndRotation;
LastYaw = yaw.Value; LastPitch = pitch.Value;
LastYaw = yaw.Value; LastPitch = pitch.Value;
}
}
else
{
if (yaw.HasValue && pitch.HasValue)
{
yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value));
packetType = PacketTypesOut.PlayerPositionAndRotation;
LastYaw = yaw.Value; LastPitch = pitch.Value;
}
}
try