if(!farm.hasHoe()) {
farm.setNotification(TileFarmStation.NOTIFICATION_NO_HOE);
return null;
}
World worldObj = farm.getWorldObj();
List<EntityItem> result = new ArrayList<EntityItem>();
ItemStack removedPlantable = null;
ArrayList<ItemStack> drops = block.getDrops(worldObj, bc.x, bc.y, bc.z, meta, farm.getMaxLootingValue());
farm.damageHoe(1, bc);
farm.actionPerformed(false);
boolean removed = false;
if(drops != null) {
for (ItemStack stack : drops) {
if(stack != null && !removed && isPlantableForBlock(stack, block)) {
stack.stackSize--;
removed = true;
removedPlantable = stack.copy();
if(stack.stackSize > 0) {
result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, stack.copy()));
}
} else {
result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, stack.copy()));
}
}
}
if(removed) {
if(!plant(farm, worldObj, bc, (IPlantable) removedPlantable.getItem())) {
result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, removedPlantable.copy()));
worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
}
} else {
worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
}
return new HarvestResult(result, bc);
}