mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 03:23:04 +00:00
Large Packet Commit
This commit is contained in:
1 parent
b15d64bd09
commit
f2c34699b1
41 files changed
+446
-432
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.GuiRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
@@ -39,7 +41,7 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void requestOpenGUI(EnumGuiType gui, int i, int j, int k) {
|
||||
Client.sendData(EnumPacketServer.Gui, gui.ordinal(), i, j, k);
|
||||
PacketClient.sendClient(new GuiRequestPacket(gui.ordinal(), i, j, k));
|
||||
}
|
||||
|
||||
public static void updateSkinOverlayData(EntityPlayer player, NBTTagCompound compound) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.RemoteDeletePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -11,7 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
public GuiNpcDimension() {
|
||||
@@ -30,10 +32,10 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
String title = StatCollector.translateToLocal("Dimensions");
|
||||
int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2;
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8));
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp"));
|
||||
@@ -43,23 +45,23 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
public void confirmClicked(boolean flag, int i)
|
||||
{
|
||||
if(flag){
|
||||
Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
|
||||
if(id == 4){
|
||||
Client.sendData(EnumPacketServer.DimensionTeleport, data.get(scroll.getSelected()));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
@@ -77,7 +79,7 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -22,8 +24,8 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
Client.sendData(EnumPacketServer.RemoteNpcsGet);
|
||||
Client.sendData(EnumPacketServer.RemoteFreezeGet);
|
||||
PacketClient.sendClient(new RemoteNpcsGetPacket());
|
||||
PacketClient.sendClient(new RemoteFreezeGetPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
@@ -53,7 +55,7 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i){
|
||||
if(flag){
|
||||
Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
@@ -61,11 +63,11 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 3){
|
||||
Client.sendData(EnumPacketServer.RemoteFreeze);
|
||||
PacketClient.sendClient(new RemoteFreezePacket());
|
||||
}
|
||||
if(id == 5){
|
||||
for(int ids : data.values()){
|
||||
Client.sendData(EnumPacketServer.RemoteReset, ids);
|
||||
PacketClient.sendClient(new RemoteResetPacket(ids));
|
||||
Entity entity = player.worldObj.getEntityByID(ids);
|
||||
if(entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).reset();
|
||||
@@ -73,27 +75,28 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.setLastNpc(null);
|
||||
Client.sendData(EnumPacketServer.RemoteGlobalMenu);
|
||||
PacketClient.sendClient(new RemoteGlobalMenuPacket());
|
||||
}
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
if(id == 0){
|
||||
Client.sendData(EnumPacketServer.RemoteMainMenu,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteMainMenuPacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
if(id == 1){
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
if(id == 2){
|
||||
Client.sendData(EnumPacketServer.RemoteReset,data.get(scroll.getSelected()));
|
||||
Entity entity = player.worldObj.getEntityByID(data.get(scroll.getSelected()));
|
||||
int selected = data.get(scroll.getSelected());
|
||||
PacketClient.sendClient(new RemoteResetPacket(selected));
|
||||
Entity entity = player.worldObj.getEntityByID(selected);
|
||||
if(entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).reset();
|
||||
}
|
||||
if(id == 4){
|
||||
Client.sendData(EnumPacketServer.RemoteTpToNpc,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteTpToNpcPacket(data.get(scroll.getSelected())));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -196,10 +198,10 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
dialog.quest = ob;
|
||||
parent.dialogQuestName = name;
|
||||
initGui();
|
||||
Client.sendData(EnumPacketServer.DialogSave, this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Client.sendData(EnumPacketServer.DialogSave, this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -419,7 +421,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
public void save() {
|
||||
GuiNpcTextField.unfocus();
|
||||
if(dialog.id >= 0)
|
||||
Client.sendData(EnumPacketServer.DialogSave, ((SubGuiNpcDialog)parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(((SubGuiNpcDialog)parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
private DialogImage getSelectedImage() {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -218,10 +220,10 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
quest.nextQuestTitle = name;
|
||||
parent.nextQuestName = name;
|
||||
initGui();
|
||||
Client.sendData(EnumPacketServer.QuestSave, this.questCategoryID, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Client.sendData(EnumPacketServer.QuestSave, this.questCategoryID, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,7 +25,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.drawDefaultBackground = true;
|
||||
Client.sendData(EnumPacketServer.DialogNpcGet);
|
||||
PacketClient.sendClient(new DialogNpcGetPacket());
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
@@ -55,7 +59,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
if (id >= 20 && id < 40) {
|
||||
int slot = id - 20;
|
||||
data.remove(slot);
|
||||
Client.sendData(EnumPacketServer.DialogNpcRemove,slot);
|
||||
PacketClient.sendClient(new DialogNpcRemovePacket(slot));
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@@ -66,7 +70,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
Client.sendData(EnumPacketServer.DialogNpcSet, selectedSlot, id);
|
||||
PacketClient.sendClient(new DialogNpcSetPacket(selectedSlot, id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BanksGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -23,13 +28,13 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
private Bank bank = new Bank();
|
||||
private String selected = null;
|
||||
private String search = "";
|
||||
|
||||
|
||||
public GuiNPCManageBanks(EntityNPCInterface npc,ContainerManageBanks container)
|
||||
{
|
||||
super(npc,container);
|
||||
this.container = container;
|
||||
drawDefaultBackground = false;
|
||||
Client.sendData(EnumPacketServer.BanksGet);
|
||||
PacketClient.sendClient(new BanksGetPacket());
|
||||
setBackground("npcbanksetup.png");
|
||||
ySize = 200;
|
||||
}
|
||||
@@ -37,7 +42,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(6,guiLeft + 340, guiTop + 10, 45, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(7,guiLeft + 340, guiTop + 32, 45, 20, "gui.remove"));
|
||||
if(scroll == null)
|
||||
@@ -46,21 +51,21 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
scroll.guiLeft = guiLeft + 174;
|
||||
scroll.guiTop = guiTop + 8;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
for(int i = 0; i < 6; i++){
|
||||
int x = guiLeft + 6;
|
||||
int y = (guiTop + 36) + (i * 22);
|
||||
addButton(new GuiNpcButton(i, x + 50, y,80, 20, new String[]{"Can Upgrade","Can't Upgrade","Upgraded"},0));
|
||||
getButton(i).setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(0,this, this.fontRendererObj, guiLeft+8, guiTop + 8, 160, 16, ""));
|
||||
getTextField(0).setMaxStringLength(20);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft+10, guiTop + 80, 16, 16, ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMaxStringLength(1);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+10, guiTop + 110, 16, 16, ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMaxStringLength(1);
|
||||
@@ -85,15 +90,15 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
name += "_";
|
||||
Bank bank = new Bank();
|
||||
bank.name = name;
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
bank.writeEntityToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.BankSave, compound);
|
||||
PacketClient.sendClient(new BankSavePacket(compound));
|
||||
}
|
||||
else if(button.id == 7)
|
||||
{
|
||||
if(data.containsKey(scroll.getSelected()))
|
||||
Client.sendData(EnumPacketServer.BankRemove, data.get(selected));
|
||||
PacketClient.sendClient(new BankRemovePacket(data.get(selected)));
|
||||
}
|
||||
else if(button.id >= 0 && button.id < 6)
|
||||
{
|
||||
@@ -103,7 +108,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
{
|
||||
fontRendererObj.drawString("Tab Cost", 23, 28, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString("Upg. Cost", 123, 28, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString("Start", 6, 70, CustomNpcResourceListener.DefaultTextColor);
|
||||
@@ -115,28 +120,28 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
Bank bank = new Bank();
|
||||
bank.readEntityFromNBT(compound);
|
||||
this.bank = bank;
|
||||
|
||||
|
||||
if (bank.id == -1) {
|
||||
getTextField(0).setText("");
|
||||
getTextField(1).setText("");
|
||||
getTextField(2).setText("");
|
||||
|
||||
getTextField(2).setText("");
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
getButton(i).setDisplay(0);
|
||||
getButton(i).setDisplay(0);
|
||||
getButton(i).setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
getTextField(0).setText(bank.name);
|
||||
getTextField(1).setText(Integer.toString(bank.startSlots));
|
||||
getTextField(2).setText(Integer.toString(bank.maxSlots));
|
||||
|
||||
getTextField(2).setText(Integer.toString(bank.maxSlots));
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
int type = 0;
|
||||
if(bank.slotTypes.containsKey(i))
|
||||
type = bank.slotTypes.get(i);
|
||||
getButton(i).setDisplay(type);
|
||||
getButton(i).setDisplay(type);
|
||||
getButton(i).setEnabled(true);
|
||||
}
|
||||
}
|
||||
@@ -173,27 +178,27 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(getSearchList());
|
||||
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
this.selected = selected;
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
save();
|
||||
selected = scroll.getSelected();
|
||||
Client.sendData(EnumPacketServer.BankGet, data.get(selected));
|
||||
PacketClient.sendClient(new BankGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if(selected != null && data.containsKey(selected) && bank != null){
|
||||
@@ -201,7 +206,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
bank.currencyInventory = container.bank.currencyInventory;
|
||||
bank.upgradeInventory = container.bank.upgradeInventory;
|
||||
bank.writeEntityToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.BankSave, compound);
|
||||
PacketClient.sendClient(new BankSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,27 +225,27 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
}
|
||||
} else if(guiNpcTextField.id == 1 || guiNpcTextField.id == 2) {
|
||||
int num = 1;
|
||||
|
||||
|
||||
if(!guiNpcTextField.isEmpty())
|
||||
num = guiNpcTextField.getInteger();
|
||||
|
||||
|
||||
if(num > 6)
|
||||
num = 6;
|
||||
|
||||
|
||||
if(num < 0)
|
||||
num = 0;
|
||||
|
||||
|
||||
if(guiNpcTextField.id == 1) {
|
||||
bank.startSlots = num;
|
||||
} else if(guiNpcTextField.id == 2) {
|
||||
bank.maxSlots = num;
|
||||
}
|
||||
|
||||
|
||||
if(bank.startSlots > bank.maxSlots)
|
||||
bank.maxSlots = bank.startSlots;
|
||||
|
||||
|
||||
guiNpcTextField.setText(Integer.toString(num));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -181,7 +183,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Cat
|
||||
if(id == 5){
|
||||
@@ -202,7 +204,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Dialog
|
||||
if(id == 2) {
|
||||
@@ -231,7 +233,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBTPartial(this.dialog.writeToNBT(new NBTTagCompound()));
|
||||
dialog.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -341,7 +343,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
dialog = null;
|
||||
getTextField(66).setText("");
|
||||
|
||||
Client.sendData(EnumPacketServer.DialogCategoryGet, catData.get(selected));
|
||||
PacketClient.sendClient(new DialogCategoryGetPacket(catData.get(selected)));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
@@ -371,13 +373,13 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
if(saveDiag){
|
||||
if(dialogScroll.selected != -1 && dialog.id >= 0){
|
||||
if(catScroll.selected != -1 && category.id >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(catScroll.selected != -1 && category.id >= 0)
|
||||
Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,13 +428,13 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
return;
|
||||
if(id == 5) {
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogCategoryRemove, category.id);
|
||||
PacketClient.sendClient(new DialogCategoryRemovePacket(category.id));
|
||||
clearCategory();
|
||||
}
|
||||
}
|
||||
if(id == 2) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogRemove, dialog.id, true);
|
||||
PacketClient.sendClient(new DialogRemovePacket(dialog.id, true));
|
||||
dialog = new Dialog();
|
||||
dialogData.clear();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
@@ -186,7 +188,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Cat
|
||||
if(id == 5){
|
||||
@@ -207,8 +209,8 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
Quest quest = new Quest();
|
||||
quest.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
}
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Quest
|
||||
if(id == 2) {
|
||||
if (questData.containsKey(questScroll.getSelected())) {
|
||||
@@ -236,8 +238,8 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
Quest quest = new Quest();
|
||||
quest.readNBTPartial(this.quest.writeToNBT(new NBTTagCompound()));
|
||||
quest.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
}
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
@@ -346,7 +348,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
quest = null;
|
||||
getTextField(66).setText("");
|
||||
|
||||
Client.sendData(EnumPacketServer.QuestCategoryGet, catData.get(selected));
|
||||
PacketClient.sendClient(new QuestCategoryGetPacket(catData.get(selected)));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
@@ -376,13 +378,13 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
if(saveQuest){
|
||||
if(questScroll.selected != -1 && quest.id >= 0){
|
||||
if(catScroll.selected != -1 && category.id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(catScroll.selected != -1 && category.id >= 0)
|
||||
Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,12 +433,12 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
return;
|
||||
if(id == 5) {
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.QuestCategoryRemove, category.id);
|
||||
PacketClient.sendClient(new QuestCategoryRemovePacket(category.id));
|
||||
clearCategory();
|
||||
}
|
||||
}
|
||||
if(id == 2) {
|
||||
Client.sendData(EnumPacketServer.QuestRemove, quest.id, true);
|
||||
PacketClient.sendClient(new QuestRemovePacket(quest.id, true));
|
||||
quest = new Quest();
|
||||
questData.clear();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipesGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -30,7 +35,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
super(npc,container);
|
||||
this.container = container;
|
||||
drawDefaultBackground = false;
|
||||
Client.sendData(EnumPacketServer.RecipesGet,container.width);
|
||||
PacketClient.sendClient(new RecipesGetPacket(container.width));
|
||||
setBackground("inventorymenu.png");
|
||||
slot = getResource("slot.png");
|
||||
ySize = 200;
|
||||
@@ -94,11 +99,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
name += "_";
|
||||
RecipeCarpentry recipe = new RecipeCarpentry(name);
|
||||
recipe.isGlobal = container.width == 3;
|
||||
Client.sendData(EnumPacketServer.RecipeSave,recipe.writeNBT());
|
||||
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
|
||||
}
|
||||
if(button.id == 4){
|
||||
if(data.containsKey(scroll.getSelected())){
|
||||
Client.sendData(EnumPacketServer.RecipeRemove, data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RecipeRemovePacket(data.get(scroll.getSelected())));
|
||||
scroll.clear();
|
||||
}
|
||||
}
|
||||
@@ -186,7 +191,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
save();
|
||||
selected = scroll.getSelected();
|
||||
Client.sendData(EnumPacketServer.RecipeGet, data.get(selected));
|
||||
PacketClient.sendClient(new RecipeGetPacket(data.get(selected)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,7 +199,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
GuiNpcTextField.unfocus();
|
||||
if(selected != null && data.containsKey(selected)){
|
||||
container.saveRecipe();
|
||||
Client.sendData(EnumPacketServer.RecipeSave, container.recipe.writeNBT());
|
||||
PacketClient.sendClient(new RecipeSavePacket(container.recipe.writeNBT()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnGetAllPacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -25,7 +30,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
|
||||
public GuiNpcNaturalSpawns(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnGetAll);
|
||||
PacketClient.sendClient(new NaturalSpawnGetAllPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,12 +134,12 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
|
||||
SpawnData spawn = new SpawnData();
|
||||
spawn.name = name;
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new NaturalSpawnSavePacket(spawn.writeNBT(new NBTTagCompound())));
|
||||
this.spawnEntryScroll.selected = -1;
|
||||
}
|
||||
if(id == 2){
|
||||
if(data.containsKey(scrollNaturalSpawns.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnRemove, spawn.id);
|
||||
PacketClient.sendClient(new NaturalSpawnRemovePacket(spawn.id));
|
||||
spawn = new SpawnData();
|
||||
scrollNaturalSpawns.clear();
|
||||
this.spawnEntryScroll.selected = -1;
|
||||
@@ -224,7 +229,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
save();
|
||||
String selected = scrollNaturalSpawns.getSelected();
|
||||
spawn = new SpawnData();
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnGet, data.get(selected));
|
||||
PacketClient.sendClient(new NaturalSpawnGetPacket(data.get(selected)));
|
||||
}
|
||||
if (guiCustomScroll.id == 20) {
|
||||
initGui();
|
||||
@@ -235,7 +240,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
public void save() {
|
||||
GuiNpcTextField.unfocus();
|
||||
if(spawn.id >= 0)
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new NaturalSpawnSavePacket(spawn.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.questtypes;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestDialogGetTitlePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -34,10 +36,12 @@ public class GuiNpcQuestTypeDialog extends SubGuiInterface implements GuiSelecti
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
Client.sendData(EnumPacketServer.QuestDialogGetTitle,
|
||||
quest.dialogs.containsKey(0)?quest.dialogs.get(0):-1,
|
||||
quest.dialogs.containsKey(1)?quest.dialogs.get(1):-1,
|
||||
quest.dialogs.containsKey(2)?quest.dialogs.get(2):-1);
|
||||
|
||||
PacketClient.sendClient(new QuestDialogGetTitlePacket(
|
||||
quest.dialogs.getOrDefault(0, -1),
|
||||
quest.dialogs.getOrDefault(1, -1),
|
||||
quest.dialogs.getOrDefault(2, -1))
|
||||
);
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BanksGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -25,7 +28,7 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
public GuiNpcBankSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.BanksGet);
|
||||
PacketClient.sendClient(new BanksGetPacket());
|
||||
role = (RoleBank) npc.roleInterface;
|
||||
}
|
||||
|
||||
@@ -43,9 +46,9 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
{
|
||||
String name = null;
|
||||
Bank bank = role.getBank();
|
||||
@@ -53,23 +56,23 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
name = bank.name;
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
|
||||
|
||||
if(name != null)
|
||||
setSelected(name);
|
||||
}
|
||||
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && scroll != null)
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
@@ -78,7 +81,7 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user