use of forestry.api.genetics.IFruitBearer in project MineFactoryReloaded by powercrystals.
the class FertilizableForestryLeaves method fertilize.
@Override
public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) {
if (world.getBlockId(x, y, z) == this.getFertilizableBlockId()) {
IFruitBearer f = ForestryUtils.getFruitBearer(world.getBlockTileEntity(x, y, z));
if (f.hasFruit() && f.getRipeness() < 1.0f) {
BonemealEvent event = new BonemealEvent(null, world, 1, x, y, z);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult().equals(BonemealEvent.Result.ALLOW)) {
return true;
}
}
}
return false;
}
use of forestry.api.genetics.IFruitBearer in project ForestryMC by ForestryMC.
the class CropFruit method harvestBlock.
@Override
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
IFruitBearer tile = TileUtil.getTile(world, pos, IFruitBearer.class);
if (tile == null) {
return NonNullList.create();
}
IBlockState blockState = world.getBlockState(pos);
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState);
NetworkUtil.sendNetworkPacket(packet, pos, world);
return tile.pickFruit(ItemStack.EMPTY);
}
Aggregations