From 46c4c65488e043045875474491eba39ccdae5bb2 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 5 Oct 2014 03:22:28 -0700 Subject: [PATCH] Put harvested farm resources back in the resources slot --- .../farming/gadgets/TileFarmPlain.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java index 9bbf6b73e..08a393741 100755 --- a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java +++ b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java @@ -534,23 +534,31 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable listener.hasCollected(collected, logic); for (ItemStack produce : collected) { - - // Germlings try to go into germling slots first. - if (logic.isAcceptedGermling(produce)) - produce.stackSize -= inventory.addStack(produce, SLOT_GERMLINGS_1, SLOT_COUNT_RESERVOIRS, false, true); - - if (produce.stackSize <= 0) - continue; - produce.stackSize -= inventory.addStack(produce, SLOT_PRODUCTION_1, SLOT_COUNT_PRODUCTION, false, true); - if (produce.stackSize <= 0) - continue; - + addProduceToInventory(produce); pendingProduce.push(produce); } return true; } + private void addProduceToInventory(ItemStack produce) { + + for (IFarmLogic logic : getFarmLogics()) { + // Germlings try to go into germling slots first. + if (logic.isAcceptedGermling(produce)) + produce.stackSize -= inventory.addStack(produce, SLOT_GERMLINGS_1, SLOT_COUNT_RESERVOIRS, false, true); + if (produce.stackSize <= 0) + return; + + if (logic.isAcceptedResource(produce)) + produce.stackSize -= inventory.addStack(produce, SLOT_RESOURCES_1, SLOT_COUNT_RESERVOIRS, false, true); + if (produce.stackSize <= 0) + return; + } + + produce.stackSize -= inventory.addStack(produce, SLOT_PRODUCTION_1, SLOT_COUNT_PRODUCTION, false, true); + } + private boolean cullCrop(ICrop crop, IFarmLogic provider) { // Let event handlers handle the harvest first.