mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 21:59:05 +00:00
61 lines
1.8 KiB
Java
61 lines
1.8 KiB
Java
package noppes.npcs.client.gui.roles;
|
|
|
|
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import noppes.npcs.client.Client;
|
|
import noppes.npcs.client.gui.util.*;
|
|
import noppes.npcs.constants.EnumPacketServer;
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
|
import noppes.npcs.roles.JobFollower;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class GuiNpcFollowerJob extends GuiNPCInterface2 implements ICustomScrollListener
|
|
{
|
|
private JobFollower job;
|
|
private GuiCustomScroll scroll;
|
|
public GuiNpcFollowerJob(EntityNPCInterface npc)
|
|
{
|
|
super(npc);
|
|
job = (JobFollower) npc.jobInterface;
|
|
}
|
|
|
|
public void initGui()
|
|
{
|
|
super.initGui();
|
|
|
|
addLabel(new GuiNpcLabel(1,"gui.name", guiLeft + 6, guiTop + 110));
|
|
addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft + 50, guiTop + 105, 200, 20, job.name));
|
|
|
|
scroll = new GuiCustomScroll(this,0);
|
|
scroll.setSize(143, 208);
|
|
scroll.guiLeft = guiLeft + 268;
|
|
scroll.guiTop = guiTop + 4;
|
|
this.addScroll(scroll);
|
|
|
|
List<String> names = new ArrayList<String>();
|
|
List<EntityNPCInterface> list = npc.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, npc.boundingBox.expand(40, 40, 40));
|
|
for(EntityNPCInterface npc : list){
|
|
if(npc == this.npc || names.contains(npc.display.name))
|
|
continue;
|
|
names.add(npc.display.name);
|
|
}
|
|
scroll.setList(names);
|
|
}
|
|
|
|
@Override
|
|
public void save() {
|
|
job.name = getTextField(1).getText();
|
|
JobSavePacket.saveJob(job);
|
|
}
|
|
|
|
@Override
|
|
public void customScrollClicked(int i, int j, int k,
|
|
GuiCustomScroll guiCustomScroll) {
|
|
getTextField(1).setText(guiCustomScroll.getSelected());
|
|
}
|
|
|
|
|
|
}
|