Speed up ME Terminal search performance by using CompletableFuture

This commit is contained in:
Lasm Gratel
2022-09-20 18:02:07 +08:00
parent 9011273229
commit 8c735305d7
5 changed files with 134 additions and 80 deletions
@@ -94,4 +94,9 @@ public class ItemListIgnoreCrafting<T extends IAEStack<T>> implements IItemList<
public void resetStatus() {
this.target.resetStatus();
}
@Override
public ItemListIgnoreCrafting<T> clone() {
return new ItemListIgnoreCrafting<>(target);
}
}
@@ -140,6 +140,14 @@ public final class ItemList implements IItemList<IAEItemStack> {
}
}
@Override
public ItemList clone() {
ItemList list = new ItemList();
list.records.putAll(records);
list.version.set(version.get());
return list;
}
private ItemVariantList getOrCreateRecord(Item item) {
return this.records.computeIfAbsent(item, this::makeRecordMap);
}