mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
IInventory automation removal (#132)
* Start killing off IInventory * Write a couple TODO's of things that should eventually use IItemHandler * Remove unused variable, and add back special case handling for bins * Update some of the implementations of getSlotsForFace https://github.com/mekanism-mod/Mekanism/commit/11e9e2df7a2f2b053fcb9371bf496f7aa88a04cd * Cleanup a bit of implementation around items being valid for a slot
This commit is contained in:
1 parent
934788e0e7
commit
8c276b6b1a
38 files changed
+240
-525
No files matched your search
@@ -5,7 +5,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.StackUtils;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -72,27 +71,6 @@ public final class InvStack {
|
||||
handler.extractItem(slotIDs.get(i), toUse, false);
|
||||
amount -= toUse;
|
||||
|
||||
if (amount == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (tileEntity instanceof IInventory) {
|
||||
IInventory inventory = InventoryUtils.checkChestInv((IInventory) tileEntity);
|
||||
|
||||
for (int i = 0; i < slotIDs.size(); i++) {
|
||||
ItemStack stack = itemStacks.get(i);
|
||||
|
||||
if (inventory.getStackInSlot(slotIDs.get(i)).getCount() == stack.getCount()
|
||||
&& stack.getCount() <= amount) {
|
||||
inventory.setInventorySlotContents(slotIDs.get(i), ItemStack.EMPTY);
|
||||
amount -= stack.getCount();
|
||||
} else {
|
||||
ItemStack ret = stack.copy();
|
||||
ret.setCount(inventory.getStackInSlot(slotIDs.get(i)).getCount() - amount);
|
||||
inventory.setInventorySlotContents(slotIDs.get(i), ret);
|
||||
amount -= stack.getCount();
|
||||
}
|
||||
|
||||
if (amount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user