use of forestry.arboriculture.tiles.TileFruitPod in project ForestryMC by ForestryMC.
the class TreeRoot method setFruitBlock.
@Override
public boolean setFruitBlock(World world, ITreeGenome genome, IAlleleFruit allele, float sappiness, BlockPos pos) {
BlockRegistryArboriculture blocks = ModuleArboriculture.getBlocks();
EnumFacing facing = BlockUtil.getValidPodFacing(world, pos);
if (facing != null) {
BlockFruitPod fruitPod = blocks.getFruitPod(allele);
if (fruitPod != null) {
IBlockState state = fruitPod.getDefaultState().withProperty(BlockHorizontal.FACING, facing);
boolean placed = world.setBlockState(pos, state);
if (placed) {
Block block = world.getBlockState(pos).getBlock();
if (fruitPod == block) {
TileFruitPod pod = TileUtil.getTile(world, pos, TileFruitPod.class);
if (pod != null) {
pod.setProperties(genome, allele, sappiness);
world.markBlockRangeForRenderUpdate(pos, pos);
return true;
} else {
world.setBlockToAir(pos);
return false;
}
}
}
}
}
return false;
}
use of forestry.arboriculture.tiles.TileFruitPod in project ForestryMC by ForestryMC.
the class BlockFruitPod method updateTick.
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (!canBlockStay(world, pos, state)) {
dropBlockAsItem(world, pos, state, 0);
world.setBlockToAir(pos);
return;
}
TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class);
if (tile == null) {
return;
}
tile.onBlockTick(world, pos, state, rand);
}
Aggregations