Search in sources :

Example 61 with IBlockData

use of net.minecraft.server.v1_16_R2.IBlockData in project Citizens2 by CitizensDev.

the class PlayerNavigation method d.

@Override
protected void d() {
    PathPoint localPathPoint;
    for (int i = 0; i < this.c.d(); i++) {
        localPathPoint = this.c.a(i);
        Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
        IBlockData localIBlockData = this.b.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
        Block localBlock = localIBlockData.getBlock();
        if (localBlock == Blocks.cauldron) {
            this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
            if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
                this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1, ((PathPoint) localObject).c));
            }
        }
    }
    if (this.f2) {
        if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D), MathHelper.floor(this.a.locZ)))) {
            return;
        }
        for (int i = 0; i < this.c.d(); i++) {
            localPathPoint = this.c.a(i);
            if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
                this.c.b(i - 1);
                return;
            }
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint) IBlockData(net.minecraft.server.v1_11_R1.IBlockData) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 62 with IBlockData

use of net.minecraft.server.v1_16_R2.IBlockData in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

private PathType b(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
    IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
    Block localBlock = localIBlockData.getBlock();
    Material localMaterial = localIBlockData.getMaterial();
    if (localMaterial == Material.AIR) {
        return PathType.OPEN;
    }
    if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR) || (localBlock == Blocks.WATERLILY)) {
        return PathType.TRAPDOOR;
    }
    if (localBlock == Blocks.FIRE) {
        return PathType.DAMAGE_FIRE;
    }
    if (localBlock == Blocks.CACTUS) {
        return PathType.DAMAGE_CACTUS;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_WOOD_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_IRON_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_OPEN;
    }
    if ((localBlock instanceof BlockMinecartTrackAbstract)) {
        return PathType.RAIL;
    }
    if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockCobbleWall)) || (((localBlock instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
        return PathType.FENCE;
    }
    if (localMaterial == Material.WATER) {
        return PathType.WATER;
    }
    if (localMaterial == Material.LAVA) {
        return PathType.LAVA;
    }
    if (localBlock.b(paramIBlockAccess, localBlockPosition)) {
        return PathType.OPEN;
    }
    return PathType.BLOCKED;
}
Also used : BlockDoor(net.minecraft.server.v1_11_R1.BlockDoor) IBlockData(net.minecraft.server.v1_11_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_11_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_11_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) Material(net.minecraft.server.v1_11_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_11_R1.BlockFence)

Example 63 with IBlockData

use of net.minecraft.server.v1_16_R2.IBlockData in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method c.

protected static PathType c(IBlockAccess var0, int var1, int var2, int var3) {
    BlockPosition var4 = new BlockPosition(var1, var2, var3);
    IBlockData var5 = var0.getType(var4);
    Block var6 = var5.getBlock();
    Material var7 = var5.getMaterial();
    if (var5.isAir()) {
        return PathType.OPEN;
    } else if (!var6.a(TagsBlock.TRAPDOORS) && var6 != Blocks.LILY_PAD) {
        if (var6 == Blocks.FIRE) {
            return PathType.DAMAGE_FIRE;
        } else if (var6 == Blocks.CACTUS) {
            return PathType.DAMAGE_CACTUS;
        } else if (var6 == Blocks.SWEET_BERRY_BUSH) {
            return PathType.DAMAGE_OTHER;
        } else if (var6 == Blocks.HONEY_BLOCK) {
            return PathType.STICKY_HONEY;
        } else if (var6 == Blocks.COCOA) {
            return PathType.COCOA;
        } else if (var6 instanceof BlockDoor && var7 == Material.WOOD && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_WOOD_CLOSED;
        } else if (var6 instanceof BlockDoor && var7 == Material.ORE && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_IRON_CLOSED;
        } else if (var6 instanceof BlockDoor && var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_OPEN;
        } else if (var6 instanceof BlockMinecartTrackAbstract) {
            return PathType.RAIL;
        } else if (var6 instanceof BlockLeaves) {
            return PathType.LEAVES;
        } else if (var6.a(TagsBlock.FENCES) || var6.a(TagsBlock.WALLS) || var6 instanceof BlockFenceGate && !(Boolean) var5.get(BlockFenceGate.OPEN)) {
            return PathType.FENCE;
        } else {
            Fluid var8 = var0.getFluid(var4);
            if (var8.a(TagsFluid.WATER)) {
                return PathType.WATER;
            } else if (var8.a(TagsFluid.LAVA)) {
                return PathType.LAVA;
            } else {
                return var5.a(var0, var4, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
            }
        }
    } else {
        return PathType.TRAPDOOR;
    }
}
Also used : BlockDoor(net.minecraft.server.v1_15_R1.BlockDoor) IBlockData(net.minecraft.server.v1_15_R1.IBlockData) BlockLeaves(net.minecraft.server.v1_15_R1.BlockLeaves) BlockFenceGate(net.minecraft.server.v1_15_R1.BlockFenceGate) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition) Fluid(net.minecraft.server.v1_15_R1.Fluid) TagsFluid(net.minecraft.server.v1_15_R1.TagsFluid) Block(net.minecraft.server.v1_15_R1.Block) TagsBlock(net.minecraft.server.v1_15_R1.TagsBlock) Material(net.minecraft.server.v1_15_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract)

Example 64 with IBlockData

use of net.minecraft.server.v1_16_R2.IBlockData in project Citizens2 by CitizensDev.

the class PlayerNavigation method superF_.

protected void superF_() {
    if (this.c != null) {
        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));
            Block var4 = var3.getBlock();
            if (var4 == 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, var2.a(var2.a, var1.b + 1, var2.c));
                }
            }
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_15_R1.PathPoint) IBlockData(net.minecraft.server.v1_15_R1.IBlockData) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) Block(net.minecraft.server.v1_15_R1.Block) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

Example 65 with IBlockData

use of net.minecraft.server.v1_16_R2.IBlockData in project Citizens2 by CitizensDev.

the class PlayerNavigation method superD_.

protected void superD_() {
    if (this.c != null) {
        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));
            Block var4 = var3.getBlock();
            if (var4 == 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, var2.a(var2.a, var1.b + 1, var2.c));
                }
            }
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_14_R1.PathPoint) IBlockData(net.minecraft.server.v1_14_R1.IBlockData) BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) Block(net.minecraft.server.v1_14_R1.Block) PathPoint(net.minecraft.server.v1_14_R1.PathPoint)

Aggregations

HashMap (java.util.HashMap)24 ArrayList (java.util.ArrayList)20 Block (org.bukkit.block.Block)18 List (java.util.List)16 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)16 NotNull (org.jetbrains.annotations.NotNull)16 Chunk (org.bukkit.Chunk)15 IBlockData (net.minecraft.server.v1_12_R1.IBlockData)11 IBlockData (net.minecraft.server.v1_14_R1.IBlockData)10 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)9 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)8 IBlockData (net.minecraft.server.v1_15_R1.IBlockData)8 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 IBlockData (net.minecraft.server.v1_11_R1.IBlockData)7 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)7 IBlockData (net.minecraft.server.v1_8_R3.IBlockData)7 IdentityHashMap (java.util.IdentityHashMap)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)6