mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-07 08:58:10 +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();
|
controller = new GroundController();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Constructor<? extends Controller> innerConstructor = null;
|
||||||
|
try {
|
||||||
|
innerConstructor = clazz.getConstructor(Controllable.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Constructor<? extends Controller> innerConstructor = clazz.getConstructor(Controllable.class);
|
|
||||||
if (innerConstructor == null) {
|
if (innerConstructor == null) {
|
||||||
controller = clazz.newInstance();
|
controller = clazz.newInstance();
|
||||||
} else
|
} else
|
||||||
@ -156,9 +162,9 @@ public class Controllable extends Trait implements Toggleable {
|
|||||||
Vector dir = rider.getEyeLocation().getDirection();
|
Vector dir = rider.getEyeLocation().getDirection();
|
||||||
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
|
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
|
||||||
EntityLiving handle = getHandle();
|
EntityLiving handle = getHandle();
|
||||||
handle.motX += dir.getX();
|
handle.motX = dir.getX();
|
||||||
handle.motY += dir.getY();
|
handle.motY = dir.getY();
|
||||||
handle.motZ += dir.getZ();
|
handle.motZ = dir.getZ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user