Skip to content

Commit

Permalink
Fix rotation.java, the look command
Browse files Browse the repository at this point in the history
How did THIS go unnoticed/!
  • Loading branch information
mcmonkey4eva committed Dec 8, 2014
1 parent fad99e3 commit 8a10e17
Showing 1 changed file with 7 additions and 3 deletions.
@@ -1,5 +1,6 @@
package net.aufdemrand.denizen.utilities.entity;

import net.aufdemrand.denizen.utilities.debugging.dB;
import net.minecraft.server.v1_8_R1.EntityHuman;
import net.minecraft.server.v1_8_R1.EntityLiving;
import org.bukkit.Location;
Expand Down Expand Up @@ -55,11 +56,11 @@ else if (entity instanceof LivingEntity) {

// Taken from C2 NMS class for less dependency on C2
private static void look(Entity entity, float yaw, float pitch) {
net.minecraft.server.v1_8_R1.Entity handle = !(entity instanceof CraftEntity)?null:((CraftEntity)entity).getHandle();
net.minecraft.server.v1_8_R1.Entity handle = ((CraftEntity)entity).getHandle();
if (handle != null) {
handle.yaw = yaw;
if(entity instanceof EntityLiving) {
EntityLiving livingHandle = (EntityLiving) entity;
if(handle instanceof EntityLiving) {
EntityLiving livingHandle = (EntityLiving) handle;
while (yaw < -180.0F) {
yaw += 360.0F;
}
Expand All @@ -73,6 +74,9 @@ private static void look(Entity entity, float yaw, float pitch) {
}
handle.pitch = pitch;
}
else {
dB.echoError("Rotation.jav#look: NPC has null handle!");
}
}


Expand Down

0 comments on commit 8a10e17

Please sign in to comment.