Search in sources :

Example 31 with IBlockData

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

the class PlayerPathfinderNormal method a.

public static PathType a(IBlockAccess var0, BlockPosition.MutableBlockPosition var1, PathType var2) {
    int var3 = var1.getX();
    int var4 = var1.getY();
    int var5 = var1.getZ();
    for (int var6 = -1; var6 <= 1; var6++) {
        for (int var7 = -1; var7 <= 1; var7++) {
            for (int var8 = -1; var8 <= 1; var8++) {
                if (var6 != 0 || var8 != 0) {
                    var1.d(var3 + var6, var4 + var7, var5 + var8);
                    IBlockData var9 = var0.getType(var1);
                    if (var9.a(Blocks.CACTUS))
                        return PathType.DANGER_CACTUS;
                    if (var9.a(Blocks.SWEET_BERRY_BUSH))
                        return PathType.DANGER_OTHER;
                    if (a(var9))
                        return PathType.DANGER_FIRE;
                    if (var0.getFluid(var1).a(TagsFluid.WATER))
                        return PathType.WATER_BORDER;
                }
            }
        }
    }
    return var2;
}
Also used : IBlockData(net.minecraft.server.v1_16_R3.IBlockData) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 32 with IBlockData

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

the class PlayerPathfinderNormal method b.

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

Example 33 with IBlockData

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

the class PlayerPathfinderNormal method b.

protected 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_12_R1.BlockDoor) IBlockData(net.minecraft.server.v1_12_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_12_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_12_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block) Material(net.minecraft.server.v1_12_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_12_R1.BlockFence)

Example 34 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)
        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 35 with IBlockData

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

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int var0;
    BlockPosition var1;
    if (this.e() && this.b.isInWater()) {
        var0 = MathHelper.floor(this.b.locY());
        MutableBlockPosition varx = new MutableBlockPosition(this.b.locX(), var0, this.b.locZ());
        for (IBlockData var2 = this.a.getType(varx); var2.getBlock() == Blocks.WATER || var2.getFluid() == FluidTypes.WATER.a(false); var2 = this.a.getType(varx)) {
            ++var0;
            varx.c(this.b.locX(), var0, this.b.locZ());
        }
        --var0;
    } else if (this.b.onGround) {
        var0 = MathHelper.floor(this.b.locY() + 0.5D);
    } else {
        for (var1 = new BlockPosition(this.b); (this.a.getType(var1).isAir() || this.a.getType(var1).a(this.a, var1, PathMode.LAND)) && var1.getY() > 0; var1 = var1.down()) {
        }
        var0 = var1.up().getY();
    }
    var1 = new BlockPosition(this.b);
    PathType var2 = this.a(this.b, var1.getX(), var0, var1.getZ());
    if (this.b.a(var2) < 0.0F) {
        Set<BlockPosition> var3 = Sets.newHashSet();
        var3.add(new BlockPosition(this.b.getBoundingBox().minX, var0, this.b.getBoundingBox().minZ));
        var3.add(new BlockPosition(this.b.getBoundingBox().minX, var0, this.b.getBoundingBox().maxZ));
        var3.add(new BlockPosition(this.b.getBoundingBox().maxX, var0, this.b.getBoundingBox().minZ));
        var3.add(new BlockPosition(this.b.getBoundingBox().maxX, var0, this.b.getBoundingBox().maxZ));
        Iterator<BlockPosition> var5 = var3.iterator();
        while (var5.hasNext()) {
            BlockPosition varb = var5.next();
            PathType var6 = this.a(this.b, varb);
            if (this.b.a(var6) >= 0.0F) {
                return this.a(varb.getX(), varb.getY(), varb.getZ());
            }
        }
    }
    return this.a(var1.getX(), var0, var1.getZ());
}
Also used : PathType(net.minecraft.server.v1_15_R1.PathType) IBlockData(net.minecraft.server.v1_15_R1.IBlockData) 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) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_15_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