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

# Conflicts:
#	src/main/java/noppes/npcs/client/renderer/customitem/CustomItemRenderer.java
This commit is contained in:
Luis C.M committed 2023-06-01 16:36:47 -05:00
commit dd54e46df4
5 files changed
+70 -21

No files matched your search

@@ -172,6 +172,10 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if(subgui instanceof SubGuiClonerNPCTags){
close();
return;
}
initGui();
}
@@ -30,8 +30,8 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
setBackground("menubg.png");
xSize = 305;
ySize = 220;
closeOnEsc = false;
this.npc = npc;
closeOnEsc = false;
}
public void initGui()
@@ -86,6 +86,7 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
tagNames.clear();
}
if (guibutton.id == 66) {
save();
close();
}
initGui();
@@ -154,11 +155,4 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
}
return list;
}
@Override
public void close() {
save();
super.close();
}
}
@@ -1,14 +1,9 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.data.Tag;
import noppes.npcs.controllers.data.TagMap;
import org.lwjgl.Sys;
import java.util.*;
@@ -16,6 +11,7 @@ public class SubGuiClonerQuickTags extends SubGuiInterface implements IScrollDat
{
public GuiNpcMobSpawnerAdd parent;
public GuiCustomScroll quickScroll = new GuiCustomScroll(this,0);
public GuiCustomScroll selectedScroll = new GuiCustomScroll(this,5);
private static String quickSearch = "";
public SubGuiClonerQuickTags(GuiNpcMobSpawnerAdd par){
@@ -36,35 +32,60 @@ public class SubGuiClonerQuickTags extends SubGuiInterface implements IScrollDat
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
this.addScroll(quickScroll);
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.wandtags"), guiLeft + 7, guiTop + 7));
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.wandTags"), guiLeft + 7, guiTop + 7));
addScroll(quickScroll);
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 190, 140, 20, quickSearch));
addButton(new GuiNpcButton(10, guiLeft + 150, guiTop + 20, 120, 20, "gui.selectAll"));
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 43, 120, 20, "gui.deselectAll"));
addButton(new GuiNpcButton(66, guiLeft + 240, guiTop + 175, 60, 20, "gui.done"));
selectedScroll.clear();
selectedScroll.setSize(145, 103);
selectedScroll.guiLeft = guiLeft + 150;
selectedScroll.guiTop = guiTop + 82;
selectedScroll.setUnselectable();
this.addScroll(selectedScroll);
getSelected();
addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 153, guiTop + 68));
addScroll(selectedScroll);
addButton(new GuiNpcButton(66, guiLeft + 240, guiTop + 190, 60, 20, "gui.done"));
setSelected();
refreshSelected();
}
protected void actionPerformed(GuiButton guibutton){
if (guibutton.id == 10) {
GuiNpcMobSpawnerAdd.addTags = new HashSet<>(parent.allTags);
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
refreshSelected();
}
if (guibutton.id == 11) {
GuiNpcMobSpawnerAdd.addTags = new HashSet<>();
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
refreshSelected();
}
if (guibutton.id == 66) {
close();
}
}
public void getSelected(){
@Override
public void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
refreshSelected();
}
public void setSelected(){
quickScroll.setList(getQuickTags());
}
public void refreshSelected(){
List<String> sortedList = new ArrayList<>(new TreeSet<>(GuiNpcMobSpawnerAdd.addTags));
selectedScroll.setList(sortedList);
}
@Override
public void keyTyped(char c, int i)
{
@@ -10,7 +10,9 @@ import noppes.npcs.containers.ContainerManageBanks;
import noppes.npcs.controllers.data.Bank;
import noppes.npcs.entity.EntityNPCInterface;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData
@@ -20,6 +22,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
private ContainerManageBanks container;
private Bank bank = new Bank();
private String selected = null;
private String search = "";
public GuiNPCManageBanks(EntityNPCInterface npc,ContainerManageBanks container)
{
@@ -61,6 +64,8 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+10, guiTop + 110, 16, 16, ""));
getTextField(2).integersOnly = true;
getTextField(2).setMaxStringLength(1);
addTextField(new GuiNpcTextField(33, this, fontRendererObj, guiLeft + 174, guiTop + 8 + 3 + 180, 160, 20, search));
}
public void drawScreen(int x, int y, float f)
@@ -137,12 +142,37 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
}
setSelected(bank.name);
}
public void keyTyped(char c, int i)
{
super.keyTyped(c, i);
if(getTextField(33) != null){
if(getTextField(33).isFocused()){
if(search.equals(getTextField(33).getText()))
return;
search = getTextField(33).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 setData(Vector<String> list, HashMap<String, Integer> data) {
String name = scroll.getSelected();
this.data = data;
scroll.setList(list);
scroll.setList(getSearchList());
if(name != null)
scroll.setSelected(name);