diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java index ec65abc7e..f17b47e84 100644 --- a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java @@ -42,6 +42,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { private int posX,posY,posZ; private List list; + private List rawList; private List tagList; private static int showingClones = 0; @@ -181,6 +182,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { } } this.list = list; + this.rawList = new ArrayList(this.list); scroll.setList(getSearchList(), ascending == 0, sortType == 0); } private void showClones() { @@ -198,6 +200,26 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { } this.tagMap = ClientTagMapController.Instance.getTagMap(activeTab); + this.rawList = new ArrayList(this.list); + if(this.tagMap != null){ + if(GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1){ + for(int i = 0; i < this.list.size(); i++){ + StringBuilder npcName = new StringBuilder(list.get(i)); + if (this.tagMap.hasClone(list.get(i))) { + for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))){ + Tag tag = tags.get(tagUUID); + if(tag != null){ + if(GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()){ + npcName.append(" [" + tag.name + "]"); + } + } + } + } + this.rawList.set(i, npcName.toString()); + } + } + } + scroll.setList(getSearchList(), ascending == 0, sortType == 0); } public void keyTyped(char c, int i) @@ -222,6 +244,9 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { if(this.list == null){ this.list = new ArrayList(); } + if(this.rawList == null){ + this.rawList = new ArrayList(); + } // No Filters - or - Entities if(tagFilters.size() == 0 || showingClones == 1){ @@ -231,9 +256,10 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { // Yes Search else { List list = new ArrayList(); - for(String name : this.list){ - if(name.toLowerCase().contains(search)) - list.add(name); + for(int i = 0; i < this.list.size(); i++){ + if(this.rawList.get(i).toLowerCase().contains(search)){ + list.add(this.list.get(i)); + } } return list; } @@ -257,14 +283,16 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { // Yes Search List list = new ArrayList(); - for(String name : this.list){ - if(name.toLowerCase().contains(search)) { - if(tagMap.hasClone(name)){ - if(meetsCondition(name)){ - list.add(name); + for(int i = 0; i < this.list.size(); i++){ + if(this.rawList.get(i).toLowerCase().contains(search)){ + String npcName = this.list.get(i); + if(tagMap.hasClone(npcName)){ + if(meetsCondition(npcName)){ + list.add(npcName); } } } + } return list; } @@ -481,6 +509,27 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData { } this.list = list; + + this.rawList = new ArrayList(this.list); + if(this.tagMap != null){ + if(GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1){ + for(int i = 0; i < this.list.size(); i++){ + StringBuilder npcName = new StringBuilder(list.get(i)); + if (this.tagMap.hasClone(list.get(i))) { + for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))){ + Tag tag = tags.get(tagUUID); + if(tag != null){ + if(GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()){ + npcName.append(" [" + tag.name + "]"); + } + } + } + } + this.rawList.set(i, npcName.toString()); + } + } + } + scroll.setList(getSearchList(), ascending == 0, sortType == 0); } } diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiCustomScrollCloner.java b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScrollCloner.java index cb6a00f8a..7aaeae794 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiCustomScrollCloner.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScrollCloner.java @@ -56,7 +56,7 @@ public class GuiCustomScrollCloner extends GuiCustomScroll { } if((this.parent.getShowingClones() == 0 || this.parent.getShowingClones() == 2) && this.parent.tagMap != null){ - int tagStartX = j + fontRendererObj.getStringWidth(displayString) + 5; + int tagStartX = j + fontRendererObj.getStringWidth(displayString) + 3; if(GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1){ if (this.parent.tagMap.hasClone(list.get(i))) { for (UUID tagUUID : this.parent.tagMap.getUUIDsList(list.get(i))){ @@ -64,7 +64,7 @@ public class GuiCustomScrollCloner extends GuiCustomScroll { if(tag != null){ if(GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()){ fontRendererObj.drawString("[" + tag.name + "]", tagStartX, k, tag.color); - tagStartX += fontRendererObj.getStringWidth("[" + tag.name + "]") + 2; + tagStartX += fontRendererObj.getStringWidth("[" + tag.name + "]") + 3; } } }