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

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

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

Block.isFlammable介绍

暂无

代码示例

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

private static boolean isFlammable(IBlockAccess world, BlockPos pos) {
  IBlockState blockState = world.getBlockState(pos);
  Block block = blockState.getBlock();
  return block.isFlammable(world, pos, EnumFacing.UP);
}

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

private static boolean isFlammable(IBlockAccess world, BlockPos pos) {
  IBlockState blockState = world.getBlockState(pos);
  Block block = blockState.getBlock();
  return block.isFlammable(world, pos, EnumFacing.UP);
}

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

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

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

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

代码示例来源:origin: GregTechCE/GregTech

public static void setNeighboursToFire(World world, BlockPos selfPos) {
  for (EnumFacing side : EnumFacing.VALUES) {
    if(!random.nextBoolean()) continue;
    BlockPos blockPos = selfPos.offset(side);
    IBlockState blockState = world.getBlockState(blockPos);
    if(blockState.getBlock().isAir(blockState, world, blockPos) ||
      blockState.getBlock().isFlammable(world, blockPos, side.getOpposite())) {
      world.setBlockState(blockPos, Blocks.FIRE.getDefaultState());
    }
  }
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

/**
   * Burns all log blocks within a 5 block radius.
   * @param world The world
   * @param startPos The starting Block Position
   */
  private static void burnBlocks(World world, BlockPos startPos, EnumFacing side) {
    int startX = startPos.getX();
    int startY = startPos.getY();
    int startZ = startPos.getZ();
    BlockPos.MutableBlockPos curPos = new BlockPos.MutableBlockPos(startPos);
    for (int x = startX - 5; x < startX + 5; x++) {
      for (int y = startY - 5; y < startY + 5; y++) {
        for (int z = startZ - 5; z < startZ + 5; z++) {
          curPos.setPos(x, y, z);
          IBlockState state = world.getBlockState(curPos);
          Block block = state.getBlock();
          if (block == null || world.isAirBlock(curPos)) {
            continue;
          }
          if (block.isFlammable(world, curPos, side)) {
            world.setBlockState(curPos, Blocks.FIRE.getDefaultState());
          }
        }
      }
    }
  }
}

代码示例来源:origin: CoFH/ThermalFoundation

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
  if (effect) {
    checkForInteraction(world, pos);
  }
  if (enableSourceFall && state.getBlock().getMetaFromState(state) == 0) {
    BlockPos offsetPos = pos.add(0, densityDir, 0);
    IBlockState offsetState = world.getBlockState(offsetPos);
    int bMeta = offsetState.getBlock().getMetaFromState(offsetState);
    if (offsetState.getBlock() == this && bMeta != 0 || offsetState.getBlock().isFlammable(world, offsetPos, EnumFacing.UP)) {
      world.setBlockState(offsetPos, this.getDefaultState(), 3);
      world.setBlockToAir(pos);
      return;
    }
  }
  super.updateTick(world, pos, state, rand);
}

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

activatePile(blockState, world, position, true);
} else if (world.isAirBlock(position) || !blockState.isSideSolid(world, position, facing.getOpposite()) || block.isFlammable(world, position, facing.getOpposite())) {
  world.setBlockState(pos, Blocks.FIRE.getDefaultState());
  return;

代码示例来源:origin: CoFH/ThermalFoundation

protected void interactWithBlock(World world, BlockPos pos) {
  IBlockState state = world.getBlockState(pos);
  if (state.getBlock().isAir(state, world, pos) || state.getBlock() == this) {
    return;
  }
  if (hasInteraction(state)) {
    IBlockState result = getInteraction(state);
    world.setBlockState(pos, result, 3);
    triggerInteractionEffects(world, pos);
  } else if (state.getBlock().isFlammable(world, pos, EnumFacing.UP)) {
    world.setBlockState(pos, Blocks.FIRE.getDefaultState());
  } else if (state.isSideSolid(world, pos, EnumFacing.UP) && world.isAirBlock(pos.offset(EnumFacing.UP))) {
    world.setBlockState(pos.offset(EnumFacing.UP), Blocks.FIRE.getDefaultState(), 3);
  }
}

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

BlockPos pos = hit.getBlockPos();
if (hit.typeOfHit == RayTraceResult.Type.BLOCK && player.world.getBlockState(pos).getBlock().isFlammable(player.world, pos, hit.sideHit)) {
  pos.offset(hit.sideHit);

相关文章

Block类方法