mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 22:03:12 +00:00
Custom GUI Packets
This commit is contained in:
1 parent
b22105341f
commit
364bf2414f
6 files changed
+28
-23
No files matched your search
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.custom;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiButtonPacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiClosePacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiUnfocusedPacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomScrollClickPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -449,25 +454,25 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||
PacketClient.sendClient(new CustomGuiButtonPacket(button.id, this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
public void buttonClick(CustomGuiButton button) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||
PacketClient.sendClient(new CustomGuiButtonPacket(button.id, this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
public String prevScrollClicked = null;
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false});
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false));
|
||||
if(Integer.toString(scroll.selected).equals(prevScrollClicked)){
|
||||
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), true});
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), true));
|
||||
}
|
||||
prevScrollClicked = Integer.toString(scroll.selected);
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
if (this.gui != null) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiClose, new Object[]{this.updateGui().toNBT()});
|
||||
PacketClient.sendClient(new CustomGuiClosePacket(this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer != null)
|
||||
@@ -477,7 +482,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
public void onTextFieldUnfocused(CustomGuiTextField textField){
|
||||
Client.sendData(EnumPacketServer.CustomGuiUnfocused, new Object[]{this.updateGui().toNBT(), textField.getID()});
|
||||
PacketClient.sendClient(new CustomGuiUnfocusedPacket(textField.getID(), this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
ScriptGui updateGui() {
|
||||
|
||||
Reference in new issue
Block a user