diff --git a/src/dark/farmtech/machines/farmer/DroneTask.java b/src/dark/farmtech/machines/farmer/DroneTask.java index 432c9283..039799e8 100644 --- a/src/dark/farmtech/machines/farmer/DroneTask.java +++ b/src/dark/farmtech/machines/farmer/DroneTask.java @@ -1,5 +1,8 @@ package dark.farmtech.machines.farmer; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; import universalelectricity.core.vector.Vector3; public class DroneTask diff --git a/src/dark/farmtech/machines/farmer/EntityFarmDrone.java b/src/dark/farmtech/machines/farmer/EntityFarmDrone.java index 3cd8d546..013186c6 100644 --- a/src/dark/farmtech/machines/farmer/EntityFarmDrone.java +++ b/src/dark/farmtech/machines/farmer/EntityFarmDrone.java @@ -1,5 +1,6 @@ package dark.farmtech.machines.farmer; +import dark.core.helpers.ItemWorldHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -85,9 +86,15 @@ public class EntityFarmDrone extends EntityLiving implements IElectricalStorage /** Adds an item to the drones inventory or drops it on the ground if the drone is full * - * @param stack */ - public void pickUpItem(ItemStack stack) + * @param location - location were the item was so to drop it there if the drone can't pick it + * up + * @param stack - stack to store or drop */ + public ItemStack pickUpItem(Vector3 location, ItemStack stack, boolean drop) { + if (location == null) + { + location = this.location.clone(); + } ItemStack itemStack = stack.copy(); if (stack != null) { @@ -114,14 +121,15 @@ public class EntityFarmDrone extends EntityLiving implements IElectricalStorage } if (itemStack == null || itemStack.stackSize <= 0) { - break; + return null; } } - if (itemStack != null) + if (drop && itemStack != null && itemStack.stackSize > 0) { - //TODO drop item on the ground for later pickup + return ItemWorldHelper.dropItemStack(this.worldObj, location, itemStack, true); } } + return itemStack; } /** Check if the inventory has items in all slots rather than if its actually 100% full */ diff --git a/src/dark/farmtech/machines/farmer/HarvestTask.java b/src/dark/farmtech/machines/farmer/HarvestTask.java index cc4b4cbd..8ee055f1 100644 --- a/src/dark/farmtech/machines/farmer/HarvestTask.java +++ b/src/dark/farmtech/machines/farmer/HarvestTask.java @@ -47,9 +47,10 @@ public class HarvestTask extends DroneTask ArrayList items = block.getBlockDropped(drone.worldObj, location.intX(), location.intY(), location.intZ(), metaData, 1); for (ItemStack stack : items) { - drone.pickUpItem(stack); + drone.pickUpItem(location, stack, true); } } + drone.worldObj.playAuxSFX(2001, location.intX(), location.intY(), location.intZ(), blockID + (metaData << 12)); //TODO do a few checks and method calls to simulate player like block harvesting as much as possible location.setBlock(drone.worldObj, 0); }