summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorEvilSeph <evilseph@unaligned.org>2011-04-23 04:18:00 -0400
committerEvilSeph <evilseph@unaligned.org>2011-04-23 04:18:00 -0400
commit5dfe732f1854a7ff83d96c06b7fa4b6305378daf (patch)
tree83ad9e6d6dd8d2d43200bb52918161c5fa7132b3 /src/main/java/net
parent2ad7856d78ea3306fab38c79f3f94ba73d52b7ee (diff)
downloadcraftbukkit-5dfe732f1854a7ff83d96c06b7fa4b6305378daf.tar
craftbukkit-5dfe732f1854a7ff83d96c06b7fa4b6305378daf.tar.gz
craftbukkit-5dfe732f1854a7ff83d96c06b7fa4b6305378daf.tar.lz
craftbukkit-5dfe732f1854a7ff83d96c06b7fa4b6305378daf.tar.xz
craftbukkit-5dfe732f1854a7ff83d96c06b7fa4b6305378daf.zip
Added reset for pitch/yaw if they are somehow set to NaN.
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/Entity.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 967856dd..f9d9482d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -147,7 +147,12 @@ public abstract class Entity {
protected void c(float f, float f1) {
// Craftbukkit start
- if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY) || (Float.isNaN(f))) {
+ if (Float.isNaN(f)) {
+ // CraftBukkit - yaw was sometimes set to NaN, so we need to set it back to 0.
+ f = 0;
+ }
+
+ if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) {
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
@@ -155,7 +160,12 @@ public abstract class Entity {
f = 0;
}
- if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY) || (Float.isNaN(f1))) {
+ if (Float.isNaN(f1)) {
+ // CraftBukkit - pitch was sometimes set to NaN, so we need to set it back to 0.
+ f1 = 0;
+ }
+
+ if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) {
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");