Fix: 修复高版本未正确处理移动数据包

This commit is contained in:
SerendipityR 2024-01-31 01:51:40 +08:00 committed by GitHub
parent 4522866ff8
commit f7df9cb249
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 37 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import org.spacehq.mc.protocol.packet.ingame.client.*;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -112,6 +113,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -19,6 +19,7 @@ import org.spacehq.mc.protocol.packet.ingame.client.*;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -102,6 +103,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -16,6 +16,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.*;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -95,6 +96,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -16,6 +16,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.*;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -96,6 +97,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -15,6 +15,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.*;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -96,6 +97,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -15,6 +15,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.*;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -97,6 +98,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
((TcpClientSession) client).send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -18,6 +18,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLo
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.*;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket;
@ -97,6 +98,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
ServerboundAcceptTeleportationPacket acceptTeleportationPacket = new ServerboundAcceptTeleportationPacket(packet.getTeleportId());
((TcpClientSession) client).send(acceptTeleportationPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -18,6 +18,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSy
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.*;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket;
@ -95,6 +96,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
ServerboundAcceptTeleportationPacket acceptTeleportationPacket = new ServerboundAcceptTeleportationPacket(packet.getTeleportId());
((TcpClientSession) client).send(acceptTeleportationPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -18,6 +18,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSy
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.*;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket;
@ -95,6 +96,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
ServerboundAcceptTeleportationPacket acceptTeleportationPacket = new ServerboundAcceptTeleportationPacket(packet.getTeleportId());
((TcpClientSession) client).send(acceptTeleportationPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -18,6 +18,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSy
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.*;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket;
@ -95,6 +96,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
ServerboundAcceptTeleportationPacket acceptTeleportationPacket = new ServerboundAcceptTeleportationPacket(packet.getTeleportId());
((TcpClientSession) client).send(acceptTeleportationPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -24,6 +24,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCh
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket;
@ -102,6 +103,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
TcpClientSession session = (TcpClientSession) client;
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
ServerboundAcceptTeleportationPacket acceptTeleportationPacket = new ServerboundAcceptTeleportationPacket(packet.getTeleportId());
((TcpClientSession) client).send(acceptTeleportationPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}

View File

@ -19,6 +19,7 @@ import org.spacehq.mc.protocol.packet.ingame.client.*;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;

View File

@ -20,6 +20,7 @@ import org.spacehq.mc.protocol.packet.ingame.client.*;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
@ -112,6 +113,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(packet.getTeleportId());
session.send(teleportConfirmPacket);
sendPositionRotationPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
sendClientPlayerMovementPacket(session, true);
}