use of net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method getPathTypeBase.
public PathType getPathTypeBase(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
Block localBlock1 = localIBlockData.getBlock();
Material localMaterial = localIBlockData.getMaterial();
PathType localPathType1 = PathType.BLOCKED;
if ((localBlock1 == Blocks.TRAPDOOR) || (localBlock1 == Blocks.IRON_TRAPDOOR) || (localBlock1 == Blocks.WATERLILY)) {
return PathType.TRAPDOOR;
}
if (localBlock1 == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
}
if (localBlock1 == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_WOOD_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_IRON_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_OPEN;
}
if ((localBlock1 instanceof BlockMinecartTrackAbstract)) {
return PathType.RAIL;
}
if (((localBlock1 instanceof BlockFence)) || ((localBlock1 instanceof BlockCobbleWall)) || (((localBlock1 instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
return PathType.FENCE;
}
if (localMaterial == Material.AIR) {
localPathType1 = PathType.OPEN;
} else {
if (localMaterial == Material.WATER) {
return PathType.WATER;
}
if (localMaterial == Material.LAVA) {
return PathType.LAVA;
}
}
if ((localBlock1.b(paramIBlockAccess, localBlockPosition)) && (localPathType1 == PathType.BLOCKED)) {
localPathType1 = PathType.OPEN;
}
return localPathType1;
}
use of net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract 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);
Object localObject1 = PathType.BLOCKED;
double d = paramEntityInsentient.width / 2.0D;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = paramInt1; i < paramInt1 + paramInt4; i++) {
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
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 == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
localObject1 = localPathType2;
}
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D, m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
localPathType2 = PathType.OPEN;
}
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
Object localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
return PathType.OPEN;
}
return (PathType) localObject2;
}
use of net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract 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);
Object localObject1 = PathType.BLOCKED;
double d = paramEntityInsentient.width / 2.0D;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = paramInt1; i < paramInt1 + paramInt4; i++) {
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
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 == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
localObject1 = localPathType2;
}
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D, m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
localPathType2 = PathType.OPEN;
}
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
Object localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
return PathType.OPEN;
}
return (PathType) localObject2;
}
use of net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess var1, int var2, int var3, int var4, int var5, int var6, int var7, boolean var8, boolean var9, EnumSet var10, PathType var11, BlockPosition var12) {
for (int var13 = 0; var13 < var5; ++var13) {
for (int var14 = 0; var14 < var6; ++var14) {
for (int var15 = 0; var15 < var7; ++var15) {
int var16 = var13 + var2;
int var17 = var14 + var3;
int var18 = var15 + var4;
PathType var19 = this.a(var1, var16, var17, var18);
if (var19 == PathType.DOOR_WOOD_CLOSED && var8 && var9) {
var19 = PathType.WALKABLE;
}
if (var19 == PathType.DOOR_OPEN && !var9) {
var19 = PathType.BLOCKED;
}
if (var19 == PathType.RAIL && !(var1.getType(var12).getBlock() instanceof BlockMinecartTrackAbstract) && !(var1.getType(var12.down()).getBlock() instanceof BlockMinecartTrackAbstract)) {
var19 = PathType.FENCE;
}
if (var13 == 0 && var14 == 0 && var15 == 0) {
var11 = var19;
}
var10.add(var19);
}
}
}
return var11;
}
use of net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract 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;
}
Aggregations