Search in sources :

Example 1 with ContainerSearcher

use of pneumaticCraft.common.inventory.ContainerSearcher in project PneumaticCraft by MineMaarten.

the class GuiSearcher method updateCreativeSearch.

private void updateCreativeSearch() {
    ContainerSearcher containerSearcher = (ContainerSearcher) inventorySlots;
    containerSearcher.itemList.clear();
    Iterator iterator = Item.itemRegistry.iterator();
    while (iterator.hasNext()) {
        Item item = (Item) iterator.next();
        if (item != null && item.getCreativeTab() != null) {
            item.getSubItems(item, (CreativeTabs) null, containerSearcher.itemList);
        }
    }
    Enchantment[] aenchantment = Enchantment.enchantmentsList;
    int j = aenchantment.length;
    for (int i = 0; i < j; ++i) {
        Enchantment enchantment = aenchantment[i];
        if (enchantment != null && enchantment.type != null) {
            Items.enchanted_book.func_92113_a(enchantment, containerSearcher.itemList);
        }
    }
    iterator = containerSearcher.itemList.iterator();
    String s = searchField.getText().toLowerCase();
    while (iterator.hasNext()) {
        ItemStack itemstack = (ItemStack) iterator.next();
        boolean flag = false;
        Iterator iterator1 = itemstack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips).iterator();
        while (true) {
            if (iterator1.hasNext()) {
                String s1 = (String) iterator1.next();
                if (!s1.toLowerCase().contains(s)) {
                    continue;
                }
                flag = true;
            }
            if (!flag) {
                iterator.remove();
            }
            break;
        }
    }
    currentScroll = 0.0F;
    containerSearcher.scrollTo(0.0F);
}
Also used : ContainerSearcher(pneumaticCraft.common.inventory.ContainerSearcher) Item(net.minecraft.item.Item) Iterator(java.util.Iterator) Enchantment(net.minecraft.enchantment.Enchantment) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Iterator (java.util.Iterator)1 Enchantment (net.minecraft.enchantment.Enchantment)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 ContainerSearcher (pneumaticCraft.common.inventory.ContainerSearcher)1