Files
MiraiMC/patches/server/0099-Fix-head-rotation-packet-spam.patch
2022-06-28 21:25:08 +02:00

26 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: cswhite2000 <18whitechristop@gmail.com>
Date: Sun, 5 Aug 2018 15:00:46 -0700
Subject: [PATCH] Fix head rotation packet spam
Original license: GPLv3
Original project: https://github.com/Electroid/SportPaper
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index d03fd8927eebb8df8697cdf7383f66b0b6576d5b..adbc648ab5465b3808b19481650170a8cb57ace3 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -342,8 +342,10 @@ public class ServerEntity {
}
// CraftBukkit start - Fix for nonsensical head yaw
- this.yHeadRotp = Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F);
- consumer.accept(new ClientboundRotateHeadPacket(this.entity, (byte) this.yHeadRotp));
+ if (this.entity instanceof LivingEntity) { // SportPaper - Fix head rotation packet spam
+ this.yHeadRotp = Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F);
+ consumer.accept(new ClientboundRotateHeadPacket(this.entity, (byte) this.yHeadRotp));
+ }
// CraftBukkit end
if (this.entity instanceof LivingEntity) {