本文整理了Java中net.minecraft.block.Block.onPlantGrow()
方法的一些代码示例,展示了Block.onPlantGrow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.onPlantGrow()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:onPlantGrow
暂无
代码示例来源:origin: SlimeKnights/TinkersConstruct
public void generateTree(Random random, World world, BlockPos pos) {
int height = random.nextInt(this.treeHeightRange) + this.minTreeHeight;
boolean flag = true;
if(seekHeight) {
pos = findGround(world, pos);
if(pos.getY() < 0) {
return;
}
}
int yPos = pos.getY();
if(yPos >= 1 && yPos + height + 1 <= 256) {
IBlockState state = world.getBlockState(pos.down());
Block soil = state.getBlock();
boolean isSoil = (soil != Blocks.AIR && soil.canSustainPlant(state, world, pos.down(), EnumFacing.UP, TinkerWorld.slimeSapling));
if(isSoil) {
soil.onPlantGrow(state, world, pos.down(), pos);
placeCanopy(world, random, pos, height);
placeTrunk(world, pos, height);
}
}
}
代码示例来源:origin: progwml6/Natura
private void onPlantGrow(World worldIn, BlockPos positionIn, BlockPos source)
{
IBlockState state = worldIn.getBlockState(positionIn);
state.getBlock().onPlantGrow(state, worldIn, positionIn, source);
}
}
代码示例来源:origin: RS485/LogisticsPipes
@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) {
Block block = mcmpBlockAccess.getBlock();
if (block != null) {
block.onPlantGrow(state, world, pos, source);
} else {
super.onPlantGrow(state, world, pos, source);
}
}
代码示例来源:origin: progwml6/Natura
@Override
public void generateTree(Random rand, World worldIn, BlockPos position)
{
int heightRange = rand.nextInt(this.treeHeightRange) + this.minTreeHeight;
if (this.seekHeight)
{
position = this.findGround(worldIn, position);
if (position.getY() < 0)
{
return;
}
}
if (position.getY() >= 1 && position.getY() + heightRange + 1 <= 256)
{
IBlockState state = worldIn.getBlockState(position.down());
Block soil = state.getBlock();
boolean isSoil = (soil != null && soil.canSustainPlant(state, worldIn, position.down(), EnumFacing.UP, NaturaOverworld.overworldSapling));
if (isSoil)
{
if (!this.checkIfCanGrow(position, heightRange, worldIn))
{
return;
}
soil.onPlantGrow(state, worldIn, position.down(), position);
this.placeCanopy(worldIn, rand, position, heightRange);
this.placeTrunk(worldIn, position, heightRange);
}
}
}
代码示例来源:origin: amadornes/MCMultiPart
public default void onPlantGrow(IPartInfo part, BlockPos source) {
part.getState().getBlock().onPlantGrow(part.getState(), part.getPartWorld(), part.getPartPos(), source);
}
代码示例来源:origin: progwml6/Natura
soil.onPlantGrow(state, worldIn, position.down(), position);
代码示例来源:origin: progwml6/Natura
state.getBlock().onPlantGrow(state, worldIn, down, position);
代码示例来源:origin: gegy1000/Terrarium
@Override
public boolean generate(World world, Random rand, BlockPos position) {
int height = rand.nextInt(2) + 3;
int leavesOrigin = height - rand.nextInt(2) - 1;
int baseHeight = 1;
if (this.canGenerate(world, position, height, baseHeight)) {
BlockPos down = position.down();
IBlockState state = world.getBlockState(down);
boolean onSoil = state.getBlock().canSustainPlant(state, world, down, EnumFacing.UP, (BlockSapling) Blocks.SAPLING) || state.getMaterial() == Material.SAND;
if (onSoil && position.getY() < 256 - height - 1) {
state.getBlock().onPlantGrow(state, world, down, position);
this.generateLeaves(world, position, leavesOrigin, height, baseHeight);
this.generateTrunk(world, position, height);
return true;
}
}
return false;
}
代码示例来源:origin: MatrexsVigil/harvestcraft
blockDown.onPlantGrow(blockStateDown, worldIn, blockPosDown, blockPos);
代码示例来源:origin: MatrexsVigil/harvestcraft
block.onPlantGrow(blockState, worldIn, down, blockPos);
代码示例来源:origin: CyclopsMC/IntegratedDynamics
block.onPlantGrow(blockState, world, basePos, blockPos);
代码示例来源:origin: progwml6/Natura
state.getBlock().onPlantGrow(state, worldIn, position.down(), position);
代码示例来源:origin: gegy1000/Terrarium
@Override
public boolean generate(World world, Random random, BlockPos position) {
int height = random.nextInt(2) + 1;
if (position.getY() >= 1 && position.getY() + height + 1 < world.getHeight()) {
BlockPos groundPos = position.down();
IBlockState ground = world.getBlockState(groundPos);
boolean onSoil = ground.getBlock().canSustainPlant(ground, world, groundPos, EnumFacing.UP, (BlockSapling) Blocks.SAPLING);
if (onSoil) {
ground.getBlock().onPlantGrow(ground, world, groundPos, position);
for (int y = 0; y < height; y++) {
this.setBlockAndNotifyAdequately(world, position.up(y), this.wood);
}
this.setBlockAndNotifyAdequately(world, position.up(height), this.leaves);
this.generateLeaves(world, random, position, height);
return true;
}
}
return false;
}
代码示例来源:origin: jabelar/ExampleMod-1.12
state.getBlock().onPlantGrow(state, parWorld, parBlockPos.down(), parBlockPos);
generateLeaves(parWorld, parBlockPos, minHeight, parRandom);
generateTrunk(parWorld, parBlockPos, minHeight);
代码示例来源:origin: progwml6/Natura
soil.onPlantGrow(state, world, pos.down(), pos);
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
soil.onPlantGrow(world.getBlockState(soilPos), world, soilPos, pos);
int leavesLayers = (this.leafLayers - 1);
代码示例来源:origin: TeamWizardry/Wizardry
state.getBlock().onPlantGrow(state, worldIn, down, position);
代码示例来源:origin: SonarSonic/Calculator
boolean isSoil = block2.canSustainPlant(state2, world, pos.offset(EnumFacing.DOWN), EnumFacing.UP, sapling);
if (isSoil && pos.getY() < 256 - l - 1) {
block2.onPlantGrow(state2, world, pos.offset(EnumFacing.DOWN), pos);
b0 = 3;
byte b1 = 0;
代码示例来源:origin: superckl/BiomeTweaker
block.getBlock().onPlantGrow(block, world, position.down(), position);
内容来源于网络,如有侵权,请联系作者删除!