Search in sources :

Example 16 with PathType

use of net.minecraft.server.v1_14_R1.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;
}
Also used : PathType(net.minecraft.server.v1_12_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition)

Example 17 with PathType

use of net.minecraft.server.v1_14_R1.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;
}
Also used : PathType(net.minecraft.server.v1_15_R1.PathType) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition) Block(net.minecraft.server.v1_15_R1.Block) TagsBlock(net.minecraft.server.v1_15_R1.TagsBlock)

Example 18 with PathType

use of net.minecraft.server.v1_14_R1.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;
        }
    }
}
Also used : PathType(net.minecraft.server.v1_15_R1.PathType) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition)

Example 19 with PathType

use of net.minecraft.server.v1_14_R1.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());
}
Also used : PathType(net.minecraft.server.v1_15_R1.PathType) IBlockData(net.minecraft.server.v1_15_R1.IBlockData) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

Example 20 with PathType

use of net.minecraft.server.v1_14_R1.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;
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) BlockMinecartTrackAbstract(net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

PathType (net.minecraft.server.v1_10_R1.PathType)8 PathType (net.minecraft.server.v1_12_R1.PathType)8 PooledBlockPosition (net.minecraft.server.v1_14_R1.BlockPosition.PooledBlockPosition)8 PathType (net.minecraft.server.v1_14_R1.PathType)8 PathType (net.minecraft.server.v1_15_R1.PathType)8 PathType (net.minecraft.server.v1_16_R3.PathType)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)7 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)7 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)7 PathType (net.minecraft.server.v1_11_R1.PathType)7 PathType (net.minecraft.server.v1_13_R2.PathType)7 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition)7 Iterator (java.util.Iterator)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)6 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)6 BlockPosition (net.minecraft.server.v1_13_R2.BlockPosition)6