当前位置: 首页>>代码示例>>Java>>正文


Java Block.isPassable方法代码示例

本文整理汇总了Java中net.minecraft.block.Block.isPassable方法的典型用法代码示例。如果您正苦于以下问题:Java Block.isPassable方法的具体用法?Java Block.isPassable怎么用?Java Block.isPassable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.isPassable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isPositionClear

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Returns true if an entity does not collide with any solid blocks at the position.
 */
private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_)
{
    for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1)))
    {
        double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord;
        double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord;

        if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D)
        {
            Block block = this.worldObj.getBlockState(blockpos).getBlock();

            if (!block.isPassable(this.worldObj, blockpos))
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:PathNavigateGround.java

示例2: isPositionClear

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Returns true if an entity does not collide with any solid blocks at the position.
 */
private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3d p_179692_7_, double p_179692_8_, double p_179692_10_)
{
    for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1)))
    {
        double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord;
        double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord;

        if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D)
        {
            Block block = this.worldObj.getBlockState(blockpos).getBlock();

            if (!block.isPassable(this.worldObj, blockpos))
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:PathNavigateGround.java

示例3: isBlockValidPathfindBlock

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public boolean isBlockValidPathfindBlock(BlockPos pos) {
    if (world.isAirBlock(pos)) return true;
    Block block = world.getBlockState(pos).getBlock();
    if (PneumaticCraftUtils.isBlockLiquid(block)) {
        return hasLiquidImmunity;
    }
    if (block.isPassable(world, pos) && block != Blocks.LADDER) return true;
    if (DroneRegistry.getInstance().pathfindableBlocks.containsKey(block)) {
        IPathfindHandler pathfindHandler = DroneRegistry.getInstance().pathfindableBlocks.get(block);
        return pathfindHandler == null || pathfindHandler.canPathfindThrough(world, pos);
    } else {
        return false;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:16,代码来源:EntityDrone.java

示例4: getPathNodeTypeRaw

import net.minecraft.block.Block; //导入方法依赖的package包/类
private PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_)
{
    BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_);
    IBlockState iblockstate = p_189553_1_.getBlockState(blockpos);
    Block block = iblockstate.getBlock();
    Material material = iblockstate.getMaterial();
    return material == Material.AIR ? PathNodeType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathNodeType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathNodeType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.IRON && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_OPEN : (block instanceof BlockRailBase ? PathNodeType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate) || ((Boolean)iblockstate.getValue(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathNodeType.WATER : (material == Material.LAVA ? PathNodeType.LAVA : (block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED))) : PathNodeType.FENCE))))))) : PathNodeType.TRAPDOOR);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:WalkNodeProcessor.java

示例5: func_176170_a

import net.minecraft.block.Block; //导入方法依赖的package包/类
public static int func_176170_a(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors)
{
    boolean flag = false;
    BlockPos blockpos = new BlockPos(entityIn);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int i = x; i < x + sizeX; ++i)
    {
        for (int j = y; j < y + sizeY; ++j)
        {
            for (int k = z; k < z + sizeZ; ++k)
            {
                blockpos$mutableblockpos.func_181079_c(i, j, k);
                Block block = blockaccessIn.getBlockState(blockpos$mutableblockpos).getBlock();

                if (block.getMaterial() != Material.air)
                {
                    if (block != Blocks.trapdoor && block != Blocks.iron_trapdoor)
                    {
                        if (block != Blocks.flowing_water && block != Blocks.water)
                        {
                            if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.wood)
                            {
                                return 0;
                            }
                        }
                        else
                        {
                            if (avoidWater)
                            {
                                return -1;
                            }

                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }

                    if (entityIn.worldObj.getBlockState(blockpos$mutableblockpos).getBlock() instanceof BlockRailBase)
                    {
                        if (!(entityIn.worldObj.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(entityIn.worldObj.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase))
                        {
                            return -3;
                        }
                    }
                    else if (!block.isPassable(blockaccessIn, blockpos$mutableblockpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.wood))
                    {
                        if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
                        {
                            return -3;
                        }

                        if (block == Blocks.trapdoor || block == Blocks.iron_trapdoor)
                        {
                            return -4;
                        }

                        Material material = block.getMaterial();

                        if (material != Material.lava)
                        {
                            return 0;
                        }

                        if (!entityIn.isInLava())
                        {
                            return -2;
                        }
                    }
                }
            }
        }
    }

    return flag ? 2 : 1;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:80,代码来源:WalkNodeProcessor.java


注:本文中的net.minecraft.block.Block.isPassable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。