Wood Item Pipes shouldn't never explode themselves

This commit is contained in:
CovertJaguar 2013-10-19 16:51:43 -07:00
parent 81f78e5bf7
commit d6e0277b7d
2 changed files with 16 additions and 5 deletions

View file

@ -272,7 +272,7 @@ public class PipeTransportItems extends PipeTransport {
item.blacklist.add(item.input.getOpposite());
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
if(item.blacklist.contains(o))
if (item.blacklist.contains(o))
continue;
if (container.pipe.outputOpen(o) && canReceivePipeObjects(o, item))
result.add(o);
@ -282,7 +282,7 @@ public class PipeTransportItems extends PipeTransport {
Position pos = new Position(container.xCoord, container.yCoord, container.zCoord, item.input);
result = ((IPipeTransportItemsHook) this.container.pipe).filterPossibleMovements(result, pos, item);
}
if (allowBouncing && result.isEmpty()) {
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
result.add(item.input.getOpposite());
@ -555,10 +555,20 @@ public class PipeTransportItems extends PipeTransport {
PacketDispatcher.sendPacketToAllAround(container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST, dimension, createItemPacket(data));
}
public int getNumberOfItems() {
public int getNumberOfStacks() {
return items.size();
}
public int getNumberOfItems() {
int num = 0;
for (TravelingItem item : items) {
if (item.getItemStack() == null)
continue;
num += item.getItemStack().stackSize;
}
return num;
}
public void onDropped(EntityItem item) {
this.container.pipe.onDropped(item);
}

View file

@ -105,7 +105,8 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
if (powerHandler.getEnergyStored() <= 0)
return;
extractItems();
if (transport.getNumberOfStacks() < PipeTransportItems.MAX_PIPE_STACKS)
extractItems();
powerHandler.setEnergy(0);
}
@ -154,7 +155,7 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
/* ISPECIALINVENTORY */
if (inventory instanceof ISpecialInventory) {
ItemStack[] stacks = ((ISpecialInventory) inventory).extractItem(doRemove, from, (int) powerHandler.getEnergyStored());
ItemStack[] stacks = ((ISpecialInventory) inventory).extractItem(doRemove, from, Math.min((int) powerHandler.getEnergyStored(), PipeTransportItems.MAX_PIPE_ITEMS - transport.getNumberOfItems()));
if (stacks != null && doRemove) {
for (ItemStack stack : stacks) {
if (stack != null) {