From 3b8cdae068e4e93dd5fb23600728e05092cb8693 Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 10 Oct 2012 21:45:34 +0800 Subject: [PATCH] Better flyable NPCs --- .../java/net/citizensnpcs/trait/Controllable.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java index d64f8bd85..a0fea41b0 100644 --- a/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -97,8 +97,14 @@ public class Controllable extends Trait implements Toggleable { controller = new GroundController(); return; } + Constructor innerConstructor = null; + try { + innerConstructor = clazz.getConstructor(Controllable.class); + } catch (Exception e) { + e.printStackTrace(); + } + try { - Constructor innerConstructor = clazz.getConstructor(Controllable.class); if (innerConstructor == null) { controller = clazz.newInstance(); } else @@ -156,9 +162,9 @@ public class Controllable extends Trait implements Toggleable { Vector dir = rider.getEyeLocation().getDirection(); dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier()); EntityLiving handle = getHandle(); - handle.motX += dir.getX(); - handle.motY += dir.getY(); - handle.motZ += dir.getZ(); + handle.motX = dir.getX(); + handle.motY = dir.getY(); + handle.motZ = dir.getZ(); } }