Clean code while debug Diamond Pipe

Conclusion, any issues that people have with Diamond Pipes and AE
machines, are likely AE's fault. Cannot duplicate.

Closes #1005
This commit is contained in:
CovertJaguar 2013-08-14 20:51:01 -07:00
parent e705cec237
commit 399e3d0ce9
2 changed files with 20 additions and 26 deletions

View file

@ -254,12 +254,11 @@ public class PipeTransportItems extends PipeTransport {
public ForgeDirection resolveDestination(TravelingItem data) {
LinkedList<ForgeDirection> 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;

View file

@ -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<PipeTransportItems> 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