mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-06 00:18:36 +01:00
Better flyable NPCs
This commit is contained in:
parent
ab19a48d7f
commit
3b8cdae068
@ -97,8 +97,14 @@ public class Controllable extends Trait implements Toggleable {
|
||||
controller = new GroundController();
|
||||
return;
|
||||
}
|
||||
Constructor<? extends Controller> innerConstructor = null;
|
||||
try {
|
||||
innerConstructor = clazz.getConstructor(Controllable.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
Constructor<? extends Controller> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user