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:
parent
e705cec237
commit
399e3d0ce9
2 changed files with 20 additions and 26 deletions
|
@ -254,13 +254,12 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
public ForgeDirection resolveDestination(TravelingItem data) {
|
public ForgeDirection resolveDestination(TravelingItem data) {
|
||||||
LinkedList<ForgeDirection> listOfPossibleMovements = getPossibleMovements(data);
|
LinkedList<ForgeDirection> listOfPossibleMovements = getPossibleMovements(data);
|
||||||
|
|
||||||
if (listOfPossibleMovements.size() == 0)
|
if (listOfPossibleMovements.isEmpty())
|
||||||
return ForgeDirection.UNKNOWN;
|
return ForgeDirection.UNKNOWN;
|
||||||
else {
|
|
||||||
int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size());
|
int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size());
|
||||||
return listOfPossibleMovements.get(i);
|
return listOfPossibleMovements.get(i);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all possible movements, that is to say adjacent
|
* Returns a list of all possible movements, that is to say adjacent
|
||||||
|
@ -272,13 +271,13 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
item.blacklist.add(item.input.getOpposite());
|
item.blacklist.add(item.input.getOpposite());
|
||||||
|
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
if (!item.blacklist.contains(o) && container.pipe.outputOpen(o))
|
if(item.blacklist.contains(o))
|
||||||
if (canReceivePipeObjects(o, item)) {
|
continue;
|
||||||
|
if (container.pipe.outputOpen(o) && canReceivePipeObjects(o, item))
|
||||||
result.add(o);
|
result.add(o);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (result.size() == 0 && allowBouncing) {
|
if (allowBouncing && result.isEmpty()) {
|
||||||
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
|
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
|
||||||
result.add(item.input.getOpposite());
|
result.add(item.input.getOpposite());
|
||||||
}
|
}
|
||||||
|
@ -394,7 +393,7 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
if (passToNextPipe(item, tile)) {
|
if (passToNextPipe(item, tile)) {
|
||||||
// NOOP
|
// NOOP
|
||||||
} else if (tile instanceof IInventory) {
|
} else if (tile instanceof IInventory) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(container.worldObj)) {
|
if (CoreProxy.proxy.isSimulating(container.worldObj)) {
|
||||||
if (item.getInsertionHandler().canInsertItem(item, (IInventory) tile)) {
|
if (item.getInsertionHandler().canInsertItem(item, (IInventory) tile)) {
|
||||||
ItemStack added = Transactor.getTransactorFor(tile).add(item.getItemStack(), item.output.getOpposite(), true);
|
ItemStack added = Transactor.getTransactorFor(tile).add(item.getItemStack(), item.output.getOpposite(), true);
|
||||||
item.getItemStack().stackSize -= added.stackSize;
|
item.getItemStack().stackSize -= added.stackSize;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
|
import buildcraft.core.inventory.StackHelper;
|
||||||
import buildcraft.core.network.IClientState;
|
import buildcraft.core.network.IClientState;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
|
@ -29,7 +30,6 @@ import java.util.LinkedList;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -101,26 +101,21 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeT
|
||||||
// to use that filter is higher, this is why there are
|
// to use that filter is higher, this is why there are
|
||||||
// no breaks here.
|
// no breaks here.
|
||||||
for (int slot = 0; slot < 9; ++slot) {
|
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;
|
foundFilter = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (stack != null && stack.itemID == item.getItemStack().itemID)
|
if (StackHelper.instance().isMatchingItem(filter, item.getItemStack(), true, false))
|
||||||
if ((Item.itemsList[item.getItemStack().itemID].isDamageable())) {
|
|
||||||
filteredOrientations.add(dir);
|
|
||||||
} else if (stack.getItemDamage() == item.getItemStack().getItemDamage()) {
|
|
||||||
filteredOrientations.add(dir);
|
filteredOrientations.add(dir);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
if (!foundFilter)
|
||||||
if (!foundFilter) {
|
|
||||||
defaultOrientations.add(dir);
|
defaultOrientations.add(dir);
|
||||||
}
|
}
|
||||||
}
|
if (!filteredOrientations.isEmpty())
|
||||||
if (filteredOrientations.size() != 0)
|
|
||||||
return filteredOrientations;
|
return filteredOrientations;
|
||||||
else
|
|
||||||
return defaultOrientations;
|
return defaultOrientations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue