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

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

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

Block.isOpaqueCube介绍

暂无

代码示例

代码示例来源:origin: Electrical-Age/ElectricalAge

@Override
  public float getWeight(Block block) {
    if (block == null)
      return 0;
    return block.isOpaqueCube() ? 1f : 0f;
  }
}

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public boolean isOpaqueCube() {
  return block.isOpaqueCube(this);
}

代码示例来源:origin: Electrical-Age/ElectricalAge

public boolean isOpaque(Coordonate coord) {
  Block block = coord.getBlock();
  boolean isNotOpaque = block == Blocks.air || !block.isOpaqueCube();
  if (block == Blocks.farmland)
    isNotOpaque = false;
  return !isNotOpaque;
}

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public boolean isOpaqueCube() {
  return normalState.getBlock().isOpaqueCube(this);
}

代码示例来源:origin: Zyin055/zyinhud

/**
 * Checks if a block is an opqaue cube.
 * @param dx x location relative to this block
 * @param dy y location relative to this block
 * @param dz z location relative to this block
 * @return true if the block is opaque (like dirt, stone, etc.)
 */
public boolean IsOpaqueBlock(int dx, int dy, int dz)
{
  Block block = GetBlock(dx, dy, dz);
  
  if (block == null)	//air block
  {
    return false;
  }
  return block.isOpaqueCube();
}

代码示例来源:origin: Electrical-Age/ElectricalAge

public boolean getIfOtherBlockIsSolid(World world, int x, int y, int z, Direction direction) {
  int[] vect = new int[3];
  vect[0] = x;
  vect[1] = y;
  vect[2] = z;
  direction.applyTo(vect, 1);
  Block block = world.getBlock(vect[0], vect[1], vect[2]);
  if (block == Blocks.air) return false;
  if (block.isOpaqueCube()) return true;
  return false;
}

代码示例来源:origin: IntellectualSites/PlotSquared

public boolean isSolid(int i) {
  return i != 0 && Block.getBlockById(i).isOpaqueCube(Block.getBlockById(i).getDefaultState());
}

代码示例来源:origin: Zyin055/zyinhud

/**
 * Checks if mobs can spawn ON the block at a location.
 * @param dx x location relative to this block
 * @param dy y location relative to this block
 * @param dz z location relative to this block
 * @return true if mobs can spawn ON this block
 */
public boolean CanMobsSpawnOnBlock(int dx, int dy, int dz)
{
  Block block = GetBlock(dx, dy, dz);
  if (block == null
    || block == Blocks.air
    || block instanceof BlockBarrier
    || block instanceof BlockSlime)
  {
    return false;
  }
  
  if (block.isOpaqueCube()
    || mc.theWorld.doesBlockHaveSolidTopSurface(mc.theWorld, new BlockPos(x + dx, y + dy, z + dz))
    || block instanceof BlockFarmland)	//the one exception to the isOpaqueCube and doesBlockHaveSolidTopSurface rules
  {
    return true;
  }
  
  return false;
}

代码示例来源:origin: CyclopsMC/EvilCraft

/**
 * If the given blockState can be set to an inner blockState of this.
 * @param blockState The blockState to set as inner blockState.
 * @param block The block to set as inner blockState.
 * @param world The world.
 * @param blockPos The position.
 * @return If the blockState can be set as inner blockState.
 */
public boolean canSetInnerBlock(IBlockState blockState, Block block, IBlockAccess world, BlockPos blockPos) {
  return block != null
      && !block.isAir(blockState, world, blockPos)
      && block.isOpaqueCube(blockState)
      && !block.hasTileEntity(world.getBlockState(blockPos))
      && block.getRenderType(blockState) == EnumBlockRenderType.MODEL;
}

代码示例来源:origin: vadis365/TheErebus

protected static boolean canPlaceBlock(World world, BlockPos pos, EnumFacing direction) {
  BlockPos blockpos = pos.offset(direction.getOpposite());
  IBlockState iblockstate = world.getBlockState(blockpos);
  boolean flag = iblockstate.getBlockFaceShape(world, blockpos, direction) == BlockFaceShape.SOLID;
  Block block = iblockstate.getBlock();
  return world.isBlockNormalCube(blockpos, true) && block.isOpaqueCube(iblockstate) && flag;
}

