Overhaul Dialog GUI

This commit is contained in:
Kam committed 2023-06-07 22:49:54 -04:00
1 parent 327fa061cc
commit 22bc05ddcc
10 files changed
+592 -228

No files matched your search

@@ -20,6 +20,7 @@ import noppes.npcs.client.gui.player.GuiQuestCompletion;
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.client.gui.util.IScrollGroup;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.DialogController;
@@ -208,6 +209,43 @@ public class NoppesUtil {
}
private static HashMap<String,Integer> data = new HashMap<String,Integer>();
private static HashMap<String,Integer> group = new HashMap<String,Integer>();
public static void addScrollGroup(ByteBuf buffer) {
try {
int size = buffer.readInt();
for(int i = 0; i < size; i++){
int id = buffer.readInt();
String name = Server.readString(buffer);
group.put(name, id);
}
} catch (Exception ignored) {
}
}
public static void setScrollGroup(ByteBuf buffer) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui == null)
return;
try {
int size = buffer.readInt();
for(int i = 0; i < size; i++){
int id = buffer.readInt();
String name = Server.readString(buffer);
group.put(name, id);
}
} catch (Exception ignored) {
}
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
}
if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
}
if(gui instanceof IScrollGroup)
((IScrollGroup)gui).setScrollGroup(new Vector<String>(group.keySet()), group);
group = new HashMap<String,Integer>();
}
public static void addScrollData(ByteBuf buffer) {
try {