Files
NotEnoughItems/src/main/java/codechicken/nei/ItemStackSet.java
T
slprimeandslprime adf2065305 Create Bookmarks Groups; Search Recipe (#451)
* Create Bookmarks Groups; Search Recipe

* fix crash after DnD; add remove group function

* change hiddenhandler handlerId

* Pull all Bookmarked Items: use groups

* Optimize Chain Algorithm

* remove println

* fix input V in ME terminal

* Add Search Recipe Icon

* fix recipe extra information

* Change Search Recipe Algorithm

* fixed rounding in chain calculation

* fix creating groups for 2-line recipes

* fix fast DnD and recipe tooltip

* Bookmarks Recipe Chains: fluid canner

* Bookmarks Recipe Chains: fluid cell

* Open GuiRecipe: normalizeItemStack

---------

Co-authored-by: slprime <[email protected]>
2024-02-04 13:09:24 +01:00

62 lines
1.5 KiB
Java

package codechicken.nei;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import codechicken.nei.api.ItemFilter;
public class ItemStackSet extends ItemStackMap<ItemStack> implements ItemFilter {
public ItemStackSet with(ItemStack... items) {
for (ItemStack item : items) add(item);
return this;
}
public ItemStackSet with(Item... items) {
for (Item item : items) add(ItemStackMap.wildcard(item));
return this;
}
public ItemStackSet with(Block... blocks) {
for (Block block : blocks) add(ItemStackMap.wildcard(Item.getItemFromBlock(block)));
return this;
}
public void add(ItemStack item) {
put(item, item);
}
public ItemStackSet addAll(List<ItemStack> items) {
for (ItemStack item : items) add(item);
return this;
}
public boolean contains(ItemStack item) {
return get(item) != null;
}
public boolean containsAll(Item item) {
return get(ItemStackMap.wildcard(item)) != null;
}
@Override
public boolean matches(ItemStack item) {
return contains(item);
}
public static ItemStackSet of(Block... blocks) {
return new ItemStackSet().with(blocks);
}
public static ItemStackSet of(Item... items) {
return new ItemStackSet().with(items);
}
public static ItemStackSet of(ItemStack... items) {
return new ItemStackSet().with(items);
}
}