Search in sources :

Example 71 with PathPoint

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

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int var1;
    BlockPosition var2;
    BoundingBox bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
    if (this.e() && this.b.isInWater()) {
        var1 = (int) bb.minY;
        MutableBlockPosition var8 = new MutableBlockPosition(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        for (Block var3 = this.a.getType(var8).getBlock(); var3 == Blocks.WATER; var3 = this.a.getType(var8).getBlock()) {
            ++var1;
            var8.c(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        }
    } else if (this.b.onGround) {
        var1 = MathHelper.floor(bb.minY + 0.5D);
    } else {
        for (var2 = new BlockPosition(this.b); (this.a.getType(var2).isAir() || this.a.getType(var2).a(this.a, var2, PathMode.LAND)) && var2.getY() > 0; var2 = var2.down()) {
            ;
        }
        var1 = var2.up().getY();
    }
    var2 = new BlockPosition(this.b);
    PathType var9 = this.a(this.b, var2.getX(), var1, var2.getZ());
    if (this.b.a(var9) < 0.0F) {
        HashSet var4 = Sets.newHashSet();
        bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
        var4.add(new BlockPosition(bb.minX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.minX, var1, bb.maxZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.maxZ));
        Iterator var5 = var4.iterator();
        while (var5.hasNext()) {
            BlockPosition var6 = (BlockPosition) var5.next();
            PathType var7 = this.a(this.b, var6);
            if (this.b.a(var7) >= 0.0F) {
                return this.a(var6.getX(), var6.getY(), var6.getZ());
            }
        }
    }
    return this.a(var2.getX(), var1, var2.getZ());
}
Also used : PathType(net.minecraft.server.v1_13_R2.PathType) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) BoundingBox(net.citizensnpcs.api.util.BoundingBox) Iterator(java.util.Iterator) Block(net.minecraft.server.v1_13_R2.Block) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_13_R2.PathPoint) HashSet(java.util.HashSet)

Example 72 with PathPoint

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

the class PlayerPathfinder method a.

public PathEntity a(ChunkCache var0, EntityHumanNPC var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
    this.d.a();
    this.c.a(var0, var1);
    PathPoint var6 = this.c.b();
    Map var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
        return this.c.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
    }, Function.identity()));
    PathEntity var8 = this.a(var6, var7, var3, var4, var5);
    this.c.a();
    return var8;
}
Also used : Pathfinder(net.minecraft.server.v1_16_R3.Pathfinder) ImmutableSet(com.google.common.collect.ImmutableSet) EntityHumanNPC(net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) Set(java.util.Set) Setting(net.citizensnpcs.Settings.Setting) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) ChunkCache(net.minecraft.server.v1_16_R3.ChunkCache) Sets(com.google.common.collect.Sets) EntityInsentient(net.minecraft.server.v1_16_R3.EntityInsentient) List(java.util.List) Stream(java.util.stream.Stream) Lists(com.google.common.collect.Lists) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) Map(java.util.Map) Optional(java.util.Optional) Path(net.minecraft.server.v1_16_R3.Path) Comparator(java.util.Comparator) PathDestination(net.minecraft.server.v1_16_R3.PathDestination) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) Map(java.util.Map)

Example 73 with PathPoint

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

the class PlayerPathfinder method a.

private PathEntity a(PathPoint var0, BlockPosition var1, boolean var2) {
    List<PathPoint> var3 = Lists.newArrayList();
    PathPoint var4 = var0;
    var3.add(0, var4);
    while (var4.h != null) {
        var4 = var4.h;
        var3.add(0, var4);
    }
    return new PathEntity(var3, var1, var2);
}
Also used : PathPoint(net.minecraft.server.v1_16_R3.PathPoint) PathEntity(net.minecraft.server.v1_16_R3.PathEntity)

Example 74 with PathPoint

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

the class PlayerPathfinder method a.

@Override
public PathEntity a(ChunkCache var0, EntityInsentient var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
    this.d.a();
    this.c.a(var0, var1);
    PathPoint var6 = this.c.b();
    Map var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
        return this.c.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
    }, Function.identity()));
    PathEntity var8 = this.a(var6, var7, var3, var4, var5);
    this.c.a();
    return var8;
}
Also used : Pathfinder(net.minecraft.server.v1_16_R3.Pathfinder) ImmutableSet(com.google.common.collect.ImmutableSet) EntityHumanNPC(net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) Set(java.util.Set) Setting(net.citizensnpcs.Settings.Setting) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) ChunkCache(net.minecraft.server.v1_16_R3.ChunkCache) Sets(com.google.common.collect.Sets) EntityInsentient(net.minecraft.server.v1_16_R3.EntityInsentient) List(java.util.List) Stream(java.util.stream.Stream) Lists(com.google.common.collect.Lists) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) Map(java.util.Map) Optional(java.util.Optional) Path(net.minecraft.server.v1_16_R3.Path) Comparator(java.util.Comparator) PathDestination(net.minecraft.server.v1_16_R3.PathDestination) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) Map(java.util.Map)

Example 75 with PathPoint

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

the class PlayerPathfinderNormal method a.

@Override
public int a(PathPoint[] var0, PathPoint var1) {
    int var2 = 0;
    int var3 = 0;
    PathType var4 = a(this.b, var1.a, var1.b + 1, var1.c);
    PathType var5 = a(this.b, var1.a, var1.b, var1.c);
    if (this.b.a(var4) >= 0.0F && var5 != PathType.STICKY_HONEY)
        var3 = MathHelper.d(Math.max(1.0F, this.b.G));
    double var6 = aa(this.a, new BlockPosition(var1.a, var1.b, var1.c));
    PathPoint var8 = a(var1.a, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
    if (a(var8, var1))
        var0[var2++] = var8;
    PathPoint var9 = a(var1.a - 1, var1.b, var1.c, var3, var6, EnumDirection.WEST, var5);
    if (a(var9, var1))
        var0[var2++] = var9;
    PathPoint var10 = a(var1.a + 1, var1.b, var1.c, var3, var6, EnumDirection.EAST, var5);
    if (a(var10, var1))
        var0[var2++] = var10;
    PathPoint var11 = a(var1.a, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
    if (a(var11, var1))
        var0[var2++] = var11;
    PathPoint var12 = a(var1.a - 1, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
    if (a(var1, var9, var11, var12))
        var0[var2++] = var12;
    PathPoint var13 = a(var1.a + 1, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
    if (a(var1, var10, var11, var13))
        var0[var2++] = var13;
    PathPoint var14 = a(var1.a - 1, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
    if (a(var1, var9, var8, var14))
        var0[var2++] = var14;
    PathPoint var15 = a(var1.a + 1, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
    if (a(var1, var10, var8, var15))
        var0[var2++] = var15;
    return var2;
}
Also used : PathType(net.minecraft.server.v1_16_R3.PathType) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Aggregations

PathPoint (net.minecraft.server.v1_16_R3.PathPoint)12 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)11 PathPoint (net.minecraft.server.v1_15_R1.PathPoint)11 List (java.util.List)10 Optional (java.util.Optional)9 Set (java.util.Set)9 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)9 PathPoint (net.minecraft.server.v1_13_R2.PathPoint)9 Vector (org.bukkit.util.Vector)9 Lists (com.google.common.collect.Lists)8 Sets (com.google.common.collect.Sets)8 Comparator (java.util.Comparator)8 Iterator (java.util.Iterator)8 Map (java.util.Map)8 Function (java.util.function.Function)8 Collectors (java.util.stream.Collectors)8 Stream (java.util.stream.Stream)8 Setting (net.citizensnpcs.Settings.Setting)8 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)8 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)8