mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 21:32:19 +00:00
Revamp Sound Selection Menu
This commit is contained in:
1 parent
14b430089e
commit
b3846e32c8
8 files changed
+108
-380
No files matched your search
@@ -3,15 +3,13 @@ package noppes.npcs.client.gui.advanced;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNpcSoundSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener
|
||||
public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener, ISubGuiListener
|
||||
{
|
||||
private GuiNpcSoundSelection gui;
|
||||
private GuiNpcTextField selectedField;
|
||||
public GuiNPCSoundsMenu(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
@@ -23,37 +21,36 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldList
|
||||
addLabel(new GuiNpcLabel(0,"advanced.idlesound", guiLeft + 5, guiTop + 20));
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 80, guiTop + 15, 200, 20, npc.advanced.idleSound));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 290, guiTop + 15, 80, 20, "gui.selectSound"));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"advanced.angersound", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 80, guiTop + 40, 200, 20, npc.advanced.angrySound));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 290, guiTop + 40, 80, 20, "gui.selectSound"));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"advanced.hurtsound", guiLeft + 5, guiTop + 70));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, guiTop + 65, 200, 20, npc.advanced.hurtSound));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 290, guiTop + 65, 80, 20, "gui.selectSound"));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"advanced.deathsound", guiLeft + 5, guiTop + 95));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 80, guiTop + 90, 200, 20, npc.advanced.deathSound));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 290, guiTop + 90, 80, 20, "gui.selectSound"));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(5,"advanced.stepsound", guiLeft + 5, guiTop + 120));
|
||||
addTextField(new GuiNpcTextField(5,this, fontRendererObj, guiLeft + 80, guiTop + 115, 200, 20, npc.advanced.stepSound));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 290, guiTop + 115, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(6,"advanced.haspitch", guiLeft + 5, guiTop + 150));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 145, 80, 20, new String[]{"gui.no","gui.yes"}, npc.advanced.disablePitch?0:1));
|
||||
|
||||
|
||||
}
|
||||
public void buttonEvent(GuiButton button){
|
||||
|
||||
if(button.id == 6)
|
||||
npc.advanced.disablePitch =((GuiNpcButton)button).getValue() == 0;
|
||||
else{
|
||||
selectedField = getTextField(button.id);
|
||||
gui = new GuiNpcSoundSelection(this, selectedField.getText());
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
selectedField = getTextField(button.id);
|
||||
setSubGui(new GuiSoundSelection(selectedField.getText()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
@@ -68,13 +65,16 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldList
|
||||
if(textfield.id == 5)
|
||||
npc.advanced.stepSound = textfield.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
selectedField.setText(gui.getSelected());
|
||||
unFocused(selectedField);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
selectedField.setText(gss.selectedResource.toString());
|
||||
unFocused(selectedField);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
Reference in new issue
Block a user