Set head rotation pitch in addition to yaw in TPs

This commit is contained in:
Zach Brown 2017-01-07 21:32:11 -06:00
parent e4ef645032
commit b6c1b2d3e7
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -0,0 +1,48 @@
From bf4ed5aa40c8a1a993f19a827389037a379dee53 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Jan 2017 21:31:32 -0600
Subject: [PATCH] Set head rotation pitch in addition to yaw on TP
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ea36c53..e8fdded 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2213,8 +2213,10 @@ public abstract class Entity implements ICommandListener {
return 0.0F;
}
+ public final void setHeadRotationYaw(float yaw) { this.h(yaw); } // Paper - OBFHELPER
public void h(float f) {}
+ public final void setHeadRotationPitch(float pitch) { this.i(pitch); } // Paper - OBFHELPER
public void i(float f) {}
public boolean aV() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 2b1ca7e..4acb404 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -14,7 +14,6 @@ import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.metadata.MetadataValue;
@@ -275,7 +274,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// entity.setLocation() throws no event, and so cannot be cancelled
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// SPIGOT-619: Force sync head rotation also
- entity.h(location.getYaw()); // PAIL: setHeadRotation
+ // Paper start - GH-473 - Set pitch as well as yaw, rename both calls to use our obfuscation helpers
+ entity.setHeadRotationPitch(location.getPitch());
+ entity.setHeadRotationYaw(location.getYaw()); // PAIL: setHeadRotation
+ // Paper end
entity.world.entityJoinedWorld(entity, false); // Spigot - register to new chunk
return true;
--
2.9.3