本文整理汇总了Java中codechicken.nei.api.ItemFilter类的典型用法代码示例。如果您正苦于以下问题:Java ItemFilter类的具体用法?Java ItemFilter怎么用?Java ItemFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemFilter类属于codechicken.nei.api包,在下文中一共展示了ItemFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public void run() {
restart:
do {
refilter = false;
ArrayList<ItemStack> filtered = new ArrayList<ItemStack>();
List<ItemFilter> filters = getItemFilters();
for(ItemStack item : items) {
if(refilter)
continue restart;
if(itemMatches(item, filters))
filtered.add(item);
}
ItemSorter.sort(filtered);
ItemPanel.updateItemList(filtered);
}
while(refilter);
filtering = false;
}
示例2: getFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter(String searchText) {
if(!searchText.startsWith("@"))
return null;
searchText = searchText.substring(1);
AnyMultiItemFilter filter = new AnyMultiItemFilter();
SubsetTag tag = getTag(searchText);
if(tag != null)
tag.addFilters(filter.filters);
else {
Pattern p = SearchField.getPattern(searchText);
if(p == null) return null;
List<SubsetTag> matching = new LinkedList<SubsetTag>();
root.search(matching, p);
if(matching.isEmpty()) return null;
for(SubsetTag tag2 : matching)
tag2.addFilters(filter.filters);
}
return filter;
}
示例3: getFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter() {
String s_filter = text().toLowerCase();
List<ItemFilter> primary = new LinkedList<ItemFilter>();
List<ItemFilter> secondary = new LinkedList<ItemFilter>();
for (ISearchProvider p : searchProviders) {
ItemFilter filter = p.getFilter(s_filter);
if (filter != null)
(p.isPrimary() ? primary : secondary).add(filter);
}
if (!primary.isEmpty()) return new AnyMultiItemFilter(primary);
if (!secondary.isEmpty()) return new AnyMultiItemFilter(secondary);
return new EverythingItemFilter();
}
示例4: execute
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public void execute() {
ArrayList<ItemStack> filtered = new ArrayList<ItemStack>();
ItemFilter filter = getItemListFilter();
for(ItemStack item : items) {
if (interrupted()) return;
if(filter.matches(item))
filtered.add(item);
}
if(interrupted()) return;
ItemSorter.sort(filtered);
if(interrupted()) return;
ItemPanel.updateItemList(filtered);
}
示例5: SubsetTag
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public SubsetTag(String fullname, ItemFilter filter) {
assert filter != null : "Filter cannot be null";
this.fullname = EnumChatFormatting.getTextWithoutFormattingCodes(fullname);
this.filter = filter;
if(fullname != null) {
int idx = fullname.lastIndexOf('.');
displayName = idx < 0 ? fullname : fullname.substring(idx + 1);
}
}
示例6: getFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter() {
return new ItemFilter()//synchronise access on hiddenItems
{
@Override
public boolean matches(ItemStack item) {
synchronized (hiddenItems) {
return !hiddenItems.matches(item);
}
}
};
}
示例7: getFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter() {
String s_filter = text().toLowerCase();
for(ISearchProvider p : searchProviders) {
ItemFilter filter = p.getFilter(s_filter);
if(filter != null)
return filter;
}
switch(NEIClientConfig.getIntSetting("inventory.searchmode")) {
case 0://plain
s_filter = "\\Q"+s_filter+"\\E";
break;
case 1:
s_filter = s_filter
.replace(".", "")
.replace("?", ".")
.replace("*", ".+?");
break;
}
Pattern pattern = null;
try {
pattern = Pattern.compile(s_filter);
} catch (PatternSyntaxException ignored) {}
if (pattern == null || pattern.toString().equals(""))
return new EverythingItemFilter();
return new PatternItemFilter(pattern);
}
示例8: itemMatches
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public static boolean itemMatches(ItemStack item, List<ItemFilter> filters) {
for(ItemFilter filter : filters)
if(!filter.matches(item))
return false;
return true;
}
示例9: getItemFilters
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public static List<ItemFilter> getItemFilters() {
LinkedList<ItemFilter> filters = new LinkedList<ItemFilter>();
synchronized (itemFilterers) {
for(ItemFilterProvider p : itemFilterers)
filters.add(p.getFilter());
}
return filters;
}
示例10: addFilters
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public void addFilters(List<ItemFilter> filters) {
if(filter != null)
filters.add(filter);
for(SubsetTag child : sorted)
child.addFilters(filters);
}
示例11: matches
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
@Override
public boolean matches(ItemStack item) {
for(ItemFilter filter : filters)
try {
if (!filter.matches(item)) return false;
} catch (Exception e) {
NEIClientConfig.logger.error("Exception filtering "+item+" with "+filter, e);
}
return true;
}
示例12: itemMatchesAll
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public static boolean itemMatchesAll(ItemStack item, List<ItemFilter> filters) {
for(ItemFilter filter : filters) {
try {
if (!filter.matches(item))
return false;
} catch (Exception e) {
NEIClientConfig.logger.error("Exception filtering "+item+" with "+filter, e);
}
}
return true;
}
示例13: loadConfig
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public void loadConfig() {
NEIPing.init();
if (ExtraUtils.drum != null) {
API.addSubset("Extra Common.Drums", (ItemFilter)new SubsetItemsNBT(Item.getItemFromBlock(ExtraUtils.drum)));
}
if (ExtraUtils.microBlocks != null) {
API.addSubset("Extra Common.Extra Microblocks", (ItemFilter)new SubsetItemsNBT(ExtraUtils.microBlocks));
}
if (ExtraUtils.colorBlockDataEnabled) {
API.addSubset("Extra Common.Colored Blocks", (ItemFilter)new SubsetBlockClass(BlockColor.class));
}
if (ExtraUtils.greenScreen != null) {
API.addSubset("Extra Common.Lapis Caelestis", (ItemFilter)new SubsetItems(new Item[] { Item.getItemFromBlock((Block)ExtraUtils.greenScreen) }));
}
if (ExtraUtils.cobblestoneCompr != null) {
API.addSubset("Extra Common.Compressed Blocks", (ItemFilter)new SubsetItems(new Item[] { Item.getItemFromBlock((Block)ExtraUtils.cobblestoneCompr) }));
}
if (ExtraUtils.decorative1Enabled || ExtraUtils.decorative2Enabled) {
API.addSubset("Extra Common.Decorative Blocks", (ItemFilter)new SubsetBlockClass(BlockDecoration.class));
}
if (ExtraUtils.generator2 != null) {
final SubsetItems s = new SubsetItems(new Item[] { Item.getItemFromBlock(ExtraUtils.generator2) });
if (ExtraUtils.generator3 != null) {
s.addItem(Item.getItemFromBlock(ExtraUtils.generator3));
}
API.addSubset("Extra Common.Higher Tier Generators", (ItemFilter)s);
}
for (final Matcher matcher : AdvancedNodeUpgrades.entryList) {
if (matcher != AdvancedNodeUpgrades.nullMatcher && matcher.type == Matcher.Type.ITEM && matcher.shouldAddToNEI() && matcher.isSelectable()) {
String localizedName = matcher.getLocalizedName();
localizedName = localizedName.replace(".exe", "");
localizedName = localizedName.replaceAll("\\.", "");
API.addSubset("Extra Filtering." + localizedName, (ItemFilter)new ItemFilterWrapper(matcher));
}
}
API.registerRecipeHandler((ICraftingHandler)new EnderConstructorHandler());
API.registerUsageHandler((IUsageHandler)new EnderConstructorHandler());
API.registerRecipeHandler((ICraftingHandler)new InfoHandler());
API.registerUsageHandler((IUsageHandler)new InfoHandler());
API.registerRecipeHandler((ICraftingHandler)new SoulHandler());
API.registerUsageHandler((IUsageHandler)new SoulHandler());
if (Loader.isModLoaded("ForgeMultipart")) {
API.registerRecipeHandler((ICraftingHandler)new FMPMicroBlocksHandler());
API.registerUsageHandler((IUsageHandler)new FMPMicroBlocksHandler());
API.registerRecipeHandler((ICraftingHandler)new MicroBlocksHandler());
API.registerUsageHandler((IUsageHandler)new MicroBlocksHandler());
API.registerGuiOverlayHandler((Class)GuiCrafting.class, (IOverlayHandler)new FMPMicroBlocksOverlayHandler(), "microblocks");
API.registerGuiOverlayHandler((Class)GuiInventory.class, (IOverlayHandler)new FMPMicroBlocksOverlayHandler(63, 20), "microblocks2x2");
}
if (ExtraUtils.colorBlockData != null) {
API.hideItem(new ItemStack(ExtraUtils.colorBlockData));
}
LogHelper.info("Added NEI integration", new Object[0]);
}
示例14: AllMultiItemFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public AllMultiItemFilter(List<ItemFilter> filters) {
this.filters = filters;
}
示例15: AnyMultiItemFilter
import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public AnyMultiItemFilter(List<ItemFilter> filters) {
this.filters = filters;
}