mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Add Dialog Test Button and Fix oversaving spamming Packets to Client
This commit is contained in:
1 parent
b17d95edde
commit
fb0efe4414
6 files changed
+34
-8
No files matched your search
@@ -1,15 +1,24 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||
import noppes.npcs.client.gui.player.GuiDialogInteract;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener,ITextfieldListener
|
||||
{
|
||||
@@ -69,6 +78,7 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 180, guiTop + 154 + 5));
|
||||
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(17, guiLeft + 303 - 55, guiTop + 192, 50, 20, "gui.test"));
|
||||
|
||||
if(!parent.dialogQuestName.equals(""))
|
||||
getButton(7).setDisplayText(parent.dialogQuestName);
|
||||
@@ -124,6 +134,13 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
if(id == 16){
|
||||
close();
|
||||
}
|
||||
if(id == 17){
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = "TEST";
|
||||
EntityUtil.Copy(player, npc);
|
||||
GuiDialogInteract gui = new GuiDialogInteract(getParent(), npc, dialog);
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -187,7 +187,6 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Dialog
|
||||
if(id == 1){
|
||||
saveType(true);
|
||||
String name = "New";
|
||||
while(dialogData.containsKey(name))
|
||||
name += "_";
|
||||
@@ -201,7 +200,6 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
// Remove Dialog
|
||||
if(id == 2) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogRemove, dialog.id, true);
|
||||
dialog = new Dialog();
|
||||
@@ -210,14 +208,12 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
// Edit Dialog
|
||||
if(id == 0) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcDialog(this, dialog, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Dialog
|
||||
if(id == 3) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
String name = dialog.title;
|
||||
while(dialogData.containsKey(name))
|
||||
|
||||
@@ -191,7 +191,6 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Quest
|
||||
if(id == 1){
|
||||
saveType(true);
|
||||
String name = "New";
|
||||
while(questData.containsKey(name))
|
||||
name += "_";
|
||||
@@ -205,7 +204,6 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
// Remove Quest
|
||||
if(id == 2) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.QuestRemove, quest.id, true);
|
||||
quest = new Quest();
|
||||
@@ -214,14 +212,12 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
// Edit Quest
|
||||
if(id == 0) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
setSubGui(new SubGuiNpcQuest(this, quest, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Quest
|
||||
if(id == 3) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
String name = quest.title;
|
||||
while(questData.containsKey(name))
|
||||
|
||||
@@ -3,6 +3,7 @@ package noppes.npcs.client.gui.player;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -18,6 +19,7 @@ import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiSelectionListener;
|
||||
import noppes.npcs.client.gui.util.IGuiClose;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
@@ -36,6 +38,7 @@ import java.util.List;
|
||||
|
||||
public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
{
|
||||
private GuiScreen parent;
|
||||
private Dialog dialog;
|
||||
private int selected = 0;
|
||||
private List<TextBlockClient> lineBlocks = new ArrayList<TextBlockClient>();
|
||||
@@ -81,6 +84,11 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
getResource("wheel4.png"),getResource("wheel5.png"),getResource("wheel6.png")};
|
||||
}
|
||||
|
||||
public GuiDialogInteract(GuiScreen parent, EntityNPCInterface npc, Dialog dialog){
|
||||
this(npc, dialog);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
isGrabbed = false;
|
||||
@@ -704,6 +712,13 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
super.close();
|
||||
if(parent != null)
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClose(int i, NBTTagCompound data) {
|
||||
grabMouse(false);
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
Reference in new issue
Block a user