Change Permutation Filter (#598)

Co-authored-by: slprime <history-21@yandex.ru>
This commit is contained in:
slprimeandslprime authored and GitHub committed 2025-01-25 13:16:28 -06:00
1 parent af55a6b191
commit 0bbb889f39
21 files changed
+453 -251

No files matched your search

@@ -9,6 +9,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -222,6 +223,19 @@ public class ItemStackMap<T> {
map.put(key, value);
}
public T computeIfAbsent(ItemStack key, Function<ItemStack, ? extends T> mappingFunction) {
T value;
if ((value = get(key)) == null) {
T newValue;
if ((newValue = mappingFunction.apply(key)) != null) {
put(key, newValue);
return newValue;
}
}
return value;
}
public void clear() {
itemMap.clear();
size = 0;