mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-23 22:59:41 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -13,56 +13,52 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubGuiListener, ITextfieldListener
|
||||
{
|
||||
private Lines lines;
|
||||
public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubGuiListener, ITextfieldListener {
|
||||
private Lines lines;
|
||||
private int selectedId = -1;
|
||||
private GuiSoundSelection gui;
|
||||
|
||||
public GuiNPCLinesEdit(EntityNPCInterface npc, Lines lines)
|
||||
{
|
||||
super(npc);
|
||||
this.lines = lines;
|
||||
public GuiNPCLinesEdit(EntityNPCInterface npc, Lines lines) {
|
||||
super(npc);
|
||||
this.lines = lines;
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for(int i = 0; i < 8; i++){
|
||||
String text = "";
|
||||
String sound = "";
|
||||
if(lines.lines.containsKey(i)){
|
||||
for (int i = 0; i < 8; i++) {
|
||||
String text = "";
|
||||
String sound = "";
|
||||
if (lines.lines.containsKey(i)) {
|
||||
Line line = lines.lines.get(i);
|
||||
text = line.getText();
|
||||
sound = line.getSound();
|
||||
}
|
||||
addTextField(new GuiNpcTextField(i,this, fontRendererObj, guiLeft + 4, guiTop + 4 + i * 24, 200, 20,text));
|
||||
addTextField(new GuiNpcTextField(i + 8,this, fontRendererObj, guiLeft + 208, guiTop + 4 + i * 24, 146, 20,sound));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "gui.select"));
|
||||
}
|
||||
addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 4 + i * 24, 200, 20, text));
|
||||
addTextField(new GuiNpcTextField(i + 8, this, fontRendererObj, guiLeft + 208, guiTop + 4 + i * 24, 146, 20, sound));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "gui.select"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
selectedId = button.id + 8;
|
||||
setSubGui(new GuiSoundSelection(getTextField(selectedId).getText()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.advanced.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.advanced.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
|
||||
private void saveLines(){
|
||||
HashMap<Integer,Line> lines = new HashMap<Integer,Line>();
|
||||
for(int i = 0; i < 8; i++){
|
||||
private void saveLines() {
|
||||
HashMap<Integer, Line> lines = new HashMap<Integer, Line>();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
GuiNpcTextField tf = getTextField(i);
|
||||
GuiNpcTextField tf2 = getTextField(i + 8);
|
||||
if(!tf.isEmpty() || !tf2.isEmpty()){
|
||||
if (!tf.isEmpty() || !tf2.isEmpty()) {
|
||||
Line line = new Line();
|
||||
line.setText(tf.getText());
|
||||
line.setSound(tf2.getText());
|
||||
@@ -73,16 +69,16 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
|
||||
this.lines.lines = lines;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
saveLines();
|
||||
public void save() {
|
||||
saveLines();
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
if (gss.selectedResource != null) {
|
||||
getTextField(selectedId).setText(gss.selectedResource.toString());
|
||||
saveLines();
|
||||
initGui();
|
||||
|
||||
Reference in new issue
Block a user