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

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

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

Block.isWood介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

private static boolean isLog(World world, BlockPos pos) {
 return world.getBlockState(pos).getBlock().isWood(world, pos);
}

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

Block block = world.getBlockState(adj).getBlock();
boolean isWood = block.isWood(world, adj);
boolean isLeaf = block.isLeaves(world.getBlockState(adj), world, adj);

代码示例来源:origin: progwml6/Natura

public static boolean isTreeBlock(IBlockState blockState, World world, BlockPos pos)
{
  Block block = blockState.getBlock();
  return block.isLeaves(blockState, world, pos) || block.isWood(world, pos);
}

代码示例来源:origin: progwml6/Natura

public boolean isReplaceable(World world, BlockPos pos)
{
  IBlockState state = world.getBlockState(pos);
  return state.getBlock() != Blocks.AIR && !state.getBlock().isLeaves(state, world, pos) && state.getBlock() != Blocks.NETHERRACK && state.getBlock() != Blocks.SOUL_SAND && state.getBlock() != NaturaNether.netherTaintedSoil && !state.getBlock().isWood(world, pos);
}

代码示例来源:origin: MatrexsVigil/harvestcraft

public static boolean isTreeBlock(IBlockState blockState, World world, BlockPos pos) {
  Block block = blockState.getBlock();
  return block.isLeaves(blockState, world, pos) || block.isWood(world, pos);
}

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

@Override
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
  Block block = blockState.getBlock();
  if (!block.isWood(world, pos)) {
    return null;
  }
  return new CropDestroy(world, blockState, pos, null);
}

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

@Override
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
  Block block = blockState.getBlock();
  if (!block.isWood(world, pos)) {
    return null;
  }
  return new CropDestroy(world, blockState, pos, null);
}

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

@Override
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
  Block block = blockState.getBlock();
  if (!block.isWood(world, pos)) {
    return null;
  }
  return new CropDestroy(world, blockState, pos, null);
}

代码示例来源:origin: progwml6/Natura

public boolean isReplaceable(World worldIn, BlockPos positionIn)
{
  IBlockState state = worldIn.getBlockState(positionIn);
  return state.getBlock().isAir(state, worldIn, positionIn) || state.getBlock().isLeaves(state, worldIn, positionIn) || state.getBlock().isWood(worldIn, positionIn);
}

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

public static boolean isTreeBlock(IBlockState blockState, World world, BlockPos pos) {
  Block block = blockState.getBlock();
  return block.isLeaves(blockState, world, pos) || block.isWood(world, pos);
}

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

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

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

private boolean isWood(World world, BlockPos pos) {
  return world.getBlockState(pos).getBlock().isWood(world, pos);
}

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

private Collection<ICrop> getHarvestBlocks(World world, BlockPos position) {
  Set<BlockPos> seen = new HashSet<>();
  Stack<ICrop> crops = new Stack<>();
  if (!world.isBlockLoaded(position)) {
    return Collections.emptyList();
  }
  // Determine what type we want to harvest.
  IBlockState blockState = world.getBlockState(position);
  Block block = blockState.getBlock();
  if (!block.isWood(world, position) && !isBlockTraversable(blockState, traversalBlocks) && !isFruitBearer(world, position, blockState)) {
    return crops;
  }
  List<BlockPos> candidates = processHarvestBlock(world, crops, seen, position, position);
  List<BlockPos> temp = new ArrayList<>();
  while (!candidates.isEmpty() && crops.size() < 20) {
    for (BlockPos candidate : candidates) {
      temp.addAll(processHarvestBlock(world, crops, seen, position, candidate));
    }
    candidates.clear();
    candidates.addAll(temp);
    temp.clear();
  }
  return crops;
}

代码示例来源:origin: progwml6/Natura

public boolean isReplaceable(World world, BlockPos pos)
{
  IBlockState state = world.getBlockState(pos);
  return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isReplaceable(world, pos) || state.getBlock().isWood(world, pos) || this.canGrowInto(state.getBlock());
}

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

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

代码示例来源:origin: ldtteam/minecolonies

/**
 * Checks if a stack is a type of log.
 *
 * @param stack the stack to check.
 * @return true if it is a log type.
 */
private boolean isStackLog(@Nullable final ItemStack stack)
{
  return !ItemStackUtils.isEmpty(stack) && stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock().isWood(world, new BlockPos(0, 0, 0));
}

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

public static boolean isValidPodLocation(World world, BlockPos pos, EnumFacing direction) {
  pos = pos.offset(direction);
  if (!world.isBlockLoaded(pos)) {
    return false;
  }
  IBlockState state = world.getBlockState(pos);
  Block block = state.getBlock();
  if (block == Blocks.LOG) {
    return state.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE;
  } else {
    return block.isWood(world, pos);
  }
}

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

public static boolean canPlaceTree(IBlockState blockState, World world, BlockPos pos) {
  BlockPos downPos = pos.down();
  Block block = world.getBlockState(downPos).getBlock();
  return !(block.isReplaceable(world, downPos) &&
    blockState.getMaterial().isLiquid()) &&
    !block.isLeaves(blockState, world, downPos) &&
    !block.isWood(world, downPos);
}

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

public boolean isReplaceable(World world, BlockPos pos) {
  IBlockState state = world.getBlockState(pos);
  return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || canGrowInto(state.getBlock());
}

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

public void register() {
  //AlleleManager.alleleRegistry.registerAllele(this);
  IFlowerRegistry flowerRegistry = FlowerManager.flowerRegistry;
  for (Block block : getAcceptableBlocks()) {
    flowerRegistry.registerAcceptableFlower(block, getUID());
  }
  switch (this) {
    case ROCK:
      flowerRegistry.registerAcceptableFlowerRule((blockState, world, pos, flowerType) -> blockState.getMaterial() == Material.ROCK, getUID());
      break;
    case LEAVES:
      flowerRegistry.registerAcceptableFlowerRule((blockState, world, pos, flowerType) -> blockState.getBlock().isLeaves(blockState, world, pos), getUID());
      break;
    case WOOD:
      flowerRegistry.registerAcceptableFlowerRule((blockState, world, pos, flowerType) -> blockState.getBlock().isWood(world, pos), getUID());
      break;
  }
  AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.FLOWER_PROVIDER);
}

相关文章

Block类方法