BUNCH OF NEW PACKETS

This commit is contained in:
Kam committed 2025-02-02 02:25:21 -05:00
1 parent f2c34699b1
commit b22105341f
50 files changed
+620 -392

No files matched your search

@@ -546,7 +546,6 @@ public class NoppesUtilServer {
playerdata.setNBT(new NBTTagCompound());
sendPlayerData(type, player, name);
playerdata.save();
return;
}
}
@@ -456,142 +456,6 @@ public class PacketHandlerServer{
NoppesUtilServer.setEditingQuest(player,quest);
player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0);
}
else if(type == EnumPacketServer.TransportCategoriesGet){
NoppesUtilServer.sendTransportCategoryData(player);
}
else if(type == EnumPacketServer.TransportCategorySave){
TransportController.getInstance().saveCategory(ByteBufUtils.readString(buffer), buffer.readInt());
}
else if(type == EnumPacketServer.TransportCategoryRemove){
TransportController.getInstance().removeCategory(buffer.readInt());
NoppesUtilServer.sendTransportCategoryData(player);
}
else if(type == EnumPacketServer.TransportRemove){
int id = buffer.readInt();
TransportLocation loc = TransportController.getInstance().removeLocation(id);
if(loc != null)
NoppesUtilServer.sendTransportData(player,loc.category.id);
}
else if(type == EnumPacketServer.TransportsGet){
NoppesUtilServer.sendTransportData(player,buffer.readInt());
}
else if(type == EnumPacketServer.TransportSave){
int cat = buffer.readInt();
TransportLocation location = TransportController.getInstance().saveLocation(cat, ByteBufUtils.readNBT(buffer), npc);
if(location != null){
if(npc.advanced.role != EnumRoleType.Transporter)
return;
RoleTransporter role = (RoleTransporter) npc.roleInterface;
role.setTransport(location);
}
}
else if(type == EnumPacketServer.TransportGetLocation){
if(npc.advanced.role != EnumRoleType.Transporter)
return;
RoleTransporter role = (RoleTransporter) npc.roleInterface;
if(role.hasTransport()){
GuiDataPacket.sendGuiData(player, role.getLocation().writeNBT());
ScrollSelectedPacket.setSelectedList(player, role.getLocation().category.title);
}
}
else if(type == EnumPacketServer.FactionSet){
npc.setFaction(buffer.readInt());
}
else if(type == EnumPacketServer.FactionSave){
Faction faction = new Faction();
faction.readNBT(ByteBufUtils.readNBT(buffer));
FactionController.getInstance().saveFaction(faction);
NoppesUtilServer.sendFactionDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
faction.writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.FactionRemove){
FactionController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendFactionDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
(new Faction()).writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagSet){
this.setTags(npc,buffer);
}
else if(type == EnumPacketServer.TagSave){
Tag tag = new Tag();
tag.readNBT(ByteBufUtils.readNBT(buffer));
TagController.getInstance().saveTag(tag);
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagRemove){
TagController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
(new Tag()).writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.PlayerDataGet){
int id = buffer.readInt();
if(EnumPlayerData.values().length <= id)
return;
String name = null;
EnumPlayerData datatype = EnumPlayerData.values()[id];
if(datatype != EnumPlayerData.Players)
name = ByteBufUtils.readString(buffer);
NoppesUtilServer.sendPlayerData(datatype,player,name);
}
else if(type == EnumPacketServer.PlayerDataRemove){
NoppesUtilServer.removePlayerData(buffer,player);
}
else if(type == EnumPacketServer.PlayerDataMapRegen){
NoppesUtilServer.regenPlayerData(player);
}
else if(type == EnumPacketServer.MainmenuDisplayGet){
GuiDataPacket.sendGuiData(player, npc.display.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuDisplaySave){
npc.display.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuStatsGet){
GuiDataPacket.sendGuiData(player, npc.stats.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuStatsSave){
npc.stats.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuInvGet){
GuiDataPacket.sendGuiData(player, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuInvSave){
npc.inventory.readEntityFromNBT(ByteBufUtils.readNBT(buffer));
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAIGet){
GuiDataPacket.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAISave){
npc.ai.readToNBT(ByteBufUtils.readNBT(buffer));
npc.setHealth(npc.getMaxHealth());
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAdvancedGet){
GuiDataPacket.sendGuiData(player, npc.advanced.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAdvancedSave){
npc.advanced.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAdvancedMarkData){
MarkData data = MarkData.get(npc);
data.setNBT(ByteBufUtils.readNBT(buffer));
data.syncClients();
}
else if(type == EnumPacketServer.JobSave){
NBTTagCompound original = npc.jobInterface.writeToNBT(new NBTTagCompound());
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
@@ -880,10 +744,6 @@ public class PacketHandlerServer{
compound.setTag("ShortTags", validTagList);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.TagSet) {
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
this.setTags(npc,buffer);
}
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
}
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -22,7 +25,8 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
{
super(npc);
this.lines = lines;
Client.sendData(EnumPacketServer.MainmenuAdvancedGet);
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
}
public void initGui()
@@ -73,7 +77,8 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
public void save() {
saveLines();
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
}
@Override
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.transport.TransportCategoriesGetPacket;
import kamkeel.npcs.network.packets.request.transport.TransportCategorySavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import noppes.npcs.client.Client;
@@ -30,7 +33,7 @@ public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
super.initGui();
this.addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, width / 2 - 40, 100, 140, 20, name));
addLabel(new GuiNpcLabel(1,"Title:", width / 2 - 100+4, 105, 0xffffff));
this.addButton(new GuiNpcButton(2, width / 2 - 100, 210,98, 20, "gui.back"));
this.addButton(new GuiNpcButton(3, width / 2 +2, 210,98, 20, "Save"));
}
@@ -47,25 +50,20 @@ public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
if(id == 2)
{
NoppesUtil.openGUI(player, parent);
Client.sendData(EnumPacketServer.TransportCategoriesGet);
PacketClient.sendClient(new TransportCategoriesGetPacket());
}
if(id == 3)
{
save();
NoppesUtil.openGUI(player, parent);
Client.sendData(EnumPacketServer.TransportCategoriesGet);
PacketClient.sendClient(new TransportCategoriesGetPacket());
}
}
public void save() {
String name = getTextField(1).getText();
if(name.trim().isEmpty())
return;
Client.sendData(EnumPacketServer.TransportCategorySave,name,id);
}
// @Override
// public void drawDefaultBackground()
// {
// drawBackground(0);
// }
PacketClient.sendClient(new TransportCategorySavePacket(name, id));
}
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
@@ -146,7 +148,7 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
GuiNpcMobSpawnerAdd.tagsCompound = UUIDTagList;
tagCompound.setTag("TagNames",tagList);
Client.sendData(EnumPacketServer.TagSet, tagCompound);
PacketClient.sendClient(new TagSetPacket(tagCompound));
}
public void keyTyped(char c, int i)
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.advanced;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.faction.FactionSetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -15,7 +18,7 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
{
private GuiCustomScroll scrollFactions;
private HashMap<String,Integer> data = new HashMap<String,Integer>();
public GuiNPCFactionSetup(EntityNPCInterface npc)
{
super(npc);
@@ -34,7 +37,7 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
this.addLabel(new GuiNpcLabel(12, "faction.ondeath", guiLeft + 4, guiTop + 69));
addButton(new GuiNpcButton(12, guiLeft + 90, guiTop + 64, 80, 20, "faction.points"));
if(scrollFactions == null){
scrollFactions = new GuiCustomScroll(this,0,0);
scrollFactions.setSize(180, 200);
@@ -59,41 +62,41 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
if(button.id == 12)
setSubGui(new SubGuiNpcFactionOptions(npc.advanced.factions));
}
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data)
public void setData(Vector<String> list, HashMap<String, Integer> data)
{
String name = npc.getFaction().name;
this.data = data;
scrollFactions.setList(list);
if(name != null)
setSelected(name);
}
public void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
if(k == 0 && scrollFactions != null)
scrollFactions.mouseClicked(i, j, k);
}
@Override
public void setSelected(String selected) {
scrollFactions.setSelected(selected);
}
@Override
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
if(guiCustomScroll.id == 0)
{
Client.sendData(EnumPacketServer.FactionSet, data.get(scrollFactions.getSelected()));
PacketClient.sendClient(new FactionSetPacket(data.get(scrollFactions.getSelected())));
}
}
public void save() {
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
}
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
}
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.advanced;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -13,7 +15,7 @@ import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCLinesMenu extends GuiNPCInterface2 {
public GuiNPCLinesMenu(EntityNPCInterface npc) {
super(npc);
}
@@ -54,10 +56,10 @@ public class GuiNPCLinesMenu extends GuiNPCInterface2 {
npc.advanced.orderedLines = !((GuiNpcButtonYesNo)guibutton).getBoolean();
}
}
@Override
public void save() {
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
}
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.advanced;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedMarkDataPacket;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.SubGuiColorSelector;
@@ -78,7 +81,7 @@ public class GuiNPCMarks extends GuiNPCInterface2 implements ISubGuiListener {
@Override
public void save() {
Client.sendData(EnumPacketServer.MainmenuAdvancedMarkData, data.getNBT());
PacketClient.sendClient(new MainmenuAdvancedMarkDataPacket(data.getNBT()));
}
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.advanced;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -77,7 +79,7 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldLis
@Override
public void save() {
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
}
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.advanced;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -120,7 +122,7 @@ public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICus
tagList.appendTag(new NBTTagString(string));
}
tagCompound.setTag("TagNames",tagList);
Client.sendData(EnumPacketServer.TagSet, tagCompound);
PacketClient.sendClient(new TagSetPacket(tagCompound));
}
public void keyTyped(char c, int i)
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.global;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.faction.FactionRemovePacket;
import kamkeel.npcs.network.packets.request.faction.FactionSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
@@ -106,7 +109,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
NBTTagCompound compound = new NBTTagCompound();
faction.writeNBT(compound);
Client.sendData(EnumPacketServer.FactionSave, compound);
PacketClient.sendClient(new FactionSavePacket(compound));
}
if(button.id == 1){
if(data.containsKey(scrollFactions.getSelected())) {
@@ -205,7 +208,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
NBTTagCompound compound = new NBTTagCompound();
faction.writeNBT(compound);
Client.sendData(EnumPacketServer.FactionSave, compound);
PacketClient.sendClient(new FactionSavePacket(compound));
}
}
@@ -253,7 +256,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
return;
if(id == 1) {
if(data.containsKey(scrollFactions.getSelected())) {
Client.sendData(EnumPacketServer.FactionRemove, data.get(selected));
PacketClient.sendClient(new FactionRemovePacket(data.get(selected)));
scrollFactions.clear();
faction = new Faction();
initGui();
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.global;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.tags.TagRemovePacket;
import kamkeel.npcs.network.packets.request.tags.TagSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -104,11 +107,11 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
Client.sendData(EnumPacketServer.TagSave, compound);
PacketClient.sendClient(new TagSavePacket(compound));
}
if(button.id == 1){
if(data.containsKey(scrollTags.getSelected())) {
Client.sendData(EnumPacketServer.TagRemove, data.get(selected));
PacketClient.sendClient(new TagRemovePacket(data.get(selected)));
scrollTags.clear();
tag = new Tag();
initGui();
@@ -163,7 +166,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
Client.sendData(EnumPacketServer.TagSave, compound);
PacketClient.sendClient(new TagSavePacket(compound));
}
}
@@ -1,5 +1,10 @@
package noppes.npcs.client.gui.global;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.transport.TransportCategoriesGetPacket;
import kamkeel.npcs.network.packets.request.transport.TransportCategoryRemovePacket;
import kamkeel.npcs.network.packets.request.transport.TransportRemovePacket;
import kamkeel.npcs.network.packets.request.transport.TransportsGetPacket;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
@@ -24,7 +29,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
public GuiNPCManageTransporters(EntityNPCInterface npc)
{
super(npc);
Client.sendData(EnumPacketServer.TransportCategoriesGet);
PacketClient.sendClient(new TransportCategoriesGetPacket());
drawDefaultBackground = false;
title = "Transport Categories";
data = new HashMap<String, Integer>();
@@ -36,7 +41,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
Vector<String> list = new Vector<String>();
slot = new GuiNPCStringSlot(list,this,false,18);
slot.registerScrollButtons(4, 5);
this.addButton(new GuiNpcButton(0,width / 2 - 100, height - 52, 65, 20, "gui.add"));
this.addButton(new GuiNpcButton(1,width / 2 - 33 , height - 52, 65, 20, "selectServer.edit"));
@@ -63,7 +68,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
if(selectCategory){
NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this, "", -1));
}else{
}
}
if(id == 1)
@@ -73,7 +78,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
if(selectCategory){
NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this,slot.selected, data.get(slot.selected)));
}else{
}
}
if(id == 4)
@@ -84,7 +89,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
}else{
title = "Transport Categories";
selectCategory = true;
Client.sendData(EnumPacketServer.TransportCategoriesGet);
PacketClient.sendClient(new TransportCategoriesGetPacket());
initGui();
}
}
@@ -94,10 +99,10 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
return;
save();
if(selectCategory){
Client.sendData(EnumPacketServer.TransportCategoryRemove,data.get(slot.selected));
PacketClient.sendClient(new TransportCategoryRemovePacket(data.get(slot.selected)));
}
else{
Client.sendData(EnumPacketServer.TransportRemove,data.get(slot.selected));
PacketClient.sendClient(new TransportRemovePacket(data.get(slot.selected)));
}
initGui();
}
@@ -112,10 +117,10 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
if(selectCategory){
selectCategory = false;
title = "TransportLocations";
Client.sendData(EnumPacketServer.TransportsGet,data.get(slot.selected));
PacketClient.sendClient(new TransportsGetPacket(data.get(slot.selected)));
initGui();
}
}
public void save() {
}
@@ -129,7 +134,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
@Override
public void setSelected(String selected) {
// TODO Auto-generated method stub
}
@@ -1,5 +1,9 @@
package noppes.npcs.client.gui.global;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataGetPacket;
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataMapRegenPacket;
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataRemovePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
@@ -26,7 +30,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
public GuiNpcManagePlayerData(EntityNPCInterface npc)
{
super(npc);
Client.sendData(EnumPacketServer.PlayerDataGet,selection);
PacketClient.sendClient(new PlayerDataGetPacket(selection, ""));
}
public void initGui()
@@ -115,9 +119,9 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
{
if(selected != null){
if(selection == EnumPlayerData.Players)
Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,selected);
PacketClient.sendClient(new PlayerDataRemovePacket(selection, selectedPlayer, selected));
else
Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,data.get(selected));
PacketClient.sendClient(new PlayerDataRemovePacket(selection, selectedPlayer, data.get(selected)));
data.clear();
}
selected = null;
@@ -130,8 +134,9 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
initButtons();
scroll.clear();
data.clear();
Client.sendData(EnumPacketServer.PlayerDataGet, selection, selectedPlayer);
selected = null;
PacketClient.sendClient(new PlayerDataGetPacket(selection, selectedPlayer));
selected = null;
}
}
if(id == 7){
@@ -169,7 +174,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
@Override
public void confirmClicked(boolean confirm, int id){
if(confirm){
Client.sendData(EnumPacketServer.PlayerDataMapRegen);
PacketClient.sendClient(new PlayerDataMapRegenPacket());
close();
}
else
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.mainmenu;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuInvGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuInvSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
@@ -30,7 +33,7 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
this.container = container;
ySize = 200;
slot = getResource("slot.png");
Client.sendData(EnumPacketServer.MainmenuInvGet);
PacketClient.sendClient(new MainmenuInvGetPacket());
}
public void initGui()
@@ -178,8 +181,8 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
npc.inventory.dropchance = chances;
npc.inventory.minExp = getTextField(0).getInteger();
npc.inventory.maxExp = getTextField(1).getInteger();
Client.sendData(EnumPacketServer.MainmenuInvSave, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
}
PacketClient.sendClient(new MainmenuInvSavePacket(npc.inventory.writeEntityToNBT(new NBTTagCompound())));
}
@Override
public void setGuiData(NBTTagCompound compound) {
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.mainmenu;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAISavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.DataAI;
@@ -173,7 +175,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
@Override
public void save() {
Client.sendData(EnumPacketServer.MainmenuAISave, ai.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuAISavePacket(ai.writeToNBT(new NBTTagCompound())));
}
@Override
@@ -1,5 +1,8 @@
package noppes.npcs.client.gui.mainmenu;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.NoppesStringUtils;
@@ -22,8 +25,9 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
public GuiNpcAdvanced(EntityNPCInterface npc)
{
super(npc, 4);
Client.sendData(EnumPacketServer.MainmenuAdvancedGet);
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
}
@Override
public void initGui(){
super.initGui();
@@ -152,7 +156,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
@Override
public void save() {
if(hasChanges){
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
hasChanges = false;
}
}
@@ -2,6 +2,9 @@ package noppes.npcs.client.gui.mainmenu;
import com.mojang.authlib.GameProfile;
import kamkeel.npcs.addon.client.GeckoAddonClient;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuDisplayGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuDisplaySavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.DataDisplay;
@@ -25,7 +28,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
public GuiNpcDisplay(EntityNPCInterface npc) {
super(npc,1);
display = npc.display;
Client.sendData(EnumPacketServer.MainmenuDisplayGet);
PacketClient.sendClient(new MainmenuDisplayGetPacket());
}
public void initGui(){
@@ -209,11 +212,11 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
public void save() {
if(display.skinType == 1)
display.loadProfile();
npc.textureLocation = null;
mc.renderGlobal.onEntityDestroy(npc);
mc.renderGlobal.onEntityCreate(npc);
Client.sendData(EnumPacketServer.MainmenuDisplaySave, display.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuDisplaySavePacket(display.writeToNBT(new NBTTagCompound())));
}
@Override
@@ -1,6 +1,9 @@
package noppes.npcs.client.gui.mainmenu;
import kamkeel.npcs.addon.client.DBCClient;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuStatsGetPacket;
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuStatsSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.nbt.NBTTagCompound;
@@ -16,7 +19,8 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
public GuiNpcStats(EntityNPCInterface npc) {
super(npc,2);
stats = npc.stats;
Client.sendData(EnumPacketServer.MainmenuStatsGet);
PacketClient.sendClient(new MainmenuStatsGetPacket());
}
@Override
@@ -150,7 +154,7 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
}
@Override
public void save() {
Client.sendData(EnumPacketServer.MainmenuStatsSave, stats.writeToNBT(new NBTTagCompound()));
PacketClient.sendClient(new MainmenuStatsSavePacket(stats.writeToNBT(new NBTTagCompound())));
}
@Override
@@ -1,5 +1,9 @@
package noppes.npcs.client.gui.roles;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.transport.TransportCategoriesGetPacket;
import kamkeel.npcs.network.packets.request.transport.TransportGetLocationPacket;
import kamkeel.npcs.network.packets.request.transport.TransportSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
@@ -15,25 +19,25 @@ public class GuiNpcTransporter extends GuiNPCInterface2 implements IScrollData,
private GuiCustomScroll scroll;
public TransportLocation location = new TransportLocation();
private HashMap<String,Integer> data = new HashMap<String,Integer>();
public GuiNpcTransporter(EntityNPCInterface npc){
super(npc);
Client.sendData(EnumPacketServer.TransportCategoriesGet);
Client.sendData(EnumPacketServer.TransportGetLocation);
super(npc);
PacketClient.sendClient(new TransportCategoriesGetPacket());
PacketClient.sendClient(new TransportGetLocationPacket());
}
public void initGui(){
super.initGui();
Vector<String> list = new Vector<String>();
list.addAll(data.keySet());
if(scroll == null){
scroll = new GuiCustomScroll(this,0);
scroll.setSize(143, 208);
}
scroll.guiLeft = guiLeft + 214;
scroll.guiTop = guiTop + 4;
addScroll(scroll);
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 4, height + 8));
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 60, guiTop + 3, 140, 20, location.name));
@@ -45,7 +49,7 @@ public class GuiNpcTransporter extends GuiNPCInterface2 implements IScrollData,
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 0){
location.type = button.getValue();
}
}
}
@Override
public void save() {
@@ -54,14 +58,14 @@ public class GuiNpcTransporter extends GuiNPCInterface2 implements IScrollData,
String name = getTextField(0).getText();
if(!name.isEmpty())
location.name = name;
location.posX = player.posX;
location.posY = player.posY;
location.posZ = player.posZ;
location.dimension = player.dimension;
int cat = data.get(scroll.getSelected());
Client.sendData(EnumPacketServer.TransportSave,cat, location.writeNBT());
PacketClient.sendClient(new TransportSavePacket(cat, location.writeNBT()));
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data) {
@@ -1,6 +1,8 @@
package noppes.npcs.constants;
import net.minecraft.client.gui.Gui;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.client.gui.custom.components.CustomGuiButton;
public enum EnumPacketServer {
NPCDelete(CustomNpcsPermissions.NPC_DELETE, true),
@@ -9,18 +11,11 @@ public enum EnumPacketServer {
SpawnMob(CustomNpcsPermissions.SPAWNER_MOB),
MobSpawner(CustomNpcsPermissions.SPAWNER_CREATE),
MainmenuAISave(CustomNpcsPermissions.NPC_AI,true), MainmenuAIGet(true),
MainmenuInvSave(CustomNpcsPermissions.NPC_INVENTORY, true), MainmenuInvGet(true),
MainmenuStatsSave(CustomNpcsPermissions.NPC_STATS, true), MainmenuStatsGet(true),
MainmenuDisplaySave(CustomNpcsPermissions.NPC_DISPLAY, true), MainmenuDisplayGet(true),
ModelDataSave(CustomNpcsPermissions.NPC_DISPLAY, true),
MainmenuAdvancedSave(CustomNpcsPermissions.NPC_ADVANCED,true), MainmenuAdvancedGet(true), MainmenuAdvancedMarkData(CustomNpcsPermissions.NPC_ADVANCED,true),
FactionSet(CustomNpcsPermissions.NPC_ADVANCED, true),
TagSet(CustomNpcsPermissions.NPC_ADVANCED, true),
TransportSave(CustomNpcsPermissions.NPC_ADVANCED, true),
TransformSave(CustomNpcsPermissions.NPC_ADVANCED, true), TransformGet(true),
MainmenuAdvancedMarkData(CustomNpcsPermissions.NPC_ADVANCED,true),
TransformSave(CustomNpcsPermissions.NPC_ADVANCED, true), TransformGet(true),
TransformLoad(CustomNpcsPermissions.NPC_ADVANCED, true),
TraderMarketSave(CustomNpcsPermissions.NPC_ADVANCED, true),
JobSave(CustomNpcsPermissions.NPC_ADVANCED, true), JobGet(true),
@@ -51,20 +46,15 @@ public enum EnumPacketServer {
ScriptDataSave(CustomNpcsPermissions.SCRIPT_NPC, true), ScriptDataGet(true),
EventScriptDataSave(CustomNpcsPermissions.SCRIPT_NPC, true), EventScriptDataGet(true),
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
PlayerDataMapRegen(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
DialogCategoriesGet, DialogsGetFromDialog,
DialogsGet, DialogGet,
DialogRemove(CustomNpcsPermissions.GLOBAL_DIALOG),
TransportCategoryRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportGetLocation(true),
TransportRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportsGet,
TransportCategorySave(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportCategoriesGet,
FactionRemove(CustomNpcsPermissions.GLOBAL_FACTION),
FactionSave(CustomNpcsPermissions.GLOBAL_FACTION), FactionsGet, FactionGet,
TagRemove(CustomNpcsPermissions.GLOBAL_TAG),
TagSave(CustomNpcsPermissions.GLOBAL_TAG), TagsGet, TagGet, NpcTagsGet,
FactionsGet,
FactionGet,
TagsGet,
TagGet,
NpcTagsGet,
QuestCategoriesGet,
QuestRemove(CustomNpcsPermissions.GLOBAL_QUEST),
QuestRewardSave(CustomNpcsPermissions.GLOBAL_QUEST),
@@ -77,9 +67,8 @@ public enum EnumPacketServer {
AnimationsGet, AnimationGet,
AnimationRemove(CustomNpcsPermissions.GLOBAL_ANIMATION), AnimationSave(CustomNpcsPermissions.GLOBAL_ANIMATION),
QuestOpenGui, PlayerDataGet, QuestLogToServer, PartyLogToServer, UntrackQuest,
QuestOpenGui, QuestLogToServer, PartyLogToServer, UntrackQuest,
RemoteTpToNpc(CustomNpcsPermissions.NPC_TELEPORT),
QuestGet, QuestCategoryGet,
SaveTileEntity, MailOpenSetup,
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen, CacheAnimation,