net.minecraft.block.Block.isPassable()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中net.minecraft.block.Block.isPassable()方法的一些代码示例,展示了Block.isPassable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.isPassable()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:isPassable

Block.isPassable介绍

暂无

代码示例

代码示例来源:origin: cabaletta/baritone

static boolean fullyPassable(IBlockState state) {
  Block block = state.getBlock();
  if (block == Blocks.AIR) { // early return for most common case
    return true;
  }
  // exceptions - blocks that are isPassable true, but we can't actually jump through
  if (block == Blocks.FIRE
      || block == Blocks.TRIPWIRE
      || block == Blocks.WEB
      || block == Blocks.VINE
      || block == Blocks.LADDER
      || block == Blocks.COCOA
      || block instanceof BlockDoor
      || block instanceof BlockFenceGate
      || block instanceof BlockSnow
      || block instanceof BlockLiquid
      || block instanceof BlockTrapDoor
      || block instanceof BlockEndPortal) {
    return false;
  }
  // door, fence gate, liquid, trapdoor have been accounted for, nothing else uses the world or pos parameters
  return block.isPassable(null, null);
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

public static boolean isSpawnable(World world, BlockPos pos) {
  return world.getBlockState(pos).getBlock().isPassable(world, pos);
}

代码示例来源:origin: amadornes/MCMultiPart

public default boolean isPassable(IBlockAccess world, BlockPos pos, IPartInfo part) {
  return part.getState().getBlock().isPassable(world, pos);
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public boolean isPassable(IBlockAccess world, BlockPos pos) {
  Block block = mcmpBlockAccess.getBlock();
  return block != null ? block.isPassable(world, pos) : super.isPassable(world, pos);
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

return PathNodeType.LAVA;
} else {
  return block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

/**
 * Returns true if an entity does not collide with any solid blocks at the position.
 */
private boolean isPositionClear(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3d p_179692_7_, double p_179692_8_, double p_179692_10_) {
  for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(x, y, z), new BlockPos(x + sizeX - 1, y + sizeY - 1, z + sizeZ - 1))) {
    double d0 = (double) blockpos.getX() + 0.5D - p_179692_7_.x;
    double d1 = (double) blockpos.getZ() + 0.5D - p_179692_7_.z;
    if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D) {
      Block block = this.world.getBlockState(blockpos).getBlock();
      if (!block.isPassable(this.world, blockpos)) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: ForestryMC/ForestryMC

private boolean validateDestination(Vec3d dest, boolean allowFluids) {
  if (dest.y < 1) {
    return false;
  }
  BlockPos pos = new BlockPos(dest);
  if (!entity.world.isBlockLoaded(pos)) {
    return false;
  }
  IBlockState blockState = entity.world.getBlockState(pos);
  Block block = blockState.getBlock();
  if (!allowFluids && blockState.getMaterial().isLiquid()) {
    return false;
  }
  if (!block.isPassable(entity.world, pos)) {
    return false;
  }
  return entity.getButterfly().isAcceptedEnvironment(entity.world, dest.x, dest.y, dest.z);
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

/**
 * Returns true if an entity does not collide with any solid blocks at the position.
 */
private boolean isPositionClear(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3d p_179692_7_, double p_179692_8_, double p_179692_10_) {
  for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(x, y, z), new BlockPos(x + sizeX - 1, y + sizeY - 1, z + sizeZ - 1))) {
    double d0 = (double) blockpos.getX() + 0.5D - p_179692_7_.x;
    double d1 = (double) blockpos.getZ() + 0.5D - p_179692_7_.z;
    if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D) {
      Block block = this.world.getBlockState(blockpos).getBlock();
      if (!block.isPassable(this.world, blockpos) || this.world.getBlockState(blockpos).getMaterial() == Material.SAND) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: ForestryMC/ForestryMC

private boolean canLand(BlockPos pos) {
  if (!entity.world.isBlockLoaded(pos)) {
    return false;
  }
  IBlockState blockState = entity.world.getBlockState(pos);
  Block block = blockState.getBlock();
  if (!block.isPassable(entity.world, pos)) {
    return false;
  }
  if (isPlant(blockState)) {
    return true;
  }
  IBlockState blockStateBelow = entity.world.getBlockState(pos.down());
  Block blockBelow = blockStateBelow.getBlock();
  return isRest(blockBelow) || blockBelow.isLeaves(blockStateBelow, entity.world, pos.down());
}

代码示例来源:origin: cabaletta/baritone

return block.isPassable(null, null);

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

return block.isPassable(access, pos) ? PathNodeType.OPEN : PathNodeType.BLOCKED;

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

if (block.getBlock().isAir(block, world, blockPos) || block.getBlock().isPassable(world, blockPos) || !block.getBlock().isCollidable() || block instanceof IFluidBlock) {
  airBlockCount++;
} else {

代码示例来源:origin: Alex-the-666/Ice_and_Fire

BlockPos blockpos;
for (blockpos = new BlockPos(this.entity); (this.blockaccess.getBlockState(blockpos).getMaterial() == Material.AIR || this.blockaccess.getBlockState(blockpos).getBlock().isPassable(this.blockaccess, blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) {

代码示例来源:origin: PenguinSquad/Harvest-Festival

if (!npc.isInsideOfMaterial(Material.AIR)) {
  attemptToTeleportToSafety(go);
} else if (npc.world.getBlockState(pos).getBlock().isPassable(npc.world, pos)) {
  npc.setJumping(true);

相关文章

Block类方法