Search in sources :

Example 56 with ItemIdentifierStack

use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.

the class PipeTransportLogistics method writeToNBT.

public void writeToNBT(NBTTagCompound nbt) {
    {
        NBTTagList nbttaglist = new NBTTagList();
        for (LPTravelingItem item : items) {
            if (item instanceof LPTravelingItemServer) {
                NBTTagCompound dataTag = new NBTTagCompound();
                nbttaglist.appendTag(dataTag);
                ((LPTravelingItemServer) item).writeToNBT(dataTag);
            }
        }
        nbt.setTag("travelingEntities", nbttaglist);
    }
    NBTTagList nbttaglist2 = new NBTTagList();
    for (Pair<ItemIdentifierStack, Pair<Integer, Integer>> stack : _itemBuffer) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        stack.getValue1().makeNormalStack().writeToNBT(nbttagcompound1);
        nbttaglist2.appendTag(nbttagcompound1);
    }
    nbt.setTag("buffercontents", nbttaglist2);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer) Pair(logisticspipes.utils.tuples.Pair)

Example 57 with ItemIdentifierStack

use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.

the class ItemDisplay method setItemList.

public void setItemList(Collection<ItemIdentifierStack> allItems) {
    listbyserver = true;
    _allItems.clear();
    _allItems.addAll(allItems);
    Collections.sort(_allItems, new StackComparitor());
    boolean found = false;
    if (selectedItem == null) {
        return;
    }
    for (ItemIdentifierStack itemStack : _allItems) {
        if (itemStack.getItem().equals(selectedItem.getItem())) {
            selectedItem = itemStack;
            found = true;
            break;
        }
    }
    if (!found) {
        selectedItem = null;
    }
}
Also used : ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack)

Example 58 with ItemIdentifierStack

use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.

the class LPDataIOWrapper method readItemIdentifierStack.

@Override
public ItemIdentifierStack readItemIdentifierStack() {
    int stacksize = readInt();
    if (stacksize == -1) {
        return null;
    }
    ItemIdentifier item = readItemIdentifier();
    return new ItemIdentifierStack(item, stacksize);
}
Also used : ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack)

Aggregations

ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)58 ItemStack (net.minecraft.item.ItemStack)21 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)18 ArrayList (java.util.ArrayList)9 Pair (logisticspipes.utils.tuples.Pair)8 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)7 LinkedList (java.util.LinkedList)5 NBTTagList (net.minecraft.nbt.NBTTagList)5 List (java.util.List)4 IRoutedItem (logisticspipes.logisticspipes.IRoutedItem)4 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)4 DictResource (logisticspipes.request.resources.DictResource)4 IResource (logisticspipes.request.resources.IResource)4 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 HashMap (java.util.HashMap)3 TreeSet (java.util.TreeSet)3 LogisticsCraftingTableTileEntity (logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)3 IAdditionalTargetInformation (logisticspipes.interfaces.routing.IAdditionalTargetInformation)3 ItemResource (logisticspipes.request.resources.ItemResource)3 IRouter (logisticspipes.routing.IRouter)3