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);
}
Aggregations