代码示例来源:origin: Zyin055/zyinhud

if (block.isOpaqueCube())	//majority of blocks: dirt, stone, etc.

代码示例来源:origin: vadis365/TheErebus

protected static boolean canPlaceBlock(World world, BlockPos pos, EnumFacing direction) {
  BlockPos blockpos = pos.offset(direction.getOpposite());
  IBlockState iblockstate = world.getBlockState(blockpos);
  boolean flag = iblockstate.getBlockFaceShape(world, blockpos, direction) == BlockFaceShape.SOLID;
  Block block = iblockstate.getBlock();
  return world.isBlockNormalCube(blockpos, true) && block.isOpaqueCube(iblockstate) && flag;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

public void setDisguiseState(ItemStack itemStack) {
  Block block = Block.getBlockFromItem(itemStack.getItem());
  if (block != AWStructureBlocks.SOUND_BLOCK && block.isFullCube(null) && block.isOpaqueCube(null)) {
    disguiseState = block.getStateFromMeta(itemStack.getMetadata());
    BlockTools.notifyBlockUpdate(this);
    world.notifyNeighborsRespectDebug(pos, this.blockType, true);
    markDirty();
  }
}

代码示例来源:origin: Electrical-Age/ElectricalAge

temp.move(Direction.YN);
block = temp.getBlock();
if (block == null || ((!block.isOpaqueCube()) && block instanceof BlockHopper == false))
  return tr("You can't place this block at this side");
temp.move(Direction.YP);
block = temp.getBlock();
if (block == null || !block.isOpaqueCube()) return tr("You can't place this block at this side");
temp.move(front.getInverse());
block = temp.getBlock();
if (block == null || !block.isOpaqueCube()) return tr("You can't place this block at this side");
temp.move(Direction.XN);
block = temp.getBlock();
if (block != null && block.isOpaqueCube()) wall = true;
temp = new Coordonate(coord);
temp.move(Direction.XP);
block = temp.getBlock();
if (block != null && block.isOpaqueCube()) wall = true;
temp = new Coordonate(coord);
temp.move(Direction.ZN);
block = temp.getBlock();
if (block != null && block.isOpaqueCube()) wall = true;
temp = new Coordonate(coord);
temp.move(Direction.ZP);
block = temp.getBlock();
if (block != null && block.isOpaqueCube()) wall = true;

代码示例来源:origin: Electrical-Age/ElectricalAge

target.posX, target.posY + target.getEyeHeight(), target.posZ);
for (Block b : blockList)
  if (b.isOpaqueCube())
    return new SeekingState();

代码示例来源:origin: Electrical-Age/ElectricalAge

public void neighborBlockRead() {
  int[] vector = new int[3];
  World world = coordonate.world();
  neighborOpaque = 0;
  neighborWrapable = 0;
  for (Direction direction : Direction.values()) {
    vector[0] = coordonate.x;
    vector[1] = coordonate.y;
    vector[2] = coordonate.z;
    direction.applyTo(vector, 1);
    Block b = world.getBlock(vector[0], vector[1], vector[2]);
    if (b.isOpaqueCube())
      ;
    neighborOpaque |= 1 << direction.getInt();
    if (isBlockWrappable(b, world, coordonate.x, coordonate.y, coordonate.z))
      neighborWrapable |= 1 << direction.getInt();
  }
}

代码示例来源:origin: Electrical-Age/ElectricalAge

b.isOpaqueCube() &&
!b.isAir(w, c.x, c.y, c.z) ?
2.0 : 0.0;

代码示例来源:origin: McJtyMods/LostCities

private boolean isValidStandingPosition(World world, BlockPos pos) {
  IBlockState state = world.getBlockState(pos);
  return state.getBlock().isTopSolid(state) && state.getBlock().isFullCube(state) && state.getBlock().isOpaqueCube(state) && world.isAirBlock(pos.up()) && world.isAirBlock(pos.up(2));
}

代码示例来源:origin: Electrical-Age/ElectricalAge

boolean visible = true;
for (Block b : blockList)
  if (b.isOpaqueCube()) {
    visible = false;
    break;

代码示例来源:origin: Electrical-Age/ElectricalAge

if (b.isOpaqueCube()) {
  view = false;
  break;

相关文章

Block类方法