本文整理了Java中net.minecraft.block.Block.randomTick()
方法的一些代码示例,展示了Block.randomTick()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.randomTick()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:randomTick
暂无
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random rand)
{
if (world.isRemote) return;
if (type.isGrass) Helpers.spreadGrass(world, pos, state, rand);
super.randomTick(world, pos, state, rand);
}
代码示例来源:origin: RS485/LogisticsPipes
@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public void randomTick(World world, BlockPos pos, IBlockState state, Random random) {
Block block = mcmpBlockAccess.getBlock();
if (block != null) {
block.randomTick(world, pos, state, random);
} else {
super.randomTick(world, pos, state, random);
}
}
代码示例来源:origin: amadornes/MCMultiPart
public default void randomTick(IPartInfo part, Random random) {
part.getState().getBlock().randomTick(part.getPartWorld(), part.getPartPos(), part.getState(), random);
}
代码示例来源: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: MatterOverdrive/MatterOverdrive-Legacy-Edition
public void manageAccelerations() {
int radius = getRadius();
matterUseCache += getMatterUsage();
if (matterUseCache > 1) {
matterStorage.modifyMatterStored(-(int) matterUseCache);
matterUseCache -= (int) matterUseCache;
}
for (int x = -radius; x < radius; x++) {
for (int z = -radius; z < radius; z++) {
BlockPos pos = getPos().add(x, 0, z);
IBlockState blockState = world.getBlockState(pos);
blockState.getBlock().randomTick(world, pos, blockState, random);
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null && tileEntity instanceof ITickable && !(tileEntity instanceof TileEntityMachineSpacetimeAccelerator)) {
((ITickable) tileEntity).update();
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!