mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
Fix #430 farm hatch should only automatically output downward
This commit is contained in:
1 parent
5326e41c9f
commit
e77f62d8e7
2 files changed
+12
-7
No files matched your search
@@ -13,6 +13,7 @@ package forestry.core.inventory;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -758,15 +759,19 @@ public abstract class InvTools {
|
||||
* @return true if an item was inserted, otherwise false.
|
||||
*/
|
||||
public static boolean moveOneItemToPipe(IInventory source, AdjacentTileCache tileCache) {
|
||||
return moveOneItemToPipe(source, tileCache, ForgeDirection.VALID_DIRECTIONS);
|
||||
}
|
||||
|
||||
public static boolean moveOneItemToPipe(IInventory source, AdjacentTileCache tileCache, ForgeDirection[] directions) {
|
||||
if (PluginManager.Module.BUILDCRAFT_TRANSPORT.isEnabled()) {
|
||||
return internal_moveOneItemToPipe(source, tileCache);
|
||||
return internal_moveOneItemToPipe(source, tileCache, directions);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "BuildCraftAPI|transport")
|
||||
private static boolean internal_moveOneItemToPipe(IInventory source, AdjacentTileCache tileCache) {
|
||||
private static boolean internal_moveOneItemToPipe(IInventory source, AdjacentTileCache tileCache, ForgeDirection[] directions) {
|
||||
IInventory invClone = new InventoryCopy(source);
|
||||
ItemStack stackToMove = removeOneItem(invClone);
|
||||
if (stackToMove == null)
|
||||
@@ -776,7 +781,7 @@ public abstract class InvTools {
|
||||
|
||||
List<Map.Entry<ForgeDirection, IPipeTile>> pipes = new ArrayList<Map.Entry<ForgeDirection, IPipeTile>>();
|
||||
boolean foundPipe = false;
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
for (ForgeDirection side : directions) {
|
||||
TileEntity tile = tileCache.getTileOnSide(side);
|
||||
if (tile instanceof IPipeTile) {
|
||||
IPipeTile pipe = (IPipeTile) tile;
|
||||
|
||||
@@ -13,10 +13,8 @@ package forestry.farming.gadgets;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -35,11 +33,13 @@ import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
public class TileHatch extends TileFarm implements ISidedInventory {
|
||||
|
||||
private static final ForgeDirection[] dumpDirections = new ForgeDirection[] { ForgeDirection.DOWN };
|
||||
|
||||
private final AdjacentInventoryCache inventoryCache = new AdjacentInventoryCache(this, getTileCache(), new ITileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean matches(TileEntity tile) {
|
||||
return !(tile instanceof TileFarm);
|
||||
return !(tile instanceof TileFarm) && tile.yCoord < yCoord;
|
||||
}
|
||||
}, null);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TileHatch extends TileFarm implements ISidedInventory {
|
||||
if (productInventory == null)
|
||||
return;
|
||||
|
||||
if (!InvTools.moveOneItemToPipe(productInventory, tileCache)) {
|
||||
if (!InvTools.moveOneItemToPipe(productInventory, tileCache, dumpDirections)) {
|
||||
InvTools.moveItemStack(productInventory, inventoryCache.getAdjacentInventories());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user