Skip to content

Commit

Permalink
Fix bugs related to packet
Browse files Browse the repository at this point in the history
  • Loading branch information
aria1th committed Apr 14, 2023
1 parent 9197a91 commit fd56672
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit fd56672

Please sign in to comment.