Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Luis C.M committed 2023-08-06 11:00:48 -05:00
commit 3ed474a03b
8 files changed
+187 -31

No files matched your search

@@ -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();
}
@@ -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<String,Integer> data = new HashMap<String,Integer>();
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<String> hostileList = new ArrayList<String>(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<String> getSearchList(){
if(search.isEmpty()){
return new ArrayList<String>(this.data.keySet());
}
List<String> list = new ArrayList<String>();
for(String name : this.data.keySet()){
if(name.toLowerCase().contains(search))
list.add(name);
}
return list;
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data) {
String name = scrollFactions.getSelected();
this.data = data;
scrollFactions.setList(list);
scrollFactions.setList(getSearchList());
if(name != null)
scrollFactions.setSelected(name);
@@ -16,6 +16,7 @@ import java.util.Vector;
public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{
private GuiCustomScroll scroll;
private List<String> data = new ArrayList<String>();
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<String> getSearchList(){
if(search.isEmpty()){
return new ArrayList<String>(this.data);
}
List<String> list = new ArrayList<String>();
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<String> list, HashMap<String, Integer> data) {
this.data = new ArrayList<String>(list);
this.scroll.setList(getSearchList());
initGui();
}
@@ -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();
}
@@ -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<String,Integer> data = new HashMap<String,Integer>();
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<String> getSearchList(){
if(search.isEmpty()){
return new ArrayList<String>(this.data.keySet());
}
List<String> list = new ArrayList<String>();
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<String> list, HashMap<String, Integer> data) {
String name = scrollTags.getSelected();
this.data = data;
scrollTags.setList(list);
scrollTags.setList(getSearchList());
if(name != null)
scrollTags.setSelected(name);
@@ -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<String> getSearchList(){
if(search.isEmpty()){
return new ArrayList<String>(this.data.keySet());
}
List<String> list = new ArrayList<String>();
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<String> list, HashMap<String, Integer> 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);
@@ -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<String, Integer> data = new HashMap<String, Integer>();
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<String> getSearchList(){
if(search.isEmpty()){
return new ArrayList<String>(this.data.keySet());
}
List<String> list = new ArrayList<String>();
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<String> list, HashMap<String, Integer> data) {
String name = scrollNaturalSpawns.getSelected();
this.data = data;
scrollNaturalSpawns.setList(list);
scrollNaturalSpawns.setList(getSearchList());
if(name != null)
scrollNaturalSpawns.setSelected(name);