mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Cleaned and generalised item loading/searching
Reimplemented subsets Added regex searching Fixed format error on delete all Fixed GuiButton handling clicks before NEI widgets could override Re-Implemented banned blocks implementation Added brewing recipes again note test obf ASM beacons Fixed some calls being intercepted by item panel when mouse was over a gui element Fixed crash on closing potion window with escape Disabled fast transfer, scrolling, and drag 'n' drop in creative Added item panel sorting Removed TMI uninstaller Fixed /give command Updated to 1.7.10
This commit is contained in:
1 parent
3c9ebc6961
commit
3c84527806
67 files changed
+3251
-2319
No files matched your search
@@ -1,14 +1,34 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemStackSet
|
||||
public class ItemStackSet implements ItemFilter
|
||||
{
|
||||
ItemStackMap<Object> underlying = new ItemStackMap<Object>();
|
||||
|
||||
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) {
|
||||
underlying.put(item, new Object());
|
||||
}
|
||||
@@ -22,7 +42,7 @@ public class ItemStackSet
|
||||
}
|
||||
|
||||
public boolean containsAll(Item item) {
|
||||
return underlying.itemMap.containsKey(item) && underlying.itemMap.get(item).wildcard != null;
|
||||
return underlying.get(ItemStackMap.wildcard(item)) != null;
|
||||
}
|
||||
|
||||
public List<ItemStack> values() {
|
||||
@@ -32,4 +52,29 @@ public class ItemStackSet
|
||||
public void clear() {
|
||||
underlying.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return contains(item);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return underlying.size();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return underlying.isEmpty();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user