From fd56672131ca22baffc64769b07314bf3fb6245d Mon Sep 17 00:00:00 2001 From: aria1th <35677394+aria1th@users.noreply.github.com> Date: Fri, 14 Apr 2023 19:34:41 +0900 Subject: [PATCH] Fix bugs related to packet --- .../ClientPlayerEntityMixin.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/eatmyvenom/litematicin/mixin/quasiEssentialClient/ClientPlayerEntityMixin.java b/src/main/java/io/github/eatmyvenom/litematicin/mixin/quasiEssentialClient/ClientPlayerEntityMixin.java index b1d164e9..26d14574 100644 --- a/src/main/java/io/github/eatmyvenom/litematicin/mixin/quasiEssentialClient/ClientPlayerEntityMixin.java +++ b/src/main/java/io/github/eatmyvenom/litematicin/mixin/quasiEssentialClient/ClientPlayerEntityMixin.java @@ -42,8 +42,11 @@ private boolean canSendPacketNormally() { // if FakeAccurateBlockPlacement is active, then return false return !shouldModifyValues(); } - + //#if MC>=11904 @Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1), require = 0) + //#else + //$$@Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 2), require = 0) + //#endif private void onSendPacketVehicle(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet packet) { // replaces all packets with a fake packet if PRINTER_SUPPRESS_PACKETS is true if (canSendPacketNormally()) { @@ -58,7 +61,11 @@ private void onSendPacketVehicle(ClientPlayNetworkHandler clientPlayNetworkHandl )); } + //#if MC>=11904 @Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 2), require = 0) + //#else + //$$@Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 3), require = 0) + //#endif private void onSendPacketFull(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet packet) { if (canSendPacketNormally()) { clientPlayNetworkHandler.sendPacket(packet); @@ -72,7 +79,11 @@ private void onSendPacketFull(ClientPlayNetworkHandler clientPlayNetworkHandler, )); } + //#if MC>=11904 @Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 4), require = 0) + //#else + //$$@Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 5), require = 0) + //#endif private void onSendPacketLookAndOnGround(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet packet) { if (canSendPacketNormally()) { clientPlayNetworkHandler.sendPacket(packet);