mirror of
https://github.com/SerendipityR-2022/EndMinecraftPlusV2.git
synced 2024-10-31 20:08:00 +00:00
修复协议版本758后TeleportationPacket数据包回应
This commit is contained in:
parent
904fc93515
commit
cc24f85abe
@ -1,6 +1,7 @@
|
||||
package cn.serendipityr.EndMinecraftPlusV2.VersionControl;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
|
||||
@ -98,14 +99,21 @@ public class VersionSupport758 {
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
public static void sendClientTeleportConfirmPacket(Session session, Packet packet) {
|
||||
public static void sendClientTeleportConfirmPacket(Session session, int id) {
|
||||
try {
|
||||
Class<?> cls = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket");
|
||||
Constructor<?> constructor = cls.getConstructor(int.class);
|
||||
Packet packet = (Packet) constructor.newInstance(id);
|
||||
session.send(packet);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
public static void sendClientTeleportConfirmPacket(Session session, ClientboundPlayerPositionPacket packet) {
|
||||
try {
|
||||
sendClientTeleportConfirmPacket(session, (int) ClientboundPlayerPositionPacket.class.getMethod("getTeleportId").invoke(packet));
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
public static void sendPosPacket(Session session, double x, double y, double z, float yaw, float pitch) {
|
||||
try {
|
||||
Class<?> cls = ServerboundMovePlayerPosRotPacket.class;
|
||||
|
Loading…
Reference in New Issue
Block a user