Search in sources :

Example 1 with AxisAlignedBB

use of net.minecraft.server.v1_8_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class NMSImpl method setSize.

public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
    if ((f != entity.width) || (f1 != entity.length)) {
        float f2 = entity.width;
        entity.width = f;
        entity.length = f1;
        entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, entity.getBoundingBox().c + entity.width));
        if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
            entity.move((f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_10_R1.AxisAlignedBB)

Example 2 with AxisAlignedBB

use of net.minecraft.server.v1_8_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
    PathPoint localPathPoint = null;
    BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
    BlockPosition localBlockPosition2 = localBlockPosition1.down();
    double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).c(this.a, localBlockPosition2).e);
    if (d1 - paramDouble > 1.0D) {
        return null;
    }
    PathType localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
    float f = this.b.a(localPathType);
    double d2 = this.b.width / 2.0D;
    if (f >= 0.0F) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
        localPathPoint.m = localPathType;
        localPathPoint.l = Math.max(localPathPoint.l, f);
    }
    if (localPathType == PathType.WALKABLE) {
        return localPathPoint;
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType != PathType.FENCE) && (localPathType != PathType.TRAPDOOR)) {
        localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
        if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE))) {
            double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
            double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
            AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
            AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).c(this.a, localBlockPosition1);
            AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.a(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
            if (this.b.world.b(localAxisAlignedBB3)) {
                localPathPoint = null;
            }
        }
    }
    if (localPathType == PathType.OPEN) {
        AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
        if (this.b.world.b(localAxisAlignedBB4)) {
            return null;
        }
        int i = 0;
        while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) {
            paramInt2--;
            if (i++ >= this.b.aY()) {
                return null;
            }
            localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
            f = this.b.a(localPathType);
            if ((localPathType != PathType.OPEN) && (f >= 0.0F)) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = localPathType;
                localPathPoint.l = Math.max(localPathPoint.l, f);
            } else if (f < 0.0F) {
                return null;
            }
        }
    }
    return localPathPoint;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_10_R1.AxisAlignedBB) PathPoint(net.minecraft.server.v1_10_R1.PathPoint) PathType(net.minecraft.server.v1_10_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 3 with AxisAlignedBB

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

Example 4 with AxisAlignedBB

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

Example 5 with AxisAlignedBB

use of net.minecraft.server.v1_8_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
    PathPoint localPathPoint = null;
    BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
    BlockPosition localBlockPosition2 = localBlockPosition1.down();
    double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).d(this.a, localBlockPosition2).e);
    if (d1 - paramDouble > 1.125D) {
        return null;
    }
    PathType localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
    float f = this.b.a(localPathType1);
    double d2 = this.b.width / 2.0D;
    if (f >= 0.0F) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
        localPathPoint.m = localPathType1;
        localPathPoint.l = Math.max(localPathPoint.l, f);
    }
    if (localPathType1 == PathType.WALKABLE) {
        return localPathPoint;
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType1 != PathType.FENCE) && (localPathType1 != PathType.TRAPDOOR)) {
        localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
        if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE)) && (this.b.width < 1.0F)) {
            double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
            double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
            AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
            AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).d(this.a, localBlockPosition1);
            AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.b(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
            if (this.b.world.b(localAxisAlignedBB3)) {
                localPathPoint = null;
            }
        }
    }
    if (localPathType1 == PathType.OPEN) {
        AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
        if (this.b.world.b(localAxisAlignedBB4)) {
            return null;
        }
        if (this.b.width >= 1.0F) {
            PathType localPathType2 = a(this.b, paramInt1, paramInt2 - 1, paramInt3);
            if (localPathType2 == PathType.BLOCKED) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = PathType.WALKABLE;
                localPathPoint.l = Math.max(localPathPoint.l, f);
                return localPathPoint;
            }
        }
        int i = 0;
        while ((paramInt2 > 0) && (localPathType1 == PathType.OPEN)) {
            paramInt2--;
            if (i++ >= this.b.aY()) {
                return null;
            }
            localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
            f = this.b.a(localPathType1);
            if ((localPathType1 != PathType.OPEN) && (f >= 0.0F)) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = localPathType1;
                localPathPoint.l = Math.max(localPathPoint.l, f);
            } else if (f < 0.0F) {
                return null;
            }
        }
    }
    return localPathPoint;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_11_R1.AxisAlignedBB) PathPoint(net.minecraft.server.v1_11_R1.PathPoint) 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) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

Iterator (java.util.Iterator)21 List (java.util.List)21 Entity (org.bukkit.entity.Entity)21 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)9 LivingEntity (org.bukkit.entity.LivingEntity)8 AxisAlignedBB (net.minecraft.server.v1_11_R1.AxisAlignedBB)7 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)5 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)3 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)3 AxisAlignedBB (net.minecraft.server.v1_9_R1.AxisAlignedBB)3 AxisAlignedBB (net.minecraft.server.v1_9_R2.AxisAlignedBB)3 BlockMinecartTrackAbstract (net.minecraft.server.v1_10_R1.BlockMinecartTrackAbstract)2 AxisAlignedBB (net.minecraft.server.v1_4_5.AxisAlignedBB)2 AxisAlignedBB (net.minecraft.server.v1_4_6.AxisAlignedBB)2 AxisAlignedBB (net.minecraft.server.v1_4_R1.AxisAlignedBB)2