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

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

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

Block.getTickRandomly介绍

暂无

代码示例

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

@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public boolean getTickRandomly() {
  Block block = mcmpBlockAccess.getBlock();
  return block != null ? block.getTickRandomly() : super.getTickRandomly();
}

代码示例来源:origin: squeek502/VeganOption

public static boolean tryGrowthTickAt(World world, BlockPos pos, Random random)
{
  IBlockState state = world.getBlockState(pos);
  Block block = state.getBlock();
  if ((block instanceof IPlantable || block instanceof IGrowable) && block.getTickRandomly())
  {
    block.updateTick(world, pos, state, random);
    return true;
  }
  return false;
}

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

private static boolean tryTickColumn(World world, int x, int z, int maxY, int minY) {
  for (int y = maxY; y >= minY; --y) {
    Block block = world.getBlockState(new BlockPos(x, y, z)).getBlock();
    if (block.getTickRandomly() && (block instanceof IGrowable || block instanceof IPlantable)) {
      world.scheduleUpdate(new BlockPos(x, y, z), block, 5);
      return true;
    }
  }
  return false;
}

代码示例来源:origin: sinkillerj/ProjectE

private void speedUpRandomTicks(World world, int bonusTicks, AxisAlignedBB bBox)
{
  if (bBox == null || bonusTicks == 0) // Sanity check the box for chunk unload weirdness
  {
    return;
  }
  List<String> blacklist = Arrays.asList(ProjectEConfig.effects.timeWatchBlockBlacklist);
  for (BlockPos pos : WorldHelper.getPositionsFromBox(bBox))
  {
    for (int i = 0; i < bonusTicks; i++)
    {
      IBlockState state = world.getBlockState(pos);
      Block block = state.getBlock();
      if (block.getTickRandomly()
          && !blacklist.contains(block.getRegistryName().toString())
          && !(block instanceof BlockLiquid) // Don't speed vanilla non-source blocks - dupe issues
          && !(block instanceof BlockFluidBase) // Don't speed Forge fluids - just in case of dupes as well
          && !(block instanceof IGrowable)
          && !(block instanceof IPlantable)) // All plants should be sped using Harvest Goddess
      {
        block.updateTick(world, pos, state, itemRand);
      }
    }
  }
}

代码示例来源:origin: raoulvdberge/refinedstorage

@SuppressWarnings("deprecation")
public static boolean isValidCover(ItemStack item) {
  if (item.isEmpty()) {
    return false;
  }
  Block block = getBlock(item);
  IBlockState state = getBlockState(item);
  return block != null && state != null && ((isModelSupported(state) && block.isTopSolid(state) && !block.getTickRandomly() && !block.hasTileEntity(state)) || block instanceof BlockGlass || block instanceof BlockStainedGlass);
}

代码示例来源:origin: SleepyTrousers/EnderIO

private void doBoost() {
 if (FarmConfig.enableCarefulCare.get()) {
  // capKey base is an int, so to give it a usable range, we scale it down by a factor of 100
  float boost = CapacitorKey.FARM_BOOST.getFloat(getCapacitorData()) / 100f;
  while (boost > 0) {
   BlockPos boostPos = getNextBoostCoord();
   if ((boost >= 1 || random.nextFloat() < boost) && world.isBlockLoaded(boostPos)) {
    IBlockState blockState = world.getBlockState(boostPos);
    Block block = blockState.getBlock();
    if (block.getTickRandomly()) {
     block.randomTick(world, boostPos, blockState, world.rand);
    }
   }
   boost--;
  }
 }
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

final boolean tickingBehavior = blk.getTickRandomly() && ChiselsAndBits.getConfig().blacklistTickingBlocks;
boolean hasBehavior = ( blk.hasTileEntity( state ) || tickingBehavior ) && blkClass != BlockGrass.class && blkClass != BlockMycelium.class && blkClass != BlockIce.class;
final boolean hasItem = Item.getItemFromBlock( blk ) != null;

相关文章

Block类方法