use of logisticspipes.utils.tuples.Pair in project LogisticsPipes by RS485.
the class PipeTransportLogistics method readFromNBT.
public void readFromNBT(NBTTagCompound nbt) {
NBTTagList nbttaglist = nbt.getTagList("travelingEntities", 10);
for (int j = 0; j < nbttaglist.tagCount(); ++j) {
try {
NBTTagCompound dataTag = nbttaglist.getCompoundTagAt(j);
LPTravelingItem item = new LPTravelingItemServer(dataTag);
if (item.isCorrupted()) {
continue;
}
items.scheduleLoad(item);
} catch (Throwable t) {
// It may be the case that entities cannot be reloaded between
// two versions - ignore these errors.
}
}
_itemBuffer.clear();
NBTTagList nbttaglist2 = nbt.getTagList("buffercontents", 10);
for (int i = 0; i < nbttaglist2.tagCount(); i++) {
NBTTagCompound nbttagcompound1 = nbttaglist2.getCompoundTagAt(i);
_itemBuffer.add(new Triplet<>(ItemIdentifierStack.getFromStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)), new Pair<>(_bufferTimeOut, 0), null));
}
}
use of logisticspipes.utils.tuples.Pair 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);
}
Aggregations