当前位置: 首页>>代码示例>>Java>>正文


Java ItemFilter类代码示例

本文整理汇总了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;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:22,代码来源:ItemList.java

示例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;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:23,代码来源:SubsetWidget.java

示例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();
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:17,代码来源:SearchField.java

示例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);
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:17,代码来源:ItemList.java

示例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);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:11,代码来源:SubsetWidget.java

示例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);
            }
        }
    };
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:13,代码来源:SubsetWidget.java

示例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);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:32,代码来源:SearchField.java

示例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;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:8,代码来源:ItemList.java

示例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;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:9,代码来源:ItemList.java

示例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);
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:8,代码来源:SubsetWidget.java

示例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;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:12,代码来源:ItemList.java

示例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;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:13,代码来源:ItemList.java

示例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]);
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:55,代码来源:NEIInfoHandlerConfig.java

示例14: AllMultiItemFilter

import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public AllMultiItemFilter(List<ItemFilter> filters) {
    this.filters = filters;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:4,代码来源:ItemList.java

示例15: AnyMultiItemFilter

import codechicken.nei.api.ItemFilter; //导入依赖的package包/类
public AnyMultiItemFilter(List<ItemFilter> filters) {
    this.filters = filters;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:4,代码来源:ItemList.java


注:本文中的codechicken.nei.api.ItemFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。