mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
test
This commit is contained in:
parent
f6d0db7bdf
commit
08d2001d37
@ -112,18 +112,23 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
if (npc == null)
|
||||
return;
|
||||
Navigation navigation = getNavigation();
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
|
||||
if (!navigation.f()) {
|
||||
navigation.e();
|
||||
moveOnCurrentHeading();
|
||||
} else if (!npc.getNavigator().isNavigating() && (motX != 0 || motZ != 0 || motY != 0)) {
|
||||
} else if (motX != 0 || motZ != 0 || motY != 0)
|
||||
e(0, 0); // is this necessary? it does gravity/controllable but
|
||||
// sometimes players sink into the ground
|
||||
}
|
||||
|
||||
if (noDamageTicks > 0)
|
||||
--noDamageTicks;
|
||||
npc.update();
|
||||
}
|
||||
|
||||
private static final float EPSILON = 0.005F;
|
||||
|
||||
private void initialise(MinecraftServer minecraftServer) {
|
||||
Socket socket = new EmptySocket();
|
||||
NetworkManager netMgr = null;
|
||||
|
@ -104,6 +104,7 @@ public class Controllable extends Trait implements Toggleable {
|
||||
} else
|
||||
controller = innerConstructor.newInstance(this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
controller = new GroundController();
|
||||
}
|
||||
}
|
||||
@ -148,11 +149,12 @@ public class Controllable extends Trait implements Toggleable {
|
||||
|
||||
@Override
|
||||
public void run(Player rider) {
|
||||
if (paused)
|
||||
if (paused) {
|
||||
getHandle().motY = 0;
|
||||
return;
|
||||
}
|
||||
Vector dir = rider.getEyeLocation().getDirection();
|
||||
double y = dir.getY();
|
||||
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier()).setY(y);
|
||||
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
EntityLiving handle = getHandle();
|
||||
handle.motX += dir.getX();
|
||||
handle.motY += dir.getY();
|
||||
@ -160,7 +162,7 @@ public class Controllable extends Trait implements Toggleable {
|
||||
}
|
||||
}
|
||||
|
||||
private static interface Controller {
|
||||
private interface Controller {
|
||||
void leftClick(PlayerInteractEvent event);
|
||||
|
||||
void rightClick(PlayerInteractEvent event);
|
||||
|
Loading…
Reference in New Issue
Block a user