Removed StackUtil from TileAutoWorkbench.java.
This commit is contained in:
parent
d30717b271
commit
1e40b70649
2 changed files with 24 additions and 13 deletions
|
@ -51,6 +51,16 @@ public class Utils {
|
|||
public static final float pipeMaxPos = 0.75F;
|
||||
public static float pipeNormalSpeed = 0.01F;
|
||||
|
||||
/**
|
||||
* Tries to add the passed stack to any valid inventories around the given coordinates.
|
||||
* @param stack
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param from
|
||||
* @return ItemStack representing what was added.
|
||||
*/
|
||||
public static ItemStack addToRandomInventory(ItemStack stack, World world, int x, int y, int z, Orientations from) {
|
||||
LinkedList<ITransactor> possibleInventories = new LinkedList<ITransactor>();
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ import java.util.LinkedList;
|
|||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.inventory.ISpecialInventory;
|
||||
import buildcraft.core.utils.StackUtil;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.TransactorSimple;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
|
@ -283,7 +284,8 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
|
|||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
StackUtil stackUtils = new StackUtil(stack);
|
||||
|
||||
ITransactor transactor = new TransactorSimple(this);
|
||||
|
||||
int minSimilar = Integer.MAX_VALUE;
|
||||
int minSlot = -1;
|
||||
|
@ -299,18 +301,17 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
|
|||
}
|
||||
|
||||
if (minSlot != -1) {
|
||||
if (stackUtils.tryAdding(this, minSlot, doAdd, false)) {
|
||||
if (doAdd && stack.stackSize != 0) {
|
||||
addItem(stack, doAdd, from);
|
||||
}
|
||||
ItemStack added = transactor.add(stack, from, doAdd);
|
||||
ItemStack remaining = stack.copy();
|
||||
remaining.stackSize -= added.stackSize;
|
||||
|
||||
return stackUtils.itemsAdded;
|
||||
} else {
|
||||
return stackUtils.itemsAdded;
|
||||
}
|
||||
} else {
|
||||
if(doAdd && remaining.stackSize >= 0)
|
||||
added.stackSize += addItem(remaining, doAdd, from);
|
||||
|
||||
return added.stackSize;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue