use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int var0;
BlockPosition var1;
if (this.e() && this.b.isInWater()) {
var0 = MathHelper.floor(this.b.locY());
MutableBlockPosition varx = new MutableBlockPosition(this.b.locX(), var0, this.b.locZ());
for (IBlockData var2 = this.a.getType(varx); var2.getBlock() == Blocks.WATER || var2.getFluid() == FluidTypes.WATER.a(false); var2 = this.a.getType(varx)) {
++var0;
varx.c(this.b.locX(), var0, this.b.locZ());
}
--var0;
} else if (this.b.onGround) {
var0 = MathHelper.floor(this.b.locY() + 0.5D);
} else {
for (var1 = new BlockPosition(this.b); (this.a.getType(var1).isAir() || this.a.getType(var1).a(this.a, var1, PathMode.LAND)) && var1.getY() > 0; var1 = var1.down()) {
}
var0 = var1.up().getY();
}
var1 = new BlockPosition(this.b);
PathType var2 = this.a(this.b, var1.getX(), var0, var1.getZ());
if (this.b.a(var2) < 0.0F) {
Set<BlockPosition> var3 = Sets.newHashSet();
var3.add(new BlockPosition(this.b.getBoundingBox().minX, var0, this.b.getBoundingBox().minZ));
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<BlockPosition> var5 = var3.iterator();
while (var5.hasNext()) {
BlockPosition varb = var5.next();
PathType var6 = this.a(this.b, varb);
if (this.b.a(var6) >= 0.0F) {
return this.a(varb.getX(), varb.getY(), varb.getZ());
}
}
}
return this.a(var1.getX(), var0, var1.getZ());
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, EntityInsentient paramEntityInsentient, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2) {
EnumSet<PathType> localEnumSet = EnumSet.noneOf(PathType.class);
PathType localObject1 = PathType.BLOCKED;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = 0; i < paramInt4; i++) {
for (int k = 0; k < paramInt5; k++) {
for (int m = 0; m < paramInt6; m++) {
int n = i + paramInt1;
int i1 = k + paramInt2;
int i2 = m + paramInt3;
PathType localPathType2 = a(paramIBlockAccess, n, i1, i2);
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
localPathType2 = PathType.WALKABLE;
}
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
localPathType2 = PathType.BLOCKED;
}
if ((localPathType2 == PathType.RAIL) && (!(paramIBlockAccess.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
localPathType2 = PathType.FENCE;
}
if ((i == 0) && (k == 0) && (m == 0)) {
localObject1 = localPathType2;
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
PathType localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a(localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a(localObject2) == 0.0F)) {
return PathType.OPEN;
}
return localObject2;
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, EntityHumanNPC paramEntityInsentient, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2) {
EnumSet<PathType> localEnumSet = EnumSet.noneOf(PathType.class);
PathType localObject1 = PathType.BLOCKED;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = 0; i < paramInt4; i++) {
for (int k = 0; k < paramInt5; k++) {
for (int m = 0; m < paramInt6; m++) {
int n = i + paramInt1;
int i1 = k + paramInt2;
int i2 = m + paramInt3;
PathType localPathType2 = a(paramIBlockAccess, n, i1, i2);
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
localPathType2 = PathType.WALKABLE;
}
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
localPathType2 = PathType.BLOCKED;
}
if ((localPathType2 == PathType.RAIL) && (!(paramIBlockAccess.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
localPathType2 = PathType.FENCE;
}
if ((i == 0) && (k == 0) && (m == 0)) {
localObject1 = localPathType2;
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
PathType localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a(localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a(localObject2) == 0.0F)) {
return PathType.OPEN;
}
return localObject2;
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
PathPoint localPathPoint = null;
BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
BlockPosition localBlockPosition2 = localBlockPosition1.down();
double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).d(this.a, localBlockPosition2).e);
if (d1 - paramDouble > 1.125D) {
return null;
}
PathType localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
float f = this.b.a(localPathType1);
double d2 = this.b.width / 2.0D;
if (f >= 0.0F) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
}
if (localPathType1 == PathType.WALKABLE) {
return localPathPoint;
}
if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType1 != PathType.FENCE) && (localPathType1 != PathType.TRAPDOOR)) {
localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE)) && (this.b.width < 1.0F)) {
double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).d(this.a, localBlockPosition1);
AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.b(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
if (this.b.world.b(localAxisAlignedBB3)) {
localPathPoint = null;
}
}
}
if (localPathType1 == PathType.OPEN) {
AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
if (this.b.world.b(localAxisAlignedBB4)) {
return null;
}
if (this.b.width >= 1.0F) {
PathType localPathType2 = a(this.b, paramInt1, paramInt2 - 1, paramInt3);
if (localPathType2 == PathType.BLOCKED) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = PathType.WALKABLE;
localPathPoint.l = Math.max(localPathPoint.l, f);
return localPathPoint;
}
}
int i = 0;
while ((paramInt2 > 0) && (localPathType1 == PathType.OPEN)) {
paramInt2--;
if (i++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
return null;
}
localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
f = this.b.a(localPathType1);
if ((localPathType1 != PathType.OPEN) && (f >= 0.0F)) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
} else if (f < 0.0F) {
return null;
}
}
}
return localPathPoint;
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
private boolean a(int var0, int var1, int var2, int var3, int var4, int var5, Vec3D var6, double var7, double var9) {
int var11 = var0 - var3 / 2;
int var12 = var2 - var5 / 2;
if (!this.b(var11, var1, var12, var3, var4, var5, var6, var7, var9)) {
return false;
} else {
for (int var13 = var11; var13 < var11 + var3; ++var13) {
for (int var14 = var12; var14 < var12 + var5; ++var14) {
double var15 = var13 + 0.5D - var6.x;
double var17 = var14 + 0.5D - var6.z;
if (var15 * var7 + var17 * var9 >= 0.0D) {
PathType var19 = this.o.a(this.b, var13, var1 - 1, var14, this.a, var3, var4, var5, true, true);
if (var19 == PathType.WATER) {
return false;
}
if (var19 == PathType.LAVA) {
return false;
}
if (var19 == PathType.OPEN) {
return false;
}
var19 = this.o.a(this.b, var13, var1, var14, this.a, var3, var4, var5, true, true);
float var20 = this.a.a(var19);
if (var20 < 0.0F || var20 >= 8.0F) {
return false;
}
if (var19 == PathType.DAMAGE_FIRE || var19 == PathType.DANGER_FIRE || var19 == PathType.DAMAGE_OTHER) {
return false;
}
}
}
}
return true;
}
}
Aggregations