Fixed double chests not being recognized by pipes.

This commit is contained in:
SirSengir 2012-09-09 09:59:17 +02:00
parent 5303b5a5de
commit 8f298b4eb7
2 changed files with 7 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package buildcraft.core.inventory;
import buildcraft.api.core.Orientations; import buildcraft.api.core.Orientations;
import buildcraft.api.inventory.ISpecialInventory; import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.core.utils.Utils;
import net.minecraft.src.IInventory; import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraftforge.common.ISidedInventory; import net.minecraftforge.common.ISidedInventory;
@ -26,7 +27,7 @@ public abstract class Transactor implements ITransactor {
return new TransactorSided((ISidedInventory)object); return new TransactorSided((ISidedInventory)object);
else if(object instanceof IInventory) else if(object instanceof IInventory)
return new TransactorSimple((IInventory)object); return new TransactorSimple(Utils.getInventory((IInventory)object));
return null; return null;
} }

View file

@ -208,6 +208,11 @@ public class Utils {
return world.getBlockTileEntity((int) tmp.x, (int) tmp.y, (int) tmp.z); return world.getBlockTileEntity((int) tmp.x, (int) tmp.y, (int) tmp.z);
} }
/**
* Ensures that the given inventory is the full inventory, i.e. takes double chests into account.
* @param inv
* @return Modified inventory if double chest, unmodified otherwise.
*/
public static IInventory getInventory(IInventory inv) { public static IInventory getInventory(IInventory inv) {
if (inv instanceof TileEntityChest) { if (inv instanceof TileEntityChest) {
TileEntityChest chest = (TileEntityChest) inv; TileEntityChest chest = (TileEntityChest) inv;