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

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

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

Block.canSustainLeaves介绍

暂无

代码示例

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

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

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

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

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

public void breakBlock() {
  if (IceAndFire.CONFIG.cyclopsGriefing) {
    for (int a = (int) Math.round(this.getEntityBoundingBox().minX) - 1; a <= (int) Math.round(this.getEntityBoundingBox().maxX) + 1; a++) {
      for (int b = (int) Math.round(this.getEntityBoundingBox().minY) + 1; (b <= (int) Math.round(this.getEntityBoundingBox().maxY) + 2) && (b <= 127); b++) {
        for (int c = (int) Math.round(this.getEntityBoundingBox().minZ) - 1; c <= (int) Math.round(this.getEntityBoundingBox().maxZ) + 1; c++) {
          BlockPos pos = new BlockPos(a, b, c);
          IBlockState state = world.getBlockState(pos);
          Block block = state.getBlock();
          if (state.getMaterial() != Material.AIR && !(block instanceof BlockBush) && !(block instanceof BlockLiquid) && block != Blocks.BEDROCK && (state.getBlock().isLeaves(state, world, pos) || state.getBlock().canSustainLeaves(state, world, pos))) {
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
            if (block != Blocks.AIR) {
              if (!world.isRemote) {
                world.destroyBlock(pos, true);
              }
            }
          }
        }
      }
    }
  }
}
@Override

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

Block block = iblockstate.getBlock();
if (block != null && block.canSustainLeaves(iblockstate, worldIn, pos.add(posX, posY, posZ)))

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

IBlockState blockState = world.getBlockState(blockPos);
Block block = blockState.getBlock();
if (!block.canSustainLeaves(blockState, world, blockPos)) {
  if (block.isLeaves(blockState, world, blockPos)) {
    leafDecayValues[xOffset + arrayOffset][yOffset + arrayOffset][zOffset + arrayOffset] = IS_LEAVES;

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

IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2));
Block block = iblockstate.getBlock();
if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2))) {
  if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2))) {
    surroundings[(i2 + 16) * 1024 + (j2 + 16) * 32 + k2 + 16] = -2;

相关文章

Block类方法