Skip to content

Commit

Permalink
Fix flying move logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jan 17, 2017
1 parent a837624 commit db41864
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,16 @@ public Iterable<Vector> getPath() {

@Override
public void stop() {
if (navigation.k() != null) {
for (Player player : Bukkit.getOnlinePlayers()) {
for (int i = 0; i < navigation.k().d(); i++) {
PathPoint pp = navigation.k().a(i);
org.bukkit.block.Block block = new Vector(pp.a, pp.b, pp.c).toLocation(player.getWorld())
.getBlock();
player.sendBlockChange(block.getLocation(), block.getType(), block.getData());
}
}
}
stopNavigation(navigation);
}

Expand All @@ -507,6 +517,15 @@ public boolean update() {
// but we'd prefer to make it just fit on 1 so hack around it a bit.
lastSpeed = params.speed();
}
if (params.debug() && !NMSImpl.isNavigationFinished(navigation)) {
for (Player player : Bukkit.getOnlinePlayers()) {
for (int i = 0; i < navigation.k().d(); i++) {
PathPoint pp = navigation.k().a(i);
player.sendBlockChange(new Vector(pp.a, pp.b, pp.c).toLocation(player.getWorld()),
Material.YELLOW_FLOWER, (byte) 0);
}
}
}
navigation.a(params.speed());
return NMSImpl.isNavigationFinished(navigation);
}
Expand Down Expand Up @@ -1149,7 +1168,7 @@ public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
double d1 = entity.locY;
float f4 = entity instanceof EntityPolarBear ? 0.98F : 0.8F;
float f3 = 0.02F;
float f2 = EnchantmentManager.d(entity);
float f2 = EnchantmentManager.a(Enchantments.DEPTH_STRIDER, entity);
if (f2 > 3.0F) {
f2 = 3.0F;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ private PathEntity a(IBlockAccess paramIBlockAccess, EntityHumanNPC paramEntityI
this.d.a(paramIBlockAccess, paramEntityInsentient);
PathPoint localPathPoint1 = this.d.b();
PathPoint localPathPoint2 = this.d.a(paramDouble1, paramDouble2, paramDouble3);

PathEntity localPathEntity = a(localPathPoint1, localPathPoint2, paramFloat);

this.d.a();
Expand Down

0 comments on commit db41864

Please sign in to comment.