Made the booklet search bar search a whole item's tooltip

This commit is contained in:
Ellpeck 2016-07-14 13:02:09 +02:00
parent 3d6ecda213
commit bb0d64e869

View file

@ -229,16 +229,24 @@ public final class BookletUtils{
} }
private static boolean getChapterStacksContainString(String text, IBookletChapter chapter){ private static boolean getChapterStacksContainString(String text, IBookletChapter chapter){
Minecraft mc = Minecraft.getMinecraft();
for(BookletPage page : chapter.getPages()){ for(BookletPage page : chapter.getPages()){
ItemStack[] pageStacks = page.getItemStacksForPage(); ItemStack[] pageStacks = page.getItemStacksForPage();
if(pageStacks != null){ if(pageStacks != null){
for(ItemStack stack : pageStacks){ for(ItemStack stack : pageStacks){
if(stack != null && stack.getDisplayName().toLowerCase(Locale.ROOT).contains(text)){ if(stack != null && stack.getItem() != null){
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
for(String s : list){
if(s != null && !s.isEmpty()){
if(s.toLowerCase(Locale.ROOT).contains(text)){
return true; return true;
} }
} }
} }
} }
}
}
}
return false; return false;
} }