Skip to content

Commit

Permalink
Fixed incorrect look packets being sent
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksilassila committed Dec 17, 2021
1 parent 1c4050d commit 55e19ab
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.network.ClientConnection;
import net.minecraft.network.Packet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -20,18 +21,16 @@ public class ClientPlayNetworkHandlerMixin {
@Shadow
private MinecraftClient client;

@Inject(method = "sendPacket", at = @At("HEAD"))
public void sendPacket(Packet<?> packet, CallbackInfo ci) {
@Overwrite
public void sendPacket(Packet<?> packet) {
if (Implementation.isLookPacket(packet) && Printer.shouldBlockLookPackets()) {
Packet<?> positionOnlyPacket = Implementation.getMoveOnlyPacket(client.player, packet);

if (positionOnlyPacket != null) {
this.connection.send(positionOnlyPacket);
}

return;
} else {

this.connection.send(packet);
}
}
}

0 comments on commit 55e19ab

Please sign in to comment.