use of net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int i;
BlockPosition localObject1;
if ((e()) && (this.b.isInWater())) {
i = (int) this.b.getBoundingBox().b;
localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
Block localObject2 = this.a.getType(localObject1).getBlock();
while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
i++;
((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
localObject2 = this.a.getType(localObject1).getBlock();
}
} else if (this.b.onGround) {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
} else {
localObject1 = new BlockPosition(this.b);
while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
localObject1 = localObject1.down();
}
i = localObject1.up().getY();
}
localObject1 = new BlockPosition(this.b);
Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
if (this.b.a((PathType) localObject2) < 0.0F) {
HashSet<BlockPosition> localHashSet = Sets.newHashSet();
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
for (BlockPosition localBlockPosition : localHashSet) {
PathType localPathType = a(this.b, localBlockPosition);
if (this.b.a(localPathType) >= 0.0F) {
return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
}
}
}
return a(localObject1.getX(), i, localObject1.getZ());
}
use of net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition 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_14_R1.BlockPosition.MutableBlockPosition 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.getBoundingBox().minY);
var1 = new MutableBlockPosition(this.b.locX, var0, this.b.locZ);
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);
}
--var0;
} else if (this.b.onGround) {
var0 = MathHelper.floor(this.b.getBoundingBox().minY + 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 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 var5 = var3.iterator();
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(var4.getX(), var4.getY(), var4.getZ());
}
}
}
return this.a(var1.getX(), var0, var1.getZ());
}
use of net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int i;
BlockPosition localObject1;
if ((e()) && (this.b.isInWater())) {
i = (int) this.b.getBoundingBox().b;
localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
Block localObject2 = this.a.getType(localObject1).getBlock();
while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
i++;
((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
localObject2 = this.a.getType(localObject1).getBlock();
}
} else if (this.b.onGround) {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
} else {
localObject1 = new BlockPosition(this.b);
while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
localObject1 = localObject1.down();
}
i = localObject1.up().getY();
}
localObject1 = new BlockPosition(this.b);
Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
if (this.b.a((PathType) localObject2) < 0.0F) {
HashSet<BlockPosition> localHashSet = Sets.newHashSet();
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
for (BlockPosition localBlockPosition : localHashSet) {
PathType localPathType = a(this.b, localBlockPosition);
if (this.b.a(localPathType) >= 0.0F) {
return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
}
}
}
return a(localObject1.getX(), i, localObject1.getZ());
}
use of net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int i;
BlockPosition localObject1;
if ((e()) && (this.b.isInWater())) {
i = (int) this.b.getBoundingBox().b;
localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
Block localObject2 = this.a.getType(localObject1).getBlock();
while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
i++;
((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
localObject2 = this.a.getType(localObject1).getBlock();
}
} else if (!this.b.onGround) {
localObject1 = new BlockPosition(this.b);
while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
localObject1 = localObject1.down();
}
i = localObject1.up().getY();
} else {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
}
localObject1 = new BlockPosition(this.b);
Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
if (this.b.a((PathType) localObject2) < 0.0F) {
HashSet<BlockPosition> localHashSet = new HashSet<BlockPosition>();
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
for (BlockPosition localBlockPosition : localHashSet) {
PathType localPathType = a(this.b, localBlockPosition);
if (this.b.a(localPathType) >= 0.0F) {
return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
}
}
}
return a(localObject1.getX(), i, localObject1.getZ());
}
Aggregations