diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java index fc1bc0bd0..59f4c1d92 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java @@ -75,6 +75,13 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); this.addButton(new GuiNpcButton(3,guiLeft + 358, guiTop + 117, 58, 20, "gui.copy")); + if(dialog != null) { + if(dialog.id != -1){ + addLabel(new GuiNpcLabel(0, "ID:", guiLeft + 358, guiTop + 4 + 3 + 185)); + addLabel(new GuiNpcLabel(1, dialog.id + "", guiLeft + 358, guiTop + 4 + 3 + 195)); + } + } + updateButtons(); } diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java index d744c9239..6c75a9484 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java @@ -10,10 +10,7 @@ import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.controllers.data.Faction; import noppes.npcs.entity.EntityNPCInterface; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Vector; +import java.util.*; public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData, ISubGuiListener { @@ -21,6 +18,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat private HashMap data = new HashMap(); private Faction faction = new Faction(); private String selected = null; + private String search = ""; public GuiNPCManageFactions(EntityNPCInterface npc) { @@ -37,13 +35,14 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat if(scrollFactions == null){ scrollFactions = new GuiCustomScroll(this,0); - scrollFactions.setSize(143, 208); + scrollFactions.setSize(143, 185); } scrollFactions.guiLeft = guiLeft + 220; scrollFactions.guiTop = guiTop + 4; addScroll(scrollFactions); - - if (faction.id == -1) + addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 220, guiTop + 4 + 3 + 185, 143, 20, search)); + + if (faction.id == -1) return; this.addTextField(new GuiNpcTextField(0, this, guiLeft + 40, guiTop + 4, 136, 20, faction.name)); @@ -70,7 +69,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat addLabel(new GuiNpcLabel(4,"faction.attacked", guiLeft + 8, guiTop + 97)); this.addButton(new GuiNpcButton(4,guiLeft + 100, guiTop + 92, 45, 20, new String[]{"gui.no","gui.yes"},faction.getsAttacked?1:0)); - addLabel(new GuiNpcLabel(6,"faction.hostiles", guiLeft + 8, guiTop + 145)); + addLabel(new GuiNpcLabel(6,"faction.hostiles", guiLeft + 8, guiTop + 120)); ArrayList hostileList = new ArrayList(scrollFactions.getList()); hostileList.remove(faction.name); @@ -82,9 +81,9 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat } GuiCustomScroll scrollHostileFactions = new GuiCustomScroll(this,1,true); - scrollHostileFactions.setSize(163, 58); + scrollHostileFactions.setSize(163, 78); scrollHostileFactions.guiLeft = guiLeft + 4; - scrollHostileFactions.guiTop = guiTop + 154; + scrollHostileFactions.guiTop = guiTop + 134; scrollHostileFactions.setList(hostileList); scrollHostileFactions.setSelectedList(set); addScroll(scrollHostileFactions); @@ -134,13 +133,38 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat setSelected(faction.name); initGui(); } - + + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if(getTextField(55) != null){ + if(getTextField(55).isFocused()){ + if(search.equals(getTextField(55).getText())) + return; + search = getTextField(55).getText().toLowerCase(); + scrollFactions.setList(getSearchList()); + } + } + } + + private List getSearchList(){ + if(search.isEmpty()){ + return new ArrayList(this.data.keySet()); + } + List list = new ArrayList(); + for(String name : this.data.keySet()){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } @Override public void setData(Vector list, HashMap data) { String name = scrollFactions.getSelected(); this.data = data; - scrollFactions.setList(list); + scrollFactions.setList(getSearchList()); if(name != null) scrollFactions.setSelected(name); diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java index 303fb9368..ba7594214 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java @@ -16,6 +16,7 @@ import java.util.Vector; public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{ private GuiCustomScroll scroll; private List data = new ArrayList(); + private String search = ""; public static GuiScreen Instance; @@ -34,14 +35,41 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa if(scroll == null){ scroll = new GuiCustomScroll(this,0); - scroll.setSize(143, 208); + scroll.setSize(143, 185); } scroll.guiLeft = guiLeft + 214; scroll.guiTop = guiTop + 4; - scroll.setList(data); + scroll.setList(getSearchList()); this.addScroll(scroll); + addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 220, guiTop + 4 + 3 + 185, 143, 20, search)); } + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if(getTextField(55) != null){ + if(getTextField(55).isFocused()){ + if(search.equals(getTextField(55).getText())) + return; + search = getTextField(55).getText().toLowerCase(); + scroll.setList(getSearchList()); + } + } + } + + private List getSearchList(){ + if(search.isEmpty()){ + return new ArrayList(this.data); + } + List list = new ArrayList(); + for(String name : this.data){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } + @Override public void buttonEvent(GuiButton button){ if(button.id == 1){ @@ -65,6 +93,7 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa @Override public void setData(Vector list, HashMap data) { this.data = new ArrayList(list); + this.scroll.setList(getSearchList()); initGui(); } diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java index 2f3ce244c..aec424849 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java @@ -5,9 +5,6 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.client.Client; import noppes.npcs.client.gui.*; -import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeDialog; -import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeKill; -import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeLocation; import noppes.npcs.client.gui.util.*; import noppes.npcs.constants.*; import noppes.npcs.controllers.data.Quest; @@ -43,6 +40,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup, { super(npc); Instance = this; + quest = new Quest(); Client.sendData(EnumPacketServer.QuestCategoriesGet); } @@ -82,6 +80,13 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup, this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); this.addButton(new GuiNpcButton(3,guiLeft + 358, guiTop + 117, 58, 20, "gui.copy")); + if(quest != null) { + if(quest.id != -1){ + addLabel(new GuiNpcLabel(0, "ID:", guiLeft + 358, guiTop + 4 + 3 + 185)); + addLabel(new GuiNpcLabel(1, quest.id + "", guiLeft + 358, guiTop + 4 + 3 + 195)); + } + } + updateButtons(); } diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTags.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTags.java index 045adf2ae..7794451ea 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTags.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTags.java @@ -9,7 +9,9 @@ import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.controllers.data.Tag; import noppes.npcs.entity.EntityNPCInterface; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Vector; public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData, ISubGuiListener @@ -18,6 +20,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC private HashMap data = new HashMap(); private Tag tag = new Tag(); private String selected = null; + private String search = ""; public GuiNPCManageTags(EntityNPCInterface npc) { @@ -34,13 +37,14 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC if(scrollTags == null){ scrollTags = new GuiCustomScroll(this,0); - scrollTags.setSize(143, 208); + scrollTags.setSize(143, 185); } scrollTags.guiLeft = guiLeft + 220; scrollTags.guiTop = guiTop + 4; addScroll(scrollTags); - - if (tag.id == -1) + addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 220, guiTop + 4 + 3 + 185, 143, 20, search)); + + if (tag.id == -1) return; this.addTextField(new GuiNpcTextField(0, this, guiLeft + 40, guiTop + 4, 136, 20, tag.name)); @@ -61,6 +65,32 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC this.addButton(new GuiNpcButton(3,guiLeft + 50, guiTop + 54, 60, 20, new String[]{"gui.no","gui.yes"},tag.hideTag?1:0)); } + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if(getTextField(55) != null){ + if(getTextField(55).isFocused()){ + if(search.equals(getTextField(55).getText())) + return; + search = getTextField(55).getText().toLowerCase(); + scrollTags.setList(getSearchList()); + } + } + } + + private List getSearchList(){ + if(search.isEmpty()){ + return new ArrayList(this.data.keySet()); + } + List list = new ArrayList(); + for(String name : this.data.keySet()){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } + @Override protected void actionPerformed(GuiButton guibutton){ GuiNpcButton button = (GuiNpcButton) guibutton; @@ -105,7 +135,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC public void setData(Vector list, HashMap data) { String name = scrollTags.getSelected(); this.data = data; - scrollTags.setList(list); + scrollTags.setList(getSearchList()); if(name != null) scrollTags.setSelected(name); diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java index 373fa679c..58ab5ea72 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java @@ -13,7 +13,9 @@ import noppes.npcs.controllers.data.RecipeCarpentry; import noppes.npcs.entity.EntityNPCInterface; import org.lwjgl.opengl.GL11; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Vector; public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener,ITextfieldListener{ @@ -22,6 +24,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS private ContainerManageRecipes container; private String selected = null; private ResourceLocation slot; + private String search = ""; public GuiNpcManageRecipes(EntityNPCInterface npc,ContainerManageRecipes container){ super(npc,container); @@ -43,15 +46,15 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS scroll.guiLeft = guiLeft + 172; scroll.guiTop = guiTop + 8; addScroll(scroll); + addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 172, guiTop + 8 + 3 + 180, 130, 20, search)); - this.addButton(new GuiNpcButton(0,guiLeft + 306, guiTop + 10, 84, 20, "menu.global")); - this.addButton(new GuiNpcButton(1,guiLeft + 306, guiTop + 32, 84, 20, "tile.npcCarpentyBench.name")); + this.addButton(new GuiNpcButton(0,guiLeft + 306, guiTop + 10, 94, 30, "menu.global")); + this.addButton(new GuiNpcButton(1,guiLeft + 306, guiTop + 32, 94, 20, "tile.npcCarpentyBench.name")); this.getButton(0).setEnabled(container.width == 4); this.getButton(1).setEnabled(container.width == 3); - this.addButton(new GuiNpcButton(3,guiLeft + 306, guiTop + 60, 84, 20, "gui.add")); - this.addButton(new GuiNpcButton(4,guiLeft + 306, guiTop + 82, 84, 20, "gui.remove")); - + this.addButton(new GuiNpcButton(3,guiLeft + 306, guiTop + 60, 94, 20, "gui.add")); + this.addButton(new GuiNpcButton(4,guiLeft + 306, guiTop + 82, 94, 20, "gui.remove")); this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 86, guiTop + 32)); this.addButton(new GuiNpcButtonYesNo(5,guiLeft + 114, guiTop + 40, 50, 20, container.recipe.ignoreDamage)); @@ -99,6 +102,33 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS container.recipe.ignoreNBT = button.getValue() == 1; } } + + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if(getTextField(55) != null){ + if(getTextField(55).isFocused()){ + if(search.equals(getTextField(55).getText())) + return; + search = getTextField(55).getText().toLowerCase(); + scroll.setList(getSearchList()); + } + } + } + + private List getSearchList(){ + if(search.isEmpty()){ + return new ArrayList(this.data.keySet()); + } + List list = new ArrayList(); + for(String name : this.data.keySet()){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } + @Override public void setGuiData(NBTTagCompound compound) { RecipeCarpentry recipe = RecipeCarpentry.read(compound); @@ -129,7 +159,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS public void setData(Vector list, HashMap data) { String name = scroll.getSelected(); this.data = data; - scroll.setList(list); + scroll.setList(getSearchList()); this.getTextField(0).enabled = name != null; this.getButton(5).setEnabled(name != null); diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java index 2fa8c5126..c6cd4a353 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java @@ -20,6 +20,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I private GuiCustomScroll scrollNaturalSpawns; private final GuiCustomScroll spawnEntryScroll = new GuiCustomScroll(this, 20, false); private HashMap data = new HashMap(); + private String search = ""; private SpawnData spawn = new SpawnData(); @@ -33,11 +34,12 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I super.initGui(); if(this.scrollNaturalSpawns == null){ this.scrollNaturalSpawns = new GuiCustomScroll(this,0); - this.scrollNaturalSpawns.setSize(143, 208); + this.scrollNaturalSpawns.setSize(143, 185); } this.scrollNaturalSpawns.guiLeft = guiLeft + 214; this.scrollNaturalSpawns.guiTop = guiTop + 4; this.addScroll(this.scrollNaturalSpawns); + addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 214, guiTop + 4 + 3 + 185, 143, 20, search)); this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add")); this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); @@ -83,6 +85,33 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I addButton(new GuiNpcButton(26, guiLeft + 92, y, 100, 20, this.getTitle(this.spawn.spawnCompounds.get(selected)))); } } + + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if(getTextField(55) != null){ + if(getTextField(55).isFocused()){ + if(search.equals(getTextField(55).getText())) + return; + search = getTextField(55).getText().toLowerCase(); + scrollNaturalSpawns.setList(getSearchList()); + } + } + } + + private List getSearchList(){ + if(search.isEmpty()){ + return new ArrayList(this.data.keySet()); + } + List list = new ArrayList(); + for(String name : this.data.keySet()){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } + private String getTitle(NBTTagCompound compound) { if(compound != null && compound.hasKey("ClonedName")) return compound.getString("ClonedName"); @@ -182,7 +211,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I public void setData(Vector list, HashMap data) { String name = scrollNaturalSpawns.getSelected(); this.data = data; - scrollNaturalSpawns.setList(list); + scrollNaturalSpawns.setList(getSearchList()); if(name != null) scrollNaturalSpawns.setSelected(name); diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index 75a152edb..f901b4992 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -150,13 +150,15 @@ spawner.mobspawner=Spawner spawner.mount=Mount by spawner.mountplayer=Player mounts -spawner.diesafter=Dies after spawns die spawner.posoffset=Position Offset spawner.type=Spawn Type spawner.all=All spawner.random=Random spawner.one=One by One -spawner.despawn=Despawn Spawns On Target Lost +spawner.summoner=Summoner Dies +spawner.diesafter=Summoner Dies when Spawns Die +spawner.despawn=Clear Spawns On Target Lost +spawner.despawnsummon=Clear Spawns On Summoner Death mailbox.name=Mailbox mailbox.sender=Sender