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