This commit is contained in:
fullwall 2012-09-06 17:35:10 +08:00
parent 64df7c8efb
commit 4073ceea54
7 changed files with 11 additions and 12 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.citizensnpcs</groupId> <groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId> <artifactId>citizens</artifactId>
<version>2.0</version> <version>2.0.1</version>
<name>Citizens</name> <name>Citizens</name>
<properties> <properties>
@ -103,10 +103,6 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>1.4</version> <version>1.4</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>

View File

@ -28,9 +28,7 @@ public class CitizensNavigator implements Navigator {
int lastX, lastY, lastZ; int lastX, lastY, lastZ;
private NavigatorParameters localParams = defaultParams; private NavigatorParameters localParams = defaultParams;
private final CitizensNPC npc; private final CitizensNPC npc;
private int stationaryTicks; private int stationaryTicks;
private boolean updatedAvoidWater = false; private boolean updatedAvoidWater = false;
public CitizensNavigator(CitizensNPC npc) { public CitizensNavigator(CitizensNPC npc) {

View File

@ -31,6 +31,7 @@ public class MCNavigationStrategy implements PathStrategy {
cancelReason = CancelReason.STUCK; cancelReason = CancelReason.STUCK;
} }
@Override
public CancelReason getCancelReason() { public CancelReason getCancelReason() {
return cancelReason; return cancelReason;
} }
@ -52,6 +53,8 @@ public class MCNavigationStrategy implements PathStrategy {
@Override @Override
public boolean update() { public boolean update() {
if (cancelReason != null)
return true;
navigation.a(parameters.avoidWater()); navigation.a(parameters.avoidWater());
navigation.a(parameters.speed()); navigation.a(parameters.speed());
return navigation.f(); return navigation.f();

View File

@ -75,12 +75,12 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
@Override @Override
public boolean update() { public boolean update() {
if (target == null) if (target == null || target.dead) {
return true;
if (target.dead) {
cancelReason = CancelReason.TARGET_DIED; cancelReason = CancelReason.TARGET_DIED;
return true; return true;
} }
if (cancelReason != null)
return true;
navigation.a(target, parameters.speed()); navigation.a(target, parameters.speed());
handle.getControllerLook().a(target, 10.0F, handle.bf()); handle.getControllerLook().a(target, 10.0F, handle.bf());
if (aggro && canAttack()) { if (aggro && canAttack()) {

View File

@ -135,7 +135,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
bt *= 0.9F; bt *= 0.9F;
float prev = aG; float prev = aG;
aG *= bs(); aG *= bs() * npc.getNavigator().getDefaultParameters().speed();
e(br, bs); // movement method e(br, bs); // movement method
aG = prev; aG = prev;
as = yaw; // update head yaw to match entity yaw as = yaw; // update head yaw to match entity yaw

View File

@ -160,6 +160,8 @@ public class LinearWaypointProvider implements WaypointProvider {
public void load(DataKey key) { public void load(DataKey key) {
for (DataKey root : key.getRelative("points").getIntegerSubKeys()) { for (DataKey root : key.getRelative("points").getIntegerSubKeys()) {
root = root.getRelative("location"); root = root.getRelative("location");
if (Bukkit.getWorld(root.getString("world")) == null)
continue;
waypoints.add(new Waypoint(new Location(Bukkit.getWorld(root.getString("world")), root waypoints.add(new Waypoint(new Location(Bukkit.getWorld(root.getString("world")), root
.getDouble("x"), root.getDouble("y"), root.getDouble("z"), (float) root.getDouble("yaw", .getDouble("x"), root.getDouble("y"), root.getDouble("z"), (float) root.getDouble("yaw",
0), (float) root.getDouble("pitch", 0)))); 0), (float) root.getDouble("pitch", 0))));

View File

@ -1,7 +1,7 @@
name: Citizens name: Citizens
authors: [aPunch, fullwall] authors: [aPunch, fullwall]
softdepend: [Vault] softdepend: [Vault]
version: 2.0 version: 2.0.1
main: net.citizensnpcs.Citizens main: net.citizensnpcs.Citizens
website: http://www.citizensnpcs.net website: http://www.citizensnpcs.net
commands: commands: