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

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

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

Block.isReplaceableOreGen介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

private List<BlockPos> getCoordsToPut(BlockPos pos) {
  List<BlockPos> possibleCoords = new ArrayList<>();
  int range = 4;
  int rangeY = 4;
  for (BlockPos bPos : BlockPos.getAllInBox(pos.add(-range, -rangeY, -range), pos.add(range, rangeY, range))) {
    IBlockState state = world.getBlockState(bPos);
    Block block = state.getBlock();
    if(block.isReplaceableOreGen(state, world, bPos, BlockStateMatcher.forBlock(Blocks.STONE)))
      possibleCoords.add(bPos);
  }
  Collections.shuffle(possibleCoords, rand);
  return possibleCoords.stream().limit(64).collect(Collectors.toList());
}

代码示例来源:origin: Vazkii/Botania

private BlockPos getCoordsToPut() {
  List<BlockPos> possibleCoords = new ArrayList<>();
  for(BlockPos pos : BlockPos.getAllInBox(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE, RANGE_Y, RANGE))) {
    IBlockState state = supertile.getWorld().getBlockState(pos);
    if(state.getBlock().isReplaceableOreGen(state, supertile.getWorld(), pos, getReplaceMatcher()))
      possibleCoords.add(pos);
  }
  if(possibleCoords.isEmpty())
    return null;
  return possibleCoords.get(supertile.getWorld().rand.nextInt(possibleCoords.size()));
}

代码示例来源:origin: Vazkii/Botania

private BlockPos getCoordsToPut() {
  List<BlockPos> possibleCoords = new ArrayList<>();
  int range = getRange();
  int rangeY = getRangeY();
  BlockStateMatcher matcher = BlockStateMatcher.forBlock(Blocks.STONE);
  for(BlockPos pos : BlockPos.getAllInBox(getPos().add(-range, -rangeY, -range), getPos().add(range, rangeY, range))) {
    IBlockState state = supertile.getWorld().getBlockState(pos);
    if(state.getBlock().isReplaceableOreGen(state, supertile.getWorld(), pos, matcher))
      possibleCoords.add(pos);
  }
  if(possibleCoords.isEmpty())
    return null;
  return possibleCoords.get(supertile.getWorld().rand.nextInt(possibleCoords.size()));
}

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

/**
   * Overload for {@link #canGenerateInPosition(BlockPos, IBlockAccess)} that already has obtained the block state.
   * This is called in the other canGenerateInPosition. Use this when you want a state-specific check and are
   * calling the super method.
   * @param position The position that is going to be generated in.
   * @param positionState The block state at this position.
   * @param world The world
   * @return Whether this position is valid for the block to generate in.
   */
  protected boolean canGenerateInPosition(BlockPos position, IBlockState positionState, IBlockAccess world) {
    return positionState.getBlock().isReplaceableOreGen(positionState, world, position, predicate);
  }
}

代码示例来源:origin: Vazkii/Quark

private List<BlockPos> getCoordsToPut(BlockPos pos) {
  List<BlockPos> possibleCoords = new ArrayList<>();
  int range = 4;
  int rangeY = 4;
  for (BlockPos bPos : BlockPos.getAllInBox(pos.add(-range, -rangeY, -range), pos.add(range, rangeY, range))) {
    IBlockState state = world.getBlockState(bPos);
    Block block = state.getBlock();
    if(block.isReplaceableOreGen(state, world, bPos, BlockStateMatcher.forBlock(Blocks.STONE)))
      possibleCoords.add(bPos);
  }
  Collections.shuffle(possibleCoords, rand);
  return possibleCoords.stream().limit(ThrowableDragonBreath.blocksPerBottle).collect(Collectors.toList());
}

代码示例来源:origin: Chisel-Team/Chisel

@SuppressWarnings("null")
private void replace(World world, BlockPos pos) {
  if (basaltstate == null) {
    basaltstate = ChiselBlocks.basalt2.getDefaultState().withProperty(ChiselBlocks.basalt2.getMetaProp(), 7);
  }
  IBlockState toReplace = world.getBlockState(pos);
  if (toReplace.getBlock().isReplaceableOreGen(toReplace, world, pos, replacecheck)) {
    world.setBlockState(pos, basaltstate);
  }
}

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

@Override
public boolean generate(final World world, final Random random, BlockPos pos) {
  IBlockState blockState = world.getBlockState(pos);
  Block block = blockState.getBlock();
  while (block.isReplaceableOreGen(blockState, world, pos, BlockStateMatcher.forBlock(Blocks.STONE))) {
    if (hasAirOnOneSide(world, pos)) {
      IBlockState hiveState = ModuleCore.hive.getDefaultState().withProperty(BlockExtraBeeHives.HIVE_TYPE, EnumHiveType.ROCK);
      world.setBlockState(pos, hiveState);
      return true;
    }
    pos = pos.down();
    blockState = world.getBlockState(pos);
    block = blockState.getBlock();
  }
  return false;
}

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

if (block != null && block.getBlock().isReplaceableOreGen(block, world, new BlockPos(xx, yy, zz), BlockMatcher.forBlock(blockToReplace))) {
  world.setBlockState(new BlockPos(xx, yy, zz), minableBlock.getStateFromMeta(minableBlockMeta), 2);
  ++placed;

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

if (previousState.getBlock().isReplaceableOreGen(previousState, world, pos, this.predicate)) {
  if (rand.nextInt(10) == 0) {
    world.setBlockState(pos, BlockHandler.PLANT_FOSSIL.getDefaultState());

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

IBlockState state = chunk.getBlockState(pos);
Block block = state.getBlock();
if (block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.STONE)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.NETHERRACK)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.END_STONE))) {
  ++blockCounter;

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

IBlockState state = chunk.getBlockState(pos);
Block block = state.getBlock();
if (block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.STONE)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.NETHERRACK)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.END_STONE))) {
  if (chunk.setBlockState(pos, replState) != null) {
    ++blockCounter;

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

BlockPos pos = new BlockPos(xOre, oreHeight, zOre);
IBlockState state = world.getBlockState(pos);
if (state.getBlock().isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.STONE))) {
  world.setBlockState(pos, ModBlocks.sapphireOre.getDefaultState());

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

IBlockState state = chunk.getBlockState(pos);
Block block = state.getBlock();
if (block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.STONE)) || block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.NETHERRACK)) || block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.END_STONE))) {
  ++blockCounter;
  if (chunk.setBlockState(bPos, Blocks.AIR.getDefaultState()) != null) {

相关文章

Block类方法