use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
protected static PathType b(IBlockAccess var0, BlockPosition var1) {
IBlockData var2 = var0.getType(var1);
Block var3 = var2.getBlock();
Material var4 = var2.getMaterial();
if (var2.isAir())
return PathType.OPEN;
if (var2.a(TagsBlock.TRAPDOORS) || var2.a(Blocks.LILY_PAD))
return PathType.TRAPDOOR;
if (var2.a(Blocks.CACTUS))
return PathType.DAMAGE_CACTUS;
if (var2.a(Blocks.SWEET_BERRY_BUSH))
return PathType.DAMAGE_OTHER;
if (var2.a(Blocks.HONEY_BLOCK))
return PathType.STICKY_HONEY;
if (var2.a(Blocks.COCOA))
return PathType.COCOA;
Fluid var5 = var0.getFluid(var1);
if (var5.a(TagsFluid.WATER))
return PathType.WATER;
if (var5.a(TagsFluid.LAVA))
return PathType.LAVA;
if (a(var2))
return PathType.DAMAGE_FIRE;
if (BlockDoor.l(var2) && !var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_WOOD_CLOSED;
if (var3 instanceof BlockDoor && var4 == Material.ORE && !var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_IRON_CLOSED;
if (var3 instanceof BlockDoor && var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_OPEN;
if (var3 instanceof BlockMinecartTrackAbstract)
return PathType.RAIL;
if (var3 instanceof BlockLeaves)
return PathType.LEAVES;
if (var3.a(TagsBlock.FENCES) || var3.a(TagsBlock.WALLS) || (var3 instanceof BlockFenceGate && !var2.get(BlockFenceGate.OPEN).booleanValue()))
return PathType.FENCE;
if (!var2.a(var0, var1, PathMode.LAND))
return PathType.BLOCKED;
return PathType.OPEN;
}
use of net.minecraft.server.v1_16_R3.PathType 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_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
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 localPathType1 = PathType.BLOCKED;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
localPathType1 = a(paramIBlockAccess, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6, paramBoolean1, paramBoolean2, localEnumSet, localPathType1, localBlockPosition);
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
Object localObject = PathType.BLOCKED;
for (PathType localPathType2 : localEnumSet) {
if (paramEntityInsentient.a(localPathType2) < 0.0F) {
return localPathType2;
}
if (paramEntityInsentient.a(localPathType2) >= paramEntityInsentient.a((PathType) localObject)) {
localObject = localPathType2;
}
}
if ((localPathType1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject) == 0.0F)) {
return PathType.OPEN;
}
return (PathType) localObject;
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
public static PathType b(IBlockAccess var0, int var1, int var2, int var3) {
PathType var4 = c(var0, var1, var2, var3);
if (var4 == PathType.OPEN && var2 >= 1) {
Block var5 = var0.getType(new BlockPosition(var1, var2 - 1, var3)).getBlock();
PathType var6 = c(var0, var1, var2 - 1, var3);
var4 = var6 != PathType.WALKABLE && var6 != PathType.OPEN && var6 != PathType.WATER && var6 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
if (var6 == PathType.DAMAGE_FIRE || var5 == Blocks.MAGMA_BLOCK || var5 == Blocks.CAMPFIRE) {
var4 = PathType.DAMAGE_FIRE;
}
if (var6 == PathType.DAMAGE_CACTUS) {
var4 = PathType.DAMAGE_CACTUS;
}
if (var6 == PathType.DAMAGE_OTHER) {
var4 = PathType.DAMAGE_OTHER;
}
if (var6 == PathType.STICKY_HONEY) {
var4 = PathType.STICKY_HONEY;
}
}
if (var4 == PathType.WALKABLE) {
var4 = a(var0, var1, var2, var3, var4);
}
return var4;
}
use of net.minecraft.server.v1_16_R3.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess var0, int var1, int var2, int var3, EntityInsentient var4, int var5, int var6, int var7, boolean var8, boolean var9) {
EnumSet<PathType> var10 = EnumSet.noneOf(PathType.class);
PathType var11 = PathType.BLOCKED;
double var12 = var4.getWidth() / 2.0D;
BlockPosition var14 = new BlockPosition(var4);
var11 = this.a(var0, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11, var14);
if (var10.contains(PathType.FENCE)) {
return PathType.FENCE;
} else {
PathType var15 = PathType.BLOCKED;
Iterator<PathType> var17 = var10.iterator();
while (var17.hasNext()) {
PathType var18 = var17.next();
if (var4.a(var18) < 0.0F) {
return var18;
}
if (var4.a(var18) >= var4.a(var15)) {
var15 = var18;
}
}
if (var11 == PathType.OPEN && var4.a(var15) == 0.0F) {
return PathType.OPEN;
} else {
return var15;
}
}
}
Aggregations