use of crazypants.enderio.base.farming.harvesters.FarmHarvestingTarget in project EnderIO by SleepyTrousers.
the class TreeFarmer method harvestBlock.
@Override
public IHarvestResult harvestBlock(@Nonnull IFarmer farm, @Nonnull BlockPos bc, @Nonnull Block block, @Nonnull IBlockState meta) {
setupHarvesting(farm, bc);
if (!hasAxe) {
farm.setNotification(FarmNotification.NO_AXE);
return null;
}
final World world = farm.getWorld();
final HarvestResult res = new HarvestResult();
final IHarvestingTarget target = new FarmHarvestingTarget(this, farm);
TreeHarvester.harvest(world, bc, res, target);
Collections.sort(res.getHarvestedBlocks(), comp);
List<BlockPos> actualHarvests = new ArrayList<BlockPos>();
for (int i = 0; i < res.getHarvestedBlocks().size() && hasAxe; i++) {
final BlockPos coord = res.getHarvestedBlocks().get(i);
harvestSingleBlock(farm, world, res, coord);
actualHarvests.add(coord);
}
res.getHarvestedBlocks().clear();
res.getHarvestedBlocks().addAll(actualHarvests);
tryReplanting(farm, world, bc, res);
return res;
}
Aggregations