Update for 1.14.4

This commit is contained in:
fullwall 2019-07-21 20:58:44 +08:00
parent f4ef934932
commit b1fc53f5e8
9 changed files with 256 additions and 232 deletions

View File

@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.14.3-R0.1-SNAPSHOT</craftbukkit.version>
<craftbukkit.version>1.14.4-R0.1-SNAPSHOT</craftbukkit.version>
</properties>
<repositories>

View File

@ -101,9 +101,9 @@ public class PigController extends MobEntityController {
}
@Override
public boolean dE() {
public boolean dD() {
// block carrot-on-a-stick behaviour
return npc == null ? super.dE() : false;
return npc == null ? super.dD() : false;
}
@Override

View File

@ -121,12 +121,12 @@ public class VillagerController extends MobEntityController {
}
@Override
public boolean dZ() {
public boolean dY() {
if (blockingATrade) {
blockingATrade = false;
return true;
}
return super.dZ();
return super.dY();
}
@Override

View File

@ -121,12 +121,12 @@ public class WanderingTraderController extends MobEntityController {
}
@Override
public boolean dZ() {
public boolean dY() {
if (blockingATrade) {
blockingATrade = false;
return true;
}
return super.dZ();
return super.dY();
}
@Override

View File

@ -20,7 +20,7 @@ public class CustomEntityRegistry extends RegistryBlocks {
private final RegistryMaterials<EntityTypes<?>> wrapped;
public CustomEntityRegistry(RegistryBlocks<EntityTypes<?>> original) {
super(original.a().b());
super(original.a().getNamespace());
this.wrapped = original;
}

View File

@ -454,13 +454,16 @@ public class NMSImpl implements NMSBridge {
@Override
public MCNavigator getTargetNavigator(org.bukkit.entity.Entity entity, Iterable<Vector> dest,
final NavigatorParameters params) {
final PathEntity path = new PathEntity(Lists.<PathPoint> newArrayList(
List<PathPoint> list = Lists.<PathPoint> newArrayList(
Iterables.<Vector, PathPoint> transform(dest, new Function<Vector, PathPoint>() {
@Override
public PathPoint apply(Vector input) {
return new PathPoint(input.getBlockX(), input.getBlockY(), input.getBlockZ());
}
})));
}));
PathPoint last = list.size() > 0 ? list.get(list.size() - 1) : null;
final PathEntity path = new PathEntity(list, last != null ? new BlockPosition(last.a, last.b, last.c) : null,
true);
return getTargetNavigator(entity, params, new Function<NavigationAbstract, Boolean>() {
@Override
public Boolean apply(NavigationAbstract input) {

View File

@ -1,6 +1,11 @@
package net.citizensnpcs.nms.v1_14_R1.util;
import java.util.Iterator;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.common.collect.ImmutableSet;
import net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC;
import net.minecraft.server.v1_14_R1.AttributeInstance;
@ -28,6 +33,7 @@ import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World;
public class PlayerNavigation extends NavigationAbstract {
protected EntityHumanNPC a;
protected final World b;
protected PathEntity c;
@ -46,7 +52,8 @@ public class PlayerNavigation extends NavigationAbstract {
private final AttributeInstance p;
private boolean pp;
private BlockPosition q;
private final PlayerPathfinder r;
private int r;
private final PlayerPathfinder s;
public PlayerNavigation(EntityHumanNPC entityinsentient, World world) {
super(getDummyInsentient(entityinsentient, world), world);
@ -58,7 +65,7 @@ public class PlayerNavigation extends NavigationAbstract {
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.o = new PlayerPathfinderNormal();
this.o.a(true);
this.r = new PlayerPathfinder(this.o, 768);
this.s = new PlayerPathfinder(this.o, 768);
this.setRange(24);
// this.b.C().a(this);
}
@ -75,23 +82,32 @@ public class PlayerNavigation extends NavigationAbstract {
}
@Override
protected PathEntity a(BlockPosition var0, double var1, double var3, double var5, int var7, boolean var8) {
if (!this.a()) {
return null;
} else if (this.c != null && !this.c.b() && var0.equals(this.q)) {
return this.c;
} else {
this.q = var0.immutableCopy();
float var9 = this.i();
this.b.getMethodProfiler().enter("pathfind");
BlockPosition var10 = var8 ? (new BlockPosition(this.a)).up() : new BlockPosition(this.a);
int var11 = (int) (var9 + var7);
IWorldReader var12 = new ChunkCache(this.b, var10.b(-var11, -var11, -var11), var10.b(var11, var11, var11));
PathEntity var13 = this.r.a(var12, this.a, var1, var3, var5, var9);
this.b.getMethodProfiler().exit();
return var13;
public PathEntity a(BlockPosition var0, int var1) {
BlockPosition var2;
if (this.b.getType(var0).isAir()) {
for (var2 = var0.down(); var2.getY() > 0 && this.b.getType(var2).isAir(); var2 = var2.down()) {
}
if (var2.getY() > 0) {
return supera(var2.up(), var1);
}
while (var2.getY() < this.b.getBuildHeight() && this.b.getType(var2).isAir()) {
var2 = var2.up();
}
var0 = var2;
}
if (!this.b.getType(var0).getMaterial().isBuildable()) {
return supera(var0, var1);
} else {
for (var2 = var0.up(); var2.getY() < this.b.getBuildHeight()
&& this.b.getType(var2).getMaterial().isBuildable(); var2 = var2.up()) {
}
return supera(var2, var1);
}
}
public void a(boolean var0) {
@ -105,22 +121,22 @@ public class PlayerNavigation extends NavigationAbstract {
@Override
public boolean a(double var0, double var2, double var4, double var6) {
return this.a(this.a(var0, var2, var4), var6);
}
@Override
public PathEntity a(Entity var0) {
return this.b(new BlockPosition(var0));
return this.a(this.a(var0, var2, var4, 1), var6);
}
@Override
public boolean a(Entity var0, double var1) {
PathEntity var3 = this.a(var0);
PathEntity var3 = this.a(var0, 1);
return var3 != null && this.a(var3, var1);
}
@Override
protected Pathfinder a(int var0) {
public PathEntity a(Entity var0, int var1) {
return this.a(ImmutableSet.of(new BlockPosition(var0)), 16, true, var1);
}
@Override
protected Pathfinder a(int var1) {
return null;
}
@ -190,6 +206,38 @@ public class PlayerNavigation extends NavigationAbstract {
}
}
@Override
protected PathEntity a(Set var0, int var1, boolean var2, int var3) {
if (var0.isEmpty()) {
return null;
} else if (this.a.locY < 0.0D) {
return null;
} else if (!this.a()) {
return null;
} else if (this.c != null && !this.c.b() && var0.contains(this.q)) {
return this.c;
} else {
this.b.getMethodProfiler().enter("pathfind");
float var4 = this.i();
BlockPosition var5 = var2 ? (new BlockPosition(this.a)).up() : new BlockPosition(this.a);
int var6 = (int) (var4 + var1);
IWorldReader var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3);
this.b.getMethodProfiler().exit();
if (var8 != null && var8.k() != null) {
this.q = var8.k();
this.r = var3;
}
return var8;
}
}
@Override
public PathEntity a(Stream var0, int var1) {
return this.a((Set) var0.collect(Collectors.toSet()), 8, false, var1);
}
@Override
protected void a(Vec3D var0) {
if (this.e - this.f > 100) {
@ -238,7 +286,7 @@ public class PlayerNavigation extends NavigationAbstract {
var9 *= var13;
var2 += 2;
var4 += 2;
if (!this.a(var5, (int) var0.y, var6, var2, var3, var4, var0, var7, var9)) {
if (!this.a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9)) {
return false;
} else {
var2 -= 2;
@ -278,7 +326,7 @@ public class PlayerNavigation extends NavigationAbstract {
var6 += var24;
var28 = var26 - var6;
}
} while (this.a(var5, (int) var0.y, var6, var2, var3, var4, var0, var7, var9));
} while (this.a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9));
return false;
}
@ -287,37 +335,19 @@ public class PlayerNavigation extends NavigationAbstract {
@Override
protected Vec3D b() {
return new Vec3D(this.a.locX, this.s(), this.a.locZ);
return new Vec3D(this.a.locX, this.t(), this.a.locZ);
}
@Override
public PathEntity b(BlockPosition var0) {
BlockPosition var1;
if (this.b.getType(var0).isAir()) {
for (var1 = var0.down(); var1.getY() > 0 && this.b.getType(var1).isAir(); var1 = var1.down()) {
;
public void b(BlockPosition var0) {
if (this.c != null && !this.c.b() && this.c.e() != 0) {
PathPoint var1 = this.c.c();
Vec3D var2 = new Vec3D((var1.a + this.a.locX) / 2.0D, (var1.b + this.a.locY) / 2.0D,
(var1.c + this.a.locZ) / 2.0D);
if (var0.a(var2, this.c.e() - this.c.f())) {
this.k();
}
if (var1.getY() > 0) {
return superb(var1.up());
}
while (var1.getY() < this.b.getHeight() && this.b.getType(var1).isAir()) {
var1 = var1.up();
}
var0 = var1;
}
if (!this.b.getType(var0).getMaterial().isBuildable()) {
return superb(var0);
} else {
for (var1 = var0.up(); var1.getY() < this.b.getHeight()
&& this.b.getType(var1).getMaterial().isBuildable(); var1 = var1.up()) {
;
}
return superb(var1);
}
}
@ -325,6 +355,7 @@ public class PlayerNavigation extends NavigationAbstract {
double var9) {
Iterator var12 = BlockPosition.a(new BlockPosition(var0, var1, var2),
new BlockPosition(var0 + var3 - 1, var1 + var4 - 1, var2 + var5 - 1)).iterator();
BlockPosition var14;
double var13;
double var15;
@ -371,19 +402,6 @@ public class PlayerNavigation extends NavigationAbstract {
}
}
@Override
public void c(BlockPosition var0) {
if (this.c != null && !this.c.b() && this.c.e() != 0) {
PathPoint var1 = this.c.c();
Vec3D var2 = new Vec3D((var1.a + this.a.locX) / 2.0D, (var1.b + this.a.locY) / 2.0D,
(var1.c + this.a.locZ) / 2.0D);
if (var0.a(var2, this.c.e() - this.c.f())) {
this.k();
}
}
}
public void c(boolean var0) {
this.pp = var0;
}
@ -397,8 +415,7 @@ public class PlayerNavigation extends NavigationAbstract {
protected void D_() {
superD_();
if (this.pp) {
if (this.b.f(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().minY + 0.5D),
MathHelper.floor(this.a.locZ)))) {
if (this.b.f(new BlockPosition(this.a.locX, this.a.getBoundingBox().minY + 0.5D, this.a.locZ))) {
return;
}
@ -437,7 +454,7 @@ public class PlayerNavigation extends NavigationAbstract {
if (this.b.getTime() - this.n > 20L) {
if (this.q != null) {
this.c = null;
this.c = this.b(this.q);
this.c = this.a(this.q, this.r);
this.n = this.b.getTime();
this.m = false;
}
@ -455,35 +472,13 @@ public class PlayerNavigation extends NavigationAbstract {
@Override
protected void m() {
Vec3D var0 = this.b();
int var1 = this.c.e();
for (int var2 = this.c.f(); var2 < this.c.e(); ++var2) {
if (this.c.a(var2).b != Math.floor(var0.y)) {
var1 = var2;
break;
}
}
this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
Vec3D var2 = this.c.g();
if (Math.abs(this.a.locX - (var2.x + 0.5D)) < this.l && Math.abs(this.a.locZ - (var2.z + 0.5D)) < this.l
&& Math.abs(this.a.locY - var2.y) < 1.0D) {
Vec3D var1 = this.c.g();
if (Math.abs(this.a.locX - (var1.x + 0.5D)) < this.l && Math.abs(this.a.locZ - (var1.z + 0.5D)) < this.l
&& Math.abs(this.a.locY - var1.y) < 1.0D) {
this.c.c(this.c.f() + 1);
}
if (this.a.world.getTime() % 5L == 0L) {
int var3 = MathHelper.f(this.a.getWidth());
int var4 = MathHelper.f(this.a.getHeight());
int var5 = var3;
for (int var6 = var1 - 1; var6 >= this.c.f(); --var6) {
if (this.a(var0, this.c.a(this.a, var6), var3, var4, var5)) {
this.c.c(var6);
break;
}
}
}
this.a(var0);
}
@ -499,7 +494,7 @@ public class PlayerNavigation extends NavigationAbstract {
@Override
protected boolean p() {
return this.a.au() || this.a.aD();
return this.a.av() || this.a.aD();
}
@Override
@ -512,49 +507,12 @@ public class PlayerNavigation extends NavigationAbstract {
return this.o.e();
}
private int s() {
if (this.a.isInWater() && this.r()) {
int var0 = (int) this.a.getBoundingBox().minY;
Block var1 = this.b
.getType(new BlockPosition(MathHelper.floor(this.a.locX), var0, MathHelper.floor(this.a.locZ)))
.getBlock();
int var2 = 0;
do {
if (var1 != Blocks.WATER) {
return var0;
}
++var0;
var1 = this.b
.getType(new BlockPosition(MathHelper.floor(this.a.locX), var0, MathHelper.floor(this.a.locZ)))
.getBlock();
++var2;
} while (var2 <= 16);
return (int) this.a.getBoundingBox().minY;
} else {
return (int) (this.a.getBoundingBox().minY + 0.5D);
}
}
public void setRange(float pathfindingRange) {
this.p.setValue(pathfindingRange);
}
public PathEntity supera(Entity var0) {
BlockPosition var1 = new BlockPosition(var0);
double var2 = var0.locX;
double var4 = var0.getBoundingBox().minY;
double var6 = var0.locZ;
return this.a(var1, var2, var4, var6, 16, true);
}
public PathEntity superb(BlockPosition var0) {
float var1 = var0.getX() + 0.5F;
float var2 = var0.getY() + 0.5F;
float var3 = var0.getZ() + 0.5F;
return this.a(var0, var1, var2, var3, 8, false);
public PathEntity supera(BlockPosition var0, int var1) {
return this.a(ImmutableSet.of(var0), 8, false, var1);
}
protected void superD_() {
@ -575,6 +533,28 @@ public class PlayerNavigation extends NavigationAbstract {
}
}
private int t() {
if (this.a.isInWater() && this.r()) {
int var0 = MathHelper.floor(this.a.getBoundingBox().minY);
Block var1 = this.b.getType(new BlockPosition(this.a.locX, var0, this.a.locZ)).getBlock();
int var2 = 0;
do {
if (var1 != Blocks.WATER) {
return var0;
}
++var0;
var1 = this.b.getType(new BlockPosition(this.a.locX, var0, this.a.locZ)).getBlock();
++var2;
} while (var2 <= 16);
return MathHelper.floor(this.a.getBoundingBox().minY);
} else {
return MathHelper.floor(this.a.getBoundingBox().minY + 0.5D);
}
}
private static EntityInsentient getDummyInsentient(EntityHumanNPC from, World world) {
return new EntityInsentient(EntityTypes.VILLAGER, world) {
};

View File

@ -1,15 +1,24 @@
package net.citizensnpcs.nms.v1_14_R1.util;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.EntityInsentient;
import net.minecraft.server.v1_14_R1.IWorldReader;
import net.minecraft.server.v1_14_R1.Path;
import net.minecraft.server.v1_14_R1.PathDestination;
import net.minecraft.server.v1_14_R1.PathEntity;
import net.minecraft.server.v1_14_R1.PathPoint;
import net.minecraft.server.v1_14_R1.Pathfinder;
@ -28,95 +37,122 @@ public class PlayerPathfinder extends Pathfinder {
}
public PathEntity a(IWorldReader var0, EntityHumanNPC var1, double var2, double var4, double var6, float var8) {
public PathEntity a(IWorldReader var0, EntityHumanNPC var1, Set<BlockPosition> var2, float var3, int var4) {
this.a.a();
this.e.a(var0, var1);
PathPoint var9 = this.e.b();
PathPoint var10 = this.e.a(var2, var4, var6);
PathEntity var11 = this.a(var9, var10, var8);
PathPoint var5 = this.e.b();
Map var6 = var2.stream().collect(Collectors.toMap((var0x) -> {
return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
}, Function.identity()));
PathEntity var7 = this.a(var5, var6, var3, var4);
this.e.a();
return var11;
return var7;
}
@Override
public PathEntity a(IWorldReader var0, EntityInsentient var1, double var2, double var4, double var6, float var8) {
public PathEntity a(IWorldReader var0, EntityInsentient var1, Set<BlockPosition> var2, float var3, int var4) {
this.a.a();
this.e.a(var0, var1);
PathPoint var9 = this.e.b();
PathPoint var10 = this.e.a(var2, var4, var6);
PathEntity var11 = this.a(var9, var10, var8);
PathPoint var5 = this.e.b();
Map var6 = var2.stream().collect(Collectors.toMap((var0x) -> {
return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
}, Function.identity()));
PathEntity var7 = this.a(var5, var6, var3, var4);
this.e.a();
return var11;
return var7;
}
private PathEntity a(PathPoint var0) {
List var1 = Lists.newArrayList();
PathPoint var2 = var0;
var1.add(0, var0);
private PathEntity a(PathPoint var0, BlockPosition var1, boolean var2) {
List var3 = Lists.newArrayList();
PathPoint var4 = var0;
var3.add(0, var0);
while (var2.h != null) {
var2 = var2.h;
var1.add(0, var2);
while (var4.h != null) {
var4 = var4.h;
var3.add(0, var4);
}
return new PathEntity(var1);
return new PathEntity(var3, var1, var2);
}
private PathEntity a(PathPoint var0, PathPoint var1, float var2) {
private PathEntity a(PathPoint var0, Map var1, float var2, int var3) {
Set<PathDestination> var4 = var1.keySet();
var0.e = 0.0F;
var0.f = var0.a(var1);
var0.f = this.a(var0, var4);
var0.g = var0.f;
this.a.a();
this.b.clear();
this.a.a(var0);
PathPoint var3 = var0;
int var4 = 0;
int var5 = 0;
while (!this.a.e()) {
++var4;
if (var4 >= this.d) {
++var5;
if (var5 >= this.d) {
break;
}
PathPoint var5 = this.a.c();
var5.i = true;
if (var5.equals(var1)) {
var3 = var1;
PathPoint var6 = this.a.c();
var6.i = true;
var4.stream().filter((var2x) -> {
return var6.c(var2x) <= var3;
}).forEach(PathDestination::e);
if (var4.stream().anyMatch(PathDestination::f)) {
break;
}
if (var5.a(var1) < var3.a(var1)) {
var3 = var5;
}
if (var6.a(var0) < var2) {
int var7 = this.e.a(this.c, var6);
if (var5.a(var1) < var2) {
int var6 = this.e.a(this.c, var5);
for (int var7 = 0; var7 < var6; ++var7) {
PathPoint var8 = this.c[var7];
float var9 = var5.a(var8);
var8.j = var5.j + var9;
float var10 = var5.e + var9 + var8.k;
if (var8.j < var2 && (!var8.c() || var10 < var8.e)) {
var8.h = var5;
var8.e = var10;
var8.f = var8.a(var1) * 1.5F + var8.k;
if (var8.c()) {
this.a.a(var8, var8.e + var8.f);
for (int var8 = 0; var8 < var7; ++var8) {
PathPoint var9 = this.c[var8];
float var10 = var6.a(var9);
var9.j = var6.j + var10;
float var11 = var6.e + var10 + var9.k;
if (var9.j < var2 && (!var9.c() || var11 < var9.e)) {
var9.h = var6;
var9.e = var11;
var9.f = this.a(var9, var4) * 1.5F;
if (var9.c()) {
this.a.a(var9, var9.e + var9.f);
} else {
var8.g = var8.e + var8.f;
this.a.a(var8);
var9.g = var9.e + var9.f;
this.a.a(var9);
}
}
}
}
}
if (var3.equals(var0)) {
Stream var6;
if (var4.stream().anyMatch(PathDestination::f)) {
var6 = var4.stream().filter(PathDestination::f).map((var1x) -> {
return this.a(var1x.d(), (BlockPosition) var1.get(var1x), true);
}).sorted(Comparator.comparingInt(PathEntity::e));
} else {
var6 = var4.stream().map((var1x) -> {
return this.a(var1x.d(), (BlockPosition) var1.get(var1x), false);
}).sorted(Comparator.comparingDouble(PathEntity::l).thenComparingInt(PathEntity::e));
}
Optional var7 = var6.findFirst();
if (!var7.isPresent()) {
return null;
} else {
PathEntity var5 = this.a(var3);
return var5;
PathEntity var8 = (PathEntity) var7.get();
return var8;
}
}
private float a(PathPoint var0, Set var1) {
float var2 = Float.MAX_VALUE;
float var5;
for (Iterator var4 = var1.iterator(); var4.hasNext(); var2 = Math.min(var5, var2)) {
PathDestination var3 = (PathDestination) var4.next();
var5 = var0.a(var3);
var3.a(var5, var0);
}
return var2;
}
}

View File

@ -21,11 +21,12 @@ import net.minecraft.server.v1_14_R1.EntityInsentient;
import net.minecraft.server.v1_14_R1.EnumDirection;
import net.minecraft.server.v1_14_R1.EnumDirection.EnumAxis;
import net.minecraft.server.v1_14_R1.Fluid;
import net.minecraft.server.v1_14_R1.FluidTypes;
import net.minecraft.server.v1_14_R1.IBlockAccess;
import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.IWorldReader;
import net.minecraft.server.v1_14_R1.Material;
import net.minecraft.server.v1_14_R1.MathHelper;
import net.minecraft.server.v1_14_R1.PathDestination;
import net.minecraft.server.v1_14_R1.PathMode;
import net.minecraft.server.v1_14_R1.PathPoint;
import net.minecraft.server.v1_14_R1.PathType;
@ -43,8 +44,8 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
}
@Override
public PathPoint a(double var0, double var2, double var4) {
return this.a(MathHelper.floor(var0), MathHelper.floor(var2), MathHelper.floor(var4));
public PathDestination a(double var0, double var2, double var4) {
return new PathDestination(this.a(MathHelper.floor(var0), MathHelper.floor(var2), MathHelper.floor(var4)));
}
private PathType a(EntityHumanNPC var0, BlockPosition var1) {
@ -121,16 +122,16 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
return PathType.FENCE;
} else {
PathType var15 = PathType.BLOCKED;
Iterator var16 = var10.iterator();
Iterator var17 = var10.iterator();
while (var16.hasNext()) {
PathType var17 = (PathType) var16.next();
if (var4.a(var17) < 0.0F) {
return var17;
while (var17.hasNext()) {
PathType var16 = (PathType) var17.next();
if (var4.a(var16) < 0.0F) {
return var16;
}
if (var4.a(var17) >= var4.a(var15)) {
var15 = var17;
if (var4.a(var16) >= var4.a(var15)) {
var15 = var16;
}
}
@ -154,16 +155,16 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
return PathType.FENCE;
} else {
PathType var15 = PathType.BLOCKED;
Iterator var16 = var10.iterator();
Iterator var17 = var10.iterator();
while (var16.hasNext()) {
PathType var17 = (PathType) var16.next();
if (var4.a(var17) < 0.0F) {
return var17;
while (var17.hasNext()) {
PathType var16 = (PathType) var17.next();
if (var4.a(var16) < 0.0F) {
return var16;
}
if (var4.a(var17) >= var4.a(var15)) {
var15 = var17;
if (var4.a(var16) >= var4.a(var15)) {
var15 = var16;
}
}
@ -200,7 +201,7 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
public PathType a(IBlockAccess var0, int var1, int var2, int var3, PathType var4) {
if (var4 == PathType.WALKABLE) {
PooledBlockPosition var5 = PooledBlockPosition.r();
Throwable var6 = null;
Throwable tt = null;
try {
for (int var7 = -1; var7 <= 1; ++var7) {
@ -218,15 +219,15 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
}
}
} catch (Throwable var18) {
var6 = var18;
tt = var18;
throw var18;
} finally {
if (var5 != null) {
if (var6 != null) {
if (tt != null) {
try {
var5.close();
} catch (Throwable var17) {
var6.addSuppressed(var17);
tt.addSuppressed(var17);
}
} else {
var5.close();
@ -270,7 +271,7 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
var15 + var13,
this.b.getHeight() + a(this.a, (new BlockPosition(var7.a, var7.b, var7.c))) - 0.002D,
var17 + var13);
if (!(this.a).getCubes(this.b, var19)) {
if (!this.a.getCubes(this.b, var19)) {
var7 = null;
}
}
@ -297,7 +298,7 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
if (var11 == PathType.OPEN) {
AxisAlignedBB var15 = new AxisAlignedBB(var0 - var13 + 0.5D, var1 + 0.001D, var2 - var13 + 0.5D,
var0 + var13 + 0.5D, var1 + this.b.getHeight(), var2 + var13 + 0.5D);
if (!(this.a).getCubes(this.b, var15)) {
if (!this.a.getCubes(this.b, var15)) {
return null;
}
@ -353,15 +354,18 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
}
}
@Override
public void a(IWorldReader var0, EntityInsentient var1) {
super.a(var0, var1);
this.j = var1.a(PathType.WATER);
}
private boolean a(PathPoint var0, PathPoint var1, PathPoint var2, PathPoint var3) {
return var3 != null && !var3.i && var2 != null && var2.k >= 0.0F && var2.b <= var0.b && var1 != null
&& var1.k >= 0.0F && var1.b <= var0.b;
if (var3 != null && var2 != null && var1 != null) {
if (var3.i) {
return false;
} else if (var2.b <= var0.b && var1.b <= var0.b) {
return var3.k >= 0.0F && (var2.b < var0.b || var2.k >= 0.0F) && (var1.b < var0.b || var1.k >= 0.0F);
} else {
return false;
}
} else {
return false;
}
}
@Override
@ -425,8 +429,8 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
var0 = MathHelper.floor(this.b.getBoundingBox().minY);
var1 = new MutableBlockPosition(this.b.locX, var0, this.b.locZ);
for (Block var2 = this.a.getType(var1).getBlock(); var2 == Blocks.WATER; var2 = this.a.getType(var1)
.getBlock()) {
for (IBlockData var2 = this.a.getType(var1); var2.getBlock() == Blocks.WATER
|| var2.p() == FluidTypes.WATER.a(false); var2 = this.a.getType(var1)) {
++var0;
((MutableBlockPosition) var1).c(this.b.locX, var0, this.b.locZ);
}
@ -451,13 +455,13 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
var3.add(new BlockPosition(this.b.getBoundingBox().minX, var0, this.b.getBoundingBox().maxZ));
var3.add(new BlockPosition(this.b.getBoundingBox().maxX, var0, this.b.getBoundingBox().minZ));
var3.add(new BlockPosition(this.b.getBoundingBox().maxX, var0, this.b.getBoundingBox().maxZ));
Iterator var4 = var3.iterator();
Iterator var5 = var3.iterator();
while (var4.hasNext()) {
BlockPosition var5 = (BlockPosition) var4.next();
PathType var6 = this.a(this.b, var5);
while (var5.hasNext()) {
BlockPosition var4 = (BlockPosition) var5.next();
PathType var6 = this.a(this.b, var4);
if (this.b.a(var6) >= 0.0F) {
return this.a(var5.getX(), var5.getY(), var5.getZ());
return this.a(var4.getX(), var4.getY(), var4.getZ());
}
}
}
@ -512,4 +516,5 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
VoxelShape var3 = var0.getType(var2).getCollisionShape(var0, var2);
return var2.getY() + (var3.isEmpty() ? 0.0D : var3.c(EnumAxis.Y));
}
}