Search in sources :

Example 71 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Citizens2 by CitizensDev.

the class PlayerNavigation method c.

@Override
public void c() {
    this.e++;
    if (this.m)
        j();
    if (m())
        return;
    if (a()) {
        l();
    } else if (this.c != null && !this.c.c()) {
        Vec3D vec3D1 = b();
        Vec3D vec3D2 = this.c.a(this.a);
        if (vec3D1.y > vec3D2.y && !this.a.isOnGround() && MathHelper.floor(vec3D1.x) == MathHelper.floor(vec3D2.x) && MathHelper.floor(vec3D1.z) == MathHelper.floor(vec3D2.z))
            this.c.a();
    }
    if (m())
        return;
    Vec3D var0 = this.c.a(this.a);
    BlockPosition var1 = new BlockPosition(var0);
    this.a.getControllerMove().a(var0.x, this.b.getType(var1.down()).isAir() ? var0.y : PathfinderNormal.a(this.b, var1), var0.z, this.d);
}
Also used : BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition) Vec3D(net.minecraft.server.v1_16_R3.Vec3D)

Example 72 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Citizens2 by CitizensDev.

the class PlayerNavigation method u.

private int u() {
    if (!this.a.isInWater() || !r())
        return MathHelper.floor(this.a.locY() + 0.5D);
    int var0 = MathHelper.floor(this.a.locY());
    Block var1 = this.b.getType(new BlockPosition(this.a.locX(), var0, this.a.locZ())).getBlock();
    int var2 = 0;
    while (var1 == Blocks.WATER) {
        var0++;
        var1 = this.b.getType(new BlockPosition(this.a.locX(), var0, this.a.locZ())).getBlock();
        if (++var2 > 16)
            return MathHelper.floor(this.a.locY());
    }
    return var0;
}
Also used : BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition) Block(net.minecraft.server.v1_16_R3.Block) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 73 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

@Override
protected PathEntity a(Set<BlockPosition> var0, int var1, boolean var2, int var3) {
    if (var0.isEmpty())
        return null;
    if (this.a.locY() < 0.0D)
        return null;
    if (!a())
        return null;
    if (this.c != null && !this.c.c() && var0.contains(this.p))
        return this.c;
    this.b.getMethodProfiler().enter("pathfind");
    float var4 = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
    BlockPosition var5 = var2 ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
    int var6 = (int) (var4 + var1);
    ChunkCache var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
    PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3, this.r);
    this.b.getMethodProfiler().exit();
    if (var8 != null && var8.m() != null) {
        this.p = var8.m();
        this.q = var3;
        e();
    }
    return var8;
}
Also used : ChunkCache(net.minecraft.server.v1_16_R3.ChunkCache) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 74 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

@Override
public PathEntity a(BlockPosition var0, int var1) {
    if (this.b.getType(var0).isAir()) {
        BlockPosition var2 = var0.down();
        while (var2.getY() > 0 && this.b.getType(var2).isAir()) var2 = var2.down();
        if (var2.getY() > 0)
            return supera(var2.up(), var1);
        while (var2.getY() < this.b.getBuildHeight() && this.b.getType(var2).isAir()) var2 = var2.up();
        var0 = var2;
    }
    if (this.b.getType(var0).getMaterial().isBuildable()) {
        BlockPosition var2 = var0.up();
        while (var2.getY() < this.b.getBuildHeight() && this.b.getType(var2).getMaterial().isBuildable()) var2 = var2.up();
        return supera(var2, var1);
    }
    return supera(var0, var1);
}
Also used : BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition)

Example 75 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition 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.a.a();
    this.e.a(var0, var1);
    PathPoint var6 = this.e.b();
    Map<PathDestination, BlockPosition> var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
        return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
    }, Function.identity()));
    PathEntity var8 = this.a(var6, var7, var3, var4, var5);
    this.e.a();
    return var8;
}
Also used : Pathfinder(net.minecraft.server.v1_15_R1.Pathfinder) EntityHumanNPC(net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC) Iterator(java.util.Iterator) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) Set(java.util.Set) Setting(net.citizensnpcs.Settings.Setting) ChunkCache(net.minecraft.server.v1_15_R1.ChunkCache) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Path(net.minecraft.server.v1_15_R1.Path) List(java.util.List) Stream(java.util.stream.Stream) Lists(com.google.common.collect.Lists) EntityInsentient(net.minecraft.server.v1_15_R1.EntityInsentient) PathDestination(net.minecraft.server.v1_15_R1.PathDestination) Map(java.util.Map) Optional(java.util.Optional) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) Comparator(java.util.Comparator) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) PathDestination(net.minecraft.server.v1_15_R1.PathDestination)

Aggregations

BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)57 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)36 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)34 Location (org.bukkit.Location)32 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)30 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)30 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)27 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)26 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)24 Chunk (org.bukkit.Chunk)24 ArrayList (java.util.ArrayList)22 List (java.util.List)19 Map (java.util.Map)17 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)17 Iterator (java.util.Iterator)14 HashMap (java.util.HashMap)12 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)11 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)10 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)10 BlockPosition (net.minecraft.server.v1_13_R2.BlockPosition)10