Search in sources :

Example 71 with BlockPosition

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

the class PlayerNavigation method superD_.

protected void superD_() {
    if (this.c == null)
        return;
    for (int var0 = 0; var0 < this.c.e(); var0++) {
        PathPoint var1 = this.c.a(var0);
        PathPoint var2 = (var0 + 1 < this.c.e()) ? this.c.a(var0 + 1) : null;
        IBlockData var3 = this.b.getType(new BlockPosition(var1.a, var1.b, var1.c));
        if (var3.a(Blocks.CAULDRON)) {
            this.c.a(var0, var1.a(var1.a, var1.b + 1, var1.c));
            if (var2 != null && var1.b >= var2.b)
                this.c.a(var0 + 1, var1.a(var2.a, var1.b + 1, var2.c));
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_16_R3.PathPoint) IBlockData(net.minecraft.server.v1_16_R3.IBlockData) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 72 with BlockPosition

use of net.minecraft.server.v1_14_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 73 with BlockPosition

use of net.minecraft.server.v1_14_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 74 with BlockPosition

use of net.minecraft.server.v1_14_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 75 with BlockPosition

use of net.minecraft.server.v1_14_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)

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)20 Map (java.util.Map)17 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)17 Iterator (java.util.Iterator)14 Block (org.bukkit.block.Block)14 HashMap (java.util.HashMap)12 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)12 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)11 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)10