Search in sources :

Example 6 with PathPoint

use of net.minecraft.server.v1_8_R3.PathPoint 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());
}
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) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) Block(net.minecraft.server.v1_12_R1.Block) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 7 with PathPoint

use of net.minecraft.server.v1_8_R3.PathPoint in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

private PathPoint a(Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    PathPoint localPathPoint = null;
    int k = a(paramEntity, paramInt1, paramInt2, paramInt3);
    if (k == 2) {
        return a(paramInt1, paramInt2, paramInt3);
    }
    if (k == 1) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (k != -3) && (k != -4) && (a(paramEntity, paramInt1, paramInt2 + paramInt4, paramInt3) == 1)) {
        localPathPoint = a(paramInt1, paramInt2 + paramInt4, paramInt3);
        paramInt2 += paramInt4;
    }
    if (localPathPoint != null) {
        int m = 0;
        int n = 0;
        while (paramInt2 > 0) {
            n = a(paramEntity, paramInt1, paramInt2 - 1, paramInt3);
            if ((this.h) && (n == -1)) {
                return null;
            }
            if (n == 1) {
                if (m++ >= paramEntity.aE()) {
                    return null;
                }
                paramInt2--;
                if (paramInt2 > 0) {
                    localPathPoint = a(paramInt1, paramInt2, paramInt3);
                } else {
                    return null;
                }
            }
        }
        if (n == -2) {
            return null;
        }
    }
    return localPathPoint;
}
Also used : PathPoint(net.minecraft.server.v1_8_R3.PathPoint) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 8 with PathPoint

use of net.minecraft.server.v1_8_R3.PathPoint in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

@Override
public PathPoint a(Entity paramEntity) {
    int k;
    if ((this.i) && (paramEntity.V())) {
        k = (int) paramEntity.getBoundingBox().b;
        BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
        Block localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
            k++;
            localMutableBlockPosition.c(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
            localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        }
        this.h = false;
    } else {
        k = MathHelper.floor(paramEntity.getBoundingBox().b + 0.5D);
    }
    return a(MathHelper.floor(paramEntity.getBoundingBox().a), k, MathHelper.floor(paramEntity.getBoundingBox().c));
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 9 with PathPoint

use of net.minecraft.server.v1_8_R3.PathPoint in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
    int i = 1;
    PathPoint localPathPoint = paramPathPoint2;
    while (localPathPoint.h != null) {
        i++;
        localPathPoint = localPathPoint.h;
    }
    PathPoint[] arrayOfPathPoint = new PathPoint[i];
    localPathPoint = paramPathPoint2;
    arrayOfPathPoint[(--i)] = localPathPoint;
    while (localPathPoint.h != null) {
        localPathPoint = localPathPoint.h;
        arrayOfPathPoint[(--i)] = localPathPoint;
    }
    return new PathEntity(arrayOfPathPoint);
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint) PathEntity(net.minecraft.server.v1_11_R1.PathEntity) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 10 with PathPoint

use of net.minecraft.server.v1_8_R3.PathPoint in project Citizens2 by CitizensDev.

the class PlayerPathfinderAbstract method a.

@Override
protected PathPoint a(int paramInt1, int paramInt2, int paramInt3) {
    int j = PathPoint.b(paramInt1, paramInt2, paramInt3);
    PathPoint localPathPoint = this.c.get(j);
    if (localPathPoint == null) {
        localPathPoint = new PathPoint(paramInt1, paramInt2, paramInt3);
        this.c.a(j, localPathPoint);
    }
    return localPathPoint;
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

PathPoint (net.minecraft.server.v1_11_R1.PathPoint)9 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)8 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)8 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)4 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)4 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)4 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathEntity (net.minecraft.server.v1_10_R1.PathEntity)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_11_R1.PathType)3 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_12_R1.PathType)3 CancelReason (net.citizensnpcs.api.ai.event.CancelReason)2 MCNavigator (net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator)2 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)2 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)2