This commit is contained in:
CovertJaguar 2013-05-22 12:06:53 -07:00
commit 91e7edc256
2 changed files with 23 additions and 23 deletions

View file

@ -9,7 +9,8 @@
package buildcraft.core.triggers;
import net.minecraft.inventory.*;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -60,30 +61,27 @@ public class TriggerInventory extends BCTrigger {
if (parameter != null) {
searchedStack = parameter.getItem();
}
if (tile instanceof ISpecialInventory)
{
ISpecialInventory special = (ISpecialInventory) tile;
ItemStack[] arr;
int n;
switch (state)
{
case Contains:
arr = special.extractItem(false, side, 1);
return arr != null && arr.length > 0 && arr[0] != null && arr[0].stackSize > 0
&& (searchedStack == null || arr[0].isItemEqual(searchedStack));
case Empty:
arr = special.extractItem(false, side, 1);
return arr == null || arr.length == 0 || arr[0] == null || arr[0].stackSize == 0;
case Full:
if (tile instanceof ISpecialInventory) {
ISpecialInventory specialInventory = (ISpecialInventory) tile;
ItemStack[] itemStacks;
switch (state) {
case Contains:
itemStacks = specialInventory.extractItem(false, side, 1);
return itemStacks != null && itemStacks.length > 0 && itemStacks[0] != null && itemStacks[0].stackSize > 0 && (searchedStack == null || itemStacks[0].isItemEqual(searchedStack));
case Empty:
itemStacks = specialInventory.extractItem(false, side, 1);
return itemStacks == null || itemStacks.length == 0 || itemStacks[0] == null || itemStacks[0].stackSize == 0;
case Full:
break;
case Space:
if (searchedStack == null)
break;
case Space:
if (searchedStack == null) break;
n = special.addItem(searchedStack, false, side);
return n > 0;
int added = specialInventory.addItem(searchedStack, false, side);
return added > 0;
}
}
if (tile instanceof IInventory) {
ISidedInventory inv = InventoryWrapper.getWrappedInventory(tile);
int invSize = inv.getSizeInventory();

View file

@ -128,7 +128,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
} else {
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to load from NBT at {0},{1},{2}", new Object[]{xCoord, yCoord, zCoord});
deletePipe = true;
}
}
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
facadeBlocks[i] = nbttagcompound.getInteger("facadeBlocks[" + i + "]");
@ -265,6 +265,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
}
public void initialize(Pipe pipe) {
this.blockType = getBlockType();
if(pipe == null){
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to initialize at {0},{1},{2}, deleting", new Object[]{xCoord, yCoord, zCoord});