mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Transit request overhaul (#135)
* Fix a pretty glaring issue in Pos3D equality checks * TransitRequest/TransitResponse overhaul. Items can now be pulled from multiple slots at once by Logistical Transporter and Logistical Sorter. getTopStacks() is now buildInventoryMap() and is more comprehensive of a total inventory. Note this is entirely untested and may have some issues to work out! * Cache hash code of HashedItem * Remove ISidedInventory/IInventory implementations
This commit is contained in:
1 parent
987894c63f
commit
934788e0e7
12 files changed
+212
-113
No files matched your search
@@ -1,7 +1,10 @@
|
||||
package mekanism.common.content.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
@@ -21,14 +24,20 @@ public final class InvStack {
|
||||
slotIDs = new ArrayList<>();
|
||||
side = facing;
|
||||
}
|
||||
|
||||
public InvStack(TileEntity inv, int slotID, ItemStack stack, EnumFacing facing) {
|
||||
this(inv, stack, getMap(slotID, stack), facing);
|
||||
}
|
||||
|
||||
public InvStack(TileEntity inv, int id, ItemStack stack, EnumFacing facing) {
|
||||
public InvStack(TileEntity inv, ItemStack stack, Map<Integer, Integer> idMap, EnumFacing facing) {
|
||||
tileEntity = inv;
|
||||
itemStacks = new ArrayList<>();
|
||||
slotIDs = new ArrayList<>();
|
||||
side = facing;
|
||||
|
||||
appendStack(id, stack);
|
||||
for(Map.Entry<Integer, Integer> entry : idMap.entrySet()) {
|
||||
appendStack(entry.getKey(), StackUtils.size(stack, entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
@@ -94,4 +103,10 @@ public final class InvStack {
|
||||
public void use() {
|
||||
use(getStack().getCount());
|
||||
}
|
||||
|
||||
private static Map<Integer, Integer> getMap(int slotID, ItemStack stack) {
|
||||
Map<Integer, Integer> map = new HashMap<>();
|
||||
map.put(slotID, stack.getCount());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user