Fixed an item stacking issue with crates
Manipulators were not stacking items in crates above the items max stack limit.
This commit is contained in:
parent
caf4f11c30
commit
09f5353faa
2 changed files with 15 additions and 29 deletions
|
@ -331,7 +331,7 @@ public class BlockCrate extends BlockMachine
|
|||
* @param tileEntity
|
||||
* @param itemStack
|
||||
*/
|
||||
private ItemStack putIn(TileEntityCrate tileEntity, ItemStack itemStack)
|
||||
public static ItemStack putIn(TileEntityCrate tileEntity, ItemStack itemStack)
|
||||
{
|
||||
ItemStack containingStack = tileEntity.getStackInSlot(0);
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ import universalelectricity.prefab.implement.IRotatable;
|
|||
import universalelectricity.prefab.multiblock.TileEntityMulti;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.api.IManipulator;
|
||||
import assemblyline.common.block.BlockCrate;
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
|
@ -87,8 +89,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
}
|
||||
|
||||
/**
|
||||
* Find items going into the manipulator and input them into an inventory behind this
|
||||
* manipulator.
|
||||
* Find items going into the manipulator and input them into an inventory behind this manipulator.
|
||||
*/
|
||||
@Override
|
||||
public void eject()
|
||||
|
@ -109,10 +110,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
*/
|
||||
if (outputPosition.getTileEntity(this.worldObj) instanceof TileEntityManipulator)
|
||||
{
|
||||
if (((TileEntityManipulator) outputPosition.getTileEntity(this.worldObj)).getDirection() == this.getDirection().getOpposite())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (((TileEntityManipulator) outputPosition.getTileEntity(this.worldObj)).getDirection() == this.getDirection().getOpposite()) { return; }
|
||||
}
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(inputPosition.x, inputPosition.y, inputPosition.z, inputPosition.x + 1, inputPosition.y + 1, inputPosition.z + 1);
|
||||
|
@ -124,8 +122,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
continue;
|
||||
|
||||
/**
|
||||
* Try top first, then bottom, then the sides to see if it is possible to insert the
|
||||
* item into a inventory.
|
||||
* Try top first, then bottom, then the sides to see if it is possible to insert the item into a inventory.
|
||||
*/
|
||||
ItemStack remainingStack = entity.getEntityItem().copy();
|
||||
|
||||
|
@ -273,6 +270,10 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof TileEntityCrate)
|
||||
{
|
||||
return BlockCrate.putIn((TileEntityCrate) tileEntity, itemStack);
|
||||
}
|
||||
else if (tileEntity instanceof ISidedInventory)
|
||||
{
|
||||
ISidedInventory inventory = (ISidedInventory) tileEntity;
|
||||
|
@ -282,10 +283,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
for (int i = startIndex; i < startIndex + inventory.getSizeInventorySide(direction); i++)
|
||||
{
|
||||
itemStack = this.addStackToInventory(i, inventory, itemStack);
|
||||
if (itemStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (itemStack == null) { return null; }
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof IInventory)
|
||||
|
@ -295,18 +293,12 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
itemStack = this.addStackToInventory(i, inventory, itemStack);
|
||||
if (itemStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (itemStack == null) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemStack.stackSize <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (itemStack.stackSize <= 0) { return null; }
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
@ -320,10 +312,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
if (stackInInventory == null)
|
||||
{
|
||||
inventory.setInventorySlotContents(slotIndex, itemStack);
|
||||
if (inventory.getStackInSlot(slotIndex) == null)
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
if (inventory.getStackInSlot(slotIndex) == null) { return itemStack; }
|
||||
return null;
|
||||
}
|
||||
else if (stackInInventory.isItemEqual(itemStack) && stackInInventory.isStackable())
|
||||
|
@ -337,10 +326,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
}
|
||||
}
|
||||
|
||||
if (itemStack.stackSize <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (itemStack.stackSize <= 0) { return null; }
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue