diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index ad6c405f..5fe69429 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -254,12 +254,11 @@ public class PipeTransportItems extends PipeTransport { public ForgeDirection resolveDestination(TravelingItem data) { LinkedList listOfPossibleMovements = getPossibleMovements(data); - if (listOfPossibleMovements.size() == 0) + if (listOfPossibleMovements.isEmpty()) return ForgeDirection.UNKNOWN; - else { - int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size()); - return listOfPossibleMovements.get(i); - } + + int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size()); + return listOfPossibleMovements.get(i); } /** @@ -272,13 +271,13 @@ public class PipeTransportItems extends PipeTransport { item.blacklist.add(item.input.getOpposite()); for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) { - if (!item.blacklist.contains(o) && container.pipe.outputOpen(o)) - if (canReceivePipeObjects(o, item)) { - result.add(o); - } + if(item.blacklist.contains(o)) + continue; + if (container.pipe.outputOpen(o) && canReceivePipeObjects(o, item)) + result.add(o); } - if (result.size() == 0 && allowBouncing) { + if (allowBouncing && result.isEmpty()) { if (canReceivePipeObjects(item.input.getOpposite(), item)) { result.add(item.input.getOpposite()); } @@ -394,7 +393,7 @@ public class PipeTransportItems extends PipeTransport { if (passToNextPipe(item, tile)) { // NOOP } else if (tile instanceof IInventory) { - if (!CoreProxy.proxy.isRenderWorld(container.worldObj)) { + if (CoreProxy.proxy.isSimulating(container.worldObj)) { if (item.getInsertionHandler().canInsertItem(item, (IInventory) tile)) { ItemStack added = Transactor.getTransactorFor(tile).add(item.getItemStack(), item.output.getOpposite(), true); item.getItemStack().stackSize -= added.stackSize; diff --git a/common/buildcraft/transport/pipes/PipeItemsDiamond.java b/common/buildcraft/transport/pipes/PipeItemsDiamond.java index e585695f..c8c831ba 100644 --- a/common/buildcraft/transport/pipes/PipeItemsDiamond.java +++ b/common/buildcraft/transport/pipes/PipeItemsDiamond.java @@ -12,6 +12,7 @@ import buildcraft.api.core.IIconProvider; import buildcraft.api.core.Position; import buildcraft.core.GuiIds; import buildcraft.core.inventory.SimpleInventory; +import buildcraft.core.inventory.StackHelper; import buildcraft.core.network.IClientState; import buildcraft.core.proxy.CoreProxy; import buildcraft.transport.BlockGenericPipe; @@ -29,7 +30,6 @@ import java.util.LinkedList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -101,27 +101,22 @@ public class PipeItemsDiamond extends Pipe implements IPipeT // to use that filter is higher, this is why there are // no breaks here. for (int slot = 0; slot < 9; ++slot) { - ItemStack stack = getFilters().getStackInSlot(dir.ordinal() * 9 + slot); + ItemStack filter = getFilters().getStackInSlot(dir.ordinal() * 9 + slot); - if (stack != null) { + if (filter != null) foundFilter = true; - } - if (stack != null && stack.itemID == item.getItemStack().itemID) - if ((Item.itemsList[item.getItemStack().itemID].isDamageable())) { - filteredOrientations.add(dir); - } else if (stack.getItemDamage() == item.getItemStack().getItemDamage()) { - filteredOrientations.add(dir); - } + if (StackHelper.instance().isMatchingItem(filter, item.getItemStack(), true, false)) + filteredOrientations.add(dir); + } - if (!foundFilter) { + if (!foundFilter) defaultOrientations.add(dir); - } } - if (filteredOrientations.size() != 0) + if (!filteredOrientations.isEmpty()) return filteredOrientations; - else - return defaultOrientations; + + return defaultOrientations; } @Override