mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Merge branch 'packet' of https://github.com/KAMKEEL/CustomNPC-Plus into packet
This commit is contained in:
commit
30e58dc049
28 files changed
+264
-144
No files matched your search
@@ -10,12 +10,11 @@ import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.enums.EnumChannelType;
|
||||
import kamkeel.npcs.network.packets.data.*;
|
||||
import kamkeel.npcs.network.packets.data.gui.*;
|
||||
import kamkeel.npcs.network.packets.data.gui.IsGuiOpenPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.*;
|
||||
import kamkeel.npcs.network.packets.data.npc.*;
|
||||
import kamkeel.npcs.network.packets.data.script.*;
|
||||
import kamkeel.npcs.network.packets.request.AnimationCachePacket;
|
||||
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.GuiRequestPacket;
|
||||
import kamkeel.npcs.network.packets.request.*;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankSavePacket;
|
||||
@@ -50,9 +49,15 @@ 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 kamkeel.npcs.network.packets.request.role.RoleCompanionUpdatePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformLoadPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.transport.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -96,6 +101,11 @@ public class PacketHandler {
|
||||
}
|
||||
|
||||
public void registerRequestPackets(){
|
||||
// NPC Packets
|
||||
REQUEST_PACKET.registerPacket(new NpcClosePacket());
|
||||
REQUEST_PACKET.registerPacket(new NpcDeletePacket());
|
||||
|
||||
|
||||
// Linked Packets
|
||||
REQUEST_PACKET.registerPacket(new LinkedGetAllPacket());
|
||||
REQUEST_PACKET.registerPacket(new LinkedRemovePacket());
|
||||
@@ -185,7 +195,7 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new TransportSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new TransportGetLocationPacket());
|
||||
|
||||
// Remote Packets
|
||||
// Remote Packets Packets
|
||||
REQUEST_PACKET.registerPacket(new RemoteMainMenuPacket());
|
||||
REQUEST_PACKET.registerPacket(new RemoteGlobalMenuPacket());
|
||||
REQUEST_PACKET.registerPacket(new RemoteDeletePacket());
|
||||
@@ -195,22 +205,36 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new RemoteResetPacket());
|
||||
REQUEST_PACKET.registerPacket(new RemoteTpToNpcPacket());
|
||||
|
||||
// CustomGUI
|
||||
// CustomGUI Packets
|
||||
REQUEST_PACKET.registerPacket(new CustomGuiButtonPacket());
|
||||
REQUEST_PACKET.registerPacket(new CustomGuiClosePacket());
|
||||
REQUEST_PACKET.registerPacket(new CustomGuiUnfocusedPacket());
|
||||
REQUEST_PACKET.registerPacket(new CustomScrollClickPacket());
|
||||
|
||||
// Job
|
||||
// Job Packets
|
||||
REQUEST_PACKET.registerPacket(new JobGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new JobSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new JobSpawnerAddPacket());
|
||||
REQUEST_PACKET.registerPacket(new JobSpawnerRemovePacket());
|
||||
|
||||
// Other
|
||||
// Role Packets
|
||||
REQUEST_PACKET.registerPacket(new RoleCompanionUpdatePacket());
|
||||
REQUEST_PACKET.registerPacket(new RoleSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new RoleGetPacket());
|
||||
|
||||
// Transform Packets
|
||||
REQUEST_PACKET.registerPacket(new TransformSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new TransformGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TransformLoadPacket());
|
||||
|
||||
// Other Packets
|
||||
REQUEST_PACKET.registerPacket(new IsGuiOpenInform());
|
||||
REQUEST_PACKET.registerPacket(new GuiRequestPacket());
|
||||
REQUEST_PACKET.registerPacket(new DimensionsGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new AnimationCachePacket());
|
||||
REQUEST_PACKET.registerPacket(new MerchantUpdatePacket());
|
||||
REQUEST_PACKET.registerPacket(new ModelDataSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new MailOpenSetupPacket());
|
||||
}
|
||||
|
||||
public void registerDataPackets(){
|
||||
|
||||
@@ -121,5 +121,38 @@ public enum EnumRequestPacket {
|
||||
PartySetLeader,
|
||||
PartySetQuest,
|
||||
|
||||
LinkedRemove, LinkedAdd, LinkedGetAll, LinkedSet, BankGet, BanksGet, BankSave, BankRemove, QuestCategoryGet, PlayerDataGet, PlayerDataRemove, PlayerDataMapRegen, JobSave, JobGet, JobSpawnerAdd, RoleCompanionUpdate, JobSpawnerRemove, RoleSave, RoleGet, MailOpenSetup, TransformSave, TransformGet, TransformLoad, TraderMarketSave, ServerUpdateSkinOverlays
|
||||
LinkedRemove,
|
||||
LinkedAdd,
|
||||
LinkedGetAll,
|
||||
LinkedSet,
|
||||
|
||||
BankGet,
|
||||
BanksGet,
|
||||
BankSave,
|
||||
BankRemove,
|
||||
|
||||
QuestCategoryGet,
|
||||
|
||||
PlayerDataGet,
|
||||
PlayerDataRemove,
|
||||
PlayerDataMapRegen,
|
||||
|
||||
JobSave,
|
||||
JobGet,
|
||||
JobSpawnerAdd,
|
||||
JobSpawnerRemove,
|
||||
|
||||
RoleCompanionUpdate,
|
||||
RoleSave,
|
||||
RoleGet,
|
||||
|
||||
MailOpenSetup,
|
||||
|
||||
TransformSave,
|
||||
TransformGet,
|
||||
TransformLoad,
|
||||
|
||||
TraderMarketSave,
|
||||
|
||||
ServerUpdateSkinOverlays
|
||||
}
|
||||
@@ -45,8 +45,6 @@ public final class GuiRequestPacket extends AbstractPacket {
|
||||
return true;
|
||||
}
|
||||
|
||||
// No permission override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
|
||||
+3
-3
@@ -13,15 +13,15 @@ import noppes.npcs.controllers.data.PlayerData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class IsGuiOpenPacket extends AbstractPacket {
|
||||
public final class IsGuiOpenInform extends AbstractPacket {
|
||||
public static final String packetName = "Request|IsGuiOpen";
|
||||
|
||||
private boolean isOpen;
|
||||
|
||||
public IsGuiOpenPacket() {
|
||||
public IsGuiOpenInform() {
|
||||
}
|
||||
|
||||
public IsGuiOpenPacket(boolean isOpen) {
|
||||
public IsGuiOpenInform(boolean isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
@@ -22,8 +23,14 @@ import java.io.IOException;
|
||||
public final class MailOpenSetupPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MailOpenSetup";
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public MailOpenSetupPacket() { }
|
||||
|
||||
public MailOpenSetupPacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MailOpenSetup;
|
||||
@@ -36,12 +43,18 @@ public final class MailOpenSetupPacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, this.compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
PlayerMail mail = new PlayerMail();
|
||||
mail.readNBT(ByteBufUtils.readNBT(in));
|
||||
ContainerMail.staticmail = mail;
|
||||
|
||||
@@ -9,6 +9,7 @@ import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -22,8 +23,16 @@ import java.io.IOException;
|
||||
public final class MerchantUpdatePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MerchantUpdate";
|
||||
|
||||
private int entityID;
|
||||
private MerchantRecipeList list;
|
||||
|
||||
public MerchantUpdatePacket() { }
|
||||
|
||||
public MerchantUpdatePacket(int entityID, MerchantRecipeList list) {
|
||||
this.entityID = entityID;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MerchantUpdate;
|
||||
@@ -41,7 +50,9 @@ public final class MerchantUpdatePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.fillBuffer(out, this.entityID, this.list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
|
||||
@@ -12,6 +12,7 @@ import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
@@ -20,8 +21,14 @@ import java.io.IOException;
|
||||
public final class ModelDataSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|ModelDataSave";
|
||||
|
||||
private NBTTagCompound save;
|
||||
|
||||
public ModelDataSavePacket() { }
|
||||
|
||||
public ModelDataSavePacket(NBTTagCompound save) {
|
||||
this.save = save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.ModelDataSave;
|
||||
@@ -45,13 +52,17 @@ public final class ModelDataSavePacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
|
||||
ByteBufUtils.writeNBT(out, this.save);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
if(npc instanceof EntityCustomNpc)
|
||||
((EntityCustomNpc)npc).modelData.readFromNBT(ByteBufUtils.readNBT(in));
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ import java.io.IOException;
|
||||
public final class NpcDeletePacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|NPCDelete";
|
||||
|
||||
public NpcDeletePacket() {
|
||||
}
|
||||
public NpcDeletePacket() {}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
+19
-3
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.constants.EnumCompanionStage;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -20,8 +21,14 @@ import java.io.IOException;
|
||||
public final class RoleCompanionUpdatePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|RoleCompanionUpdate";
|
||||
|
||||
private EnumCompanionStage companionStage;
|
||||
|
||||
public RoleCompanionUpdatePacket() { }
|
||||
|
||||
public RoleCompanionUpdatePacket(EnumCompanionStage companionStage) {
|
||||
this.companionStage = companionStage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.RoleCompanionUpdate;
|
||||
@@ -44,12 +51,21 @@ public final class RoleCompanionUpdatePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(this.companionStage.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
if(npc.advanced.role != EnumRoleType.Companion)
|
||||
return;
|
||||
|
||||
((RoleCompanion)npc.roleInterface).matureTo(EnumCompanionStage.values()[in.readInt()]);
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,6 @@ public final class RoleGetPacket extends AbstractPacket {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
@@ -48,9 +43,15 @@ public final class RoleGetPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if(npc.roleInterface == null) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
if(npc.roleInterface == null)
|
||||
return;
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("RoleData", true);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.roleInterface.writeToNBT(compound));
|
||||
|
||||
@@ -12,6 +12,7 @@ import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -19,8 +20,14 @@ import java.io.IOException;
|
||||
public final class RoleSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|RoleSave";
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public RoleSavePacket() { }
|
||||
|
||||
public RoleSavePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.RoleSave;
|
||||
@@ -43,12 +50,18 @@ public final class RoleSavePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, this.compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
npc.roleInterface.readFromNBT(ByteBufUtils.readNBT(in));
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
+6
-2
@@ -48,8 +48,12 @@ public final class TransformGetPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.transform.writeOptions(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
+12
-2
@@ -18,8 +18,14 @@ import java.io.IOException;
|
||||
public final class TransformLoadPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|TransformLoad";
|
||||
|
||||
private boolean transform;
|
||||
|
||||
public TransformLoadPacket() { }
|
||||
|
||||
public TransformLoadPacket(boolean transform) {
|
||||
this.transform = transform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TransformLoad;
|
||||
@@ -46,8 +52,12 @@ public final class TransformLoadPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
if(npc.transform.isValid())
|
||||
npc.transform.transform(in.readBoolean());
|
||||
}
|
||||
|
||||
+16
-3
@@ -12,6 +12,7 @@ import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -19,8 +20,14 @@ import java.io.IOException;
|
||||
public final class TransformSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|TransformSave";
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public TransformSavePacket() { }
|
||||
|
||||
public TransformSavePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TransformSave;
|
||||
@@ -43,12 +50,18 @@ public final class TransformSavePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, this.compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
boolean isValid = npc.transform.isValid();
|
||||
npc.transform.readOptions(ByteBufUtils.readNBT(in));
|
||||
if (isValid != npc.transform.isValid())
|
||||
|
||||
@@ -456,53 +456,6 @@ public class PacketHandlerServer{
|
||||
NoppesUtilServer.setEditingQuest(player,quest);
|
||||
player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0);
|
||||
}
|
||||
else if(type == EnumPacketServer.RoleCompanionUpdate){
|
||||
if(npc.advanced.role != EnumRoleType.Companion)
|
||||
return;
|
||||
((RoleCompanion)npc.roleInterface).matureTo(EnumCompanionStage.values()[buffer.readInt()]);
|
||||
npc.updateClient = true;
|
||||
}
|
||||
else if(type == EnumPacketServer.RoleSave){
|
||||
npc.roleInterface.readFromNBT(ByteBufUtils.readNBT(buffer));
|
||||
npc.updateClient = true;
|
||||
}
|
||||
else if(type == EnumPacketServer.RoleGet){
|
||||
if(npc.roleInterface == null)
|
||||
return;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("RoleData", true);
|
||||
GuiDataPacket.sendGuiData(player, npc.roleInterface.writeToNBT(compound));
|
||||
}
|
||||
else if(type == EnumPacketServer.MerchantUpdate){
|
||||
Entity entity = player.worldObj.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityVillager))
|
||||
return;
|
||||
MerchantRecipeList list = MerchantRecipeList.func_151390_b(new PacketBuffer(buffer));
|
||||
((EntityVillager)entity).setRecipes(list);
|
||||
}
|
||||
else if(type == EnumPacketServer.ModelDataSave){
|
||||
if(npc instanceof EntityCustomNpc)
|
||||
((EntityCustomNpc)npc).modelData.readFromNBT(ByteBufUtils.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketServer.MailOpenSetup){
|
||||
PlayerMail mail = new PlayerMail();
|
||||
mail.readNBT(ByteBufUtils.readNBT(buffer));
|
||||
ContainerMail.staticmail = mail;
|
||||
player.openGui(CustomNpcs.instance, EnumGuiType.PlayerMailman.ordinal(), player.worldObj, 1, 0, 0);
|
||||
}
|
||||
else if(type == EnumPacketServer.TransformSave){
|
||||
boolean isValid = npc.transform.isValid();
|
||||
npc.transform.readOptions(ByteBufUtils.readNBT(buffer));
|
||||
if(isValid != npc.transform.isValid())
|
||||
npc.updateAI = true;
|
||||
}
|
||||
else if(type == EnumPacketServer.TransformGet){
|
||||
GuiDataPacket.sendGuiData(player, npc.transform.writeOptions(new NBTTagCompound()));
|
||||
}
|
||||
else if(type == EnumPacketServer.TransformLoad){
|
||||
if(npc.transform.isValid())
|
||||
npc.transform.transform(buffer.readBoolean());
|
||||
}
|
||||
else if(type == EnumPacketServer.TraderMarketSave){
|
||||
String market = ByteBufUtils.readString(buffer);
|
||||
if(market == null)
|
||||
|
||||
@@ -3,6 +3,7 @@ package noppes.npcs.client;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.GuiRequestPacket;
|
||||
import kamkeel.npcs.network.packets.request.IsGuiOpenInform;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
@@ -21,7 +22,6 @@ 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.data.Dialog;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
@@ -268,6 +268,6 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void isGUIOpen(boolean isGUIOpen) {
|
||||
Client.sendData(EnumPacketServer.IsGuiOpen, isGUIOpen);
|
||||
PacketClient.sendClient(new IsGuiOpenInform(isGUIOpen));
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.MerchantUpdatePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -109,7 +111,7 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
merchantrecipelist.remove(currentRecipeIndex);
|
||||
if(currentRecipeIndex > 0)
|
||||
currentRecipeIndex--;
|
||||
Client.sendData(EnumPacketServer.MerchantUpdate, ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist);
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +134,7 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
merchantrecipelist.add(recipe);
|
||||
Client.sendData(EnumPacketServer.MerchantUpdate, ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist);
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.MailOpenSetupPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -63,7 +65,7 @@ public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfiel
|
||||
GuiMailmanWrite.parent = getParent();
|
||||
GuiMailmanWrite.mail = mail;
|
||||
|
||||
Client.sendData(EnumPacketServer.MailOpenSetup, mail.writeNBT());
|
||||
PacketClient.sendClient(new MailOpenSetupPacket(mail.writeNBT()));
|
||||
}
|
||||
if(id == 3){
|
||||
setSubGui(new GuiQuestSelection(mail.questId));
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformLoadPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -14,12 +18,12 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
{
|
||||
private DataTransform data;
|
||||
|
||||
|
||||
public GuiNPCNightSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
data = npc.transform;
|
||||
Client.sendData(EnumPacketServer.TransformGet);
|
||||
PacketClient.sendClient(new TransformGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -40,16 +44,16 @@ public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
|
||||
this.addLabel(new GuiNpcLabel(4, "menu.advanced", guiLeft + 4, guiTop + 113));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 104, guiTop + 108, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasAdvanced?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(5, "role.name", guiLeft + 4, guiTop + 135));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 104, guiTop + 130, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasRole?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(6, "job.name", guiLeft + 4, guiTop + 157));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 104, guiTop + 152, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasJob?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(10, "advanced.editingmode", guiLeft + 170, guiTop + 9));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 244, guiTop + 4, 50, 20, new String[]{"gui.no","gui.yes"}, data.editingModus?1:0));
|
||||
|
||||
|
||||
if(data.editingModus){
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 170, guiTop + 34, "advanced.loadday"));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 170, guiTop + 56, "advanced.loadnight"));
|
||||
@@ -80,16 +84,16 @@ public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 11){
|
||||
Client.sendData(EnumPacketServer.TransformLoad, false);
|
||||
PacketClient.sendClient(new TransformLoadPacket(false));
|
||||
}
|
||||
if(button.id == 12){
|
||||
Client.sendData(EnumPacketServer.TransformLoad, true);
|
||||
PacketClient.sendClient(new TransformLoadPacket(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.TransformSave, data.writeOptions(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new TransformSavePacket(data.writeOptions(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
@@ -60,7 +61,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 3) {
|
||||
save();
|
||||
Client.sendData(EnumPacketServer.RoleGet);
|
||||
PacketClient.sendClient(new RoleGetPacket());
|
||||
}
|
||||
if(button.id == 8){
|
||||
hasChanges = true;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package noppes.npcs.client.gui.model;
|
||||
|
||||
import kamkeel.npcs.addon.client.GeckoAddonClient;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.ModelDataSavePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -380,7 +382,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
Client.sendData(EnumPacketServer.ModelDataSave, playerdata.writeToNBT());
|
||||
PacketClient.sendClient(new ModelDataSavePacket(playerdata.writeToNBT()));
|
||||
displayGuiScreen(parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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 kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -83,6 +84,6 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleCompanionUpdatePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -14,11 +17,11 @@ import noppes.npcs.roles.RoleCompanion;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListener, ISliderListener{
|
||||
public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListener, ISliderListener{
|
||||
private RoleCompanion role;
|
||||
private List<GuiTalent> talents = new ArrayList<GuiTalent>();
|
||||
public GuiNpcCompanion(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
super(npc);
|
||||
role = (RoleCompanion) npc.roleInterface;
|
||||
}
|
||||
|
||||
@@ -27,11 +30,11 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
super.initGui();
|
||||
talents.clear();
|
||||
int y = guiTop + 4;
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 70, y, 90, 20, new String[]{EnumCompanionStage.BABY.name, EnumCompanionStage.CHILD.name, EnumCompanionStage.TEEN.name, EnumCompanionStage.ADULT.name, EnumCompanionStage.FULLGROWN.name}, role.stage.ordinal()));
|
||||
addLabel(new GuiNpcLabel(0, "companion.stage", guiLeft + 4, y + 5));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 162, y, 90, 20, "gui.update"));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(2, guiLeft + 70, y += 22, 90, 20, new String[]{"gui.no", "gui.yes"}, role.canAge?1:0));
|
||||
addLabel(new GuiNpcLabel(2, "companion.age", guiLeft + 4, y + 5));
|
||||
if(role.canAge){
|
||||
@@ -42,13 +45,13 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.INVENTORY, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 10, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.INVENTORY)/5000f));
|
||||
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.ARMOR, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 11, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.ARMOR)/5000f));
|
||||
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.SWORD, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 12, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.SWORD)/5000f));
|
||||
|
||||
|
||||
// talents.add(new GuiTalent(role, EnumCompanionTalent.RANGED, guiLeft + 4, y+=26));
|
||||
// addSlider(new GuiNpcSlider(this, 13, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.RANGED)/5000f));
|
||||
}
|
||||
@@ -63,7 +66,7 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
initGui();
|
||||
}
|
||||
if(guibutton.id == 1){
|
||||
Client.sendData(EnumPacketServer.RoleCompanionUpdate, role.stage.ordinal());
|
||||
PacketClient.sendClient(new RoleCompanionUpdatePacket(role.stage));
|
||||
}
|
||||
if(guibutton.id == 2){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
@@ -85,16 +88,16 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
talent.drawScreen(i, j, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,13 +115,13 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
@Override
|
||||
public void mousePressed(GuiNpcSlider slider) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(GuiNpcSlider slider) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -47,13 +49,13 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
|
||||
addLabel(new GuiNpcLabel(7, "follower.infiniteDays", guiLeft + 180, guiTop + 80));
|
||||
addButton(new GuiNpcButtonYesNo(7, guiLeft + 260, guiTop + 75, role.infiniteDays));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(8, "follower.guiDisabled", guiLeft + 180, guiTop + 104));
|
||||
addButton(new GuiNpcButtonYesNo(8, guiLeft + 260, guiTop + 99, role.disableGui));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(9, "follower.allowSoulstone", guiLeft + 180, guiTop + 128));
|
||||
addButton(new GuiNpcButtonYesNo(9, guiLeft + 260, guiTop + 123, !role.refuseSoulStone));
|
||||
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 195, guiTop + 147, 100, 20, "remote.reset"));
|
||||
}
|
||||
@@ -77,7 +79,7 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
@@ -91,13 +93,13 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
days = getTextField(i).getInteger();
|
||||
if(days <= 0)
|
||||
days = 1;
|
||||
|
||||
|
||||
map.put(i,days);
|
||||
}
|
||||
}
|
||||
role.rates = map;
|
||||
role.dialogHire = getTextField(3).getText();
|
||||
role.dialogFarewell = getTextField(4).getText();
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -86,7 +88,7 @@ public class GuiNpcTraderSetup extends GuiContainerNPCInterface2 implements ITex
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.TraderMarketSave, role.marketName, false);
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.util;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.NpcClosePacket;
|
||||
import kamkeel.npcs.network.packets.request.npc.NpcDeletePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -104,7 +107,7 @@ public class GuiNpcMenu implements GuiYesNoCallback {
|
||||
if (npc != null) {
|
||||
npc.reset();
|
||||
if (saveNPC)
|
||||
Client.sendData(EnumPacketServer.NpcMenuClose);
|
||||
PacketClient.sendClient(new NpcClosePacket());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +135,7 @@ public class GuiNpcMenu implements GuiYesNoCallback {
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (flag) {
|
||||
Client.sendData(EnumPacketServer.NPCDelete);
|
||||
PacketClient.sendClient(new NpcDeletePacket());
|
||||
mc.displayGuiScreen(null);
|
||||
mc.setIngameFocus();
|
||||
} else {
|
||||
|
||||
@@ -3,23 +3,19 @@ package noppes.npcs.constants;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
public enum EnumPacketServer {
|
||||
NPCDelete(CustomNpcsPermissions.NPC_DELETE, true),
|
||||
NpcMenuClose(CustomNpcsPermissions.NPC_GUI, true),
|
||||
RemoteReset(CustomNpcsPermissions.NPC_RESET),
|
||||
SpawnMob(CustomNpcsPermissions.SPAWNER_MOB),
|
||||
MobSpawner(CustomNpcsPermissions.SPAWNER_CREATE),
|
||||
|
||||
ModelDataSave(CustomNpcsPermissions.NPC_DISPLAY, true),
|
||||
|
||||
TransformSave(CustomNpcsPermissions.NPC_ADVANCED, true), TransformGet(true),
|
||||
TransformLoad(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
TraderMarketSave(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
|
||||
RoleSave(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
RoleGet(true),
|
||||
RoleCompanionUpdate(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
|
||||
ClonePreSave(CustomNpcsPermissions.NPC_CLONE), CloneSave(CustomNpcsPermissions.NPC_CLONE), CloneRemove(CustomNpcsPermissions.NPC_CLONE), CloneList, CloneTagList, CloneAllTags, CloneAllTagsShort,
|
||||
ClonePreSave(CustomNpcsPermissions.NPC_CLONE),
|
||||
CloneSave(CustomNpcsPermissions.NPC_CLONE),
|
||||
CloneRemove(CustomNpcsPermissions.NPC_CLONE),
|
||||
CloneList,
|
||||
CloneTagList,
|
||||
CloneAllTags,
|
||||
CloneAllTagsShort,
|
||||
|
||||
ScriptGlobalGuiDataSave(CustomNpcsPermissions.SCRIPT_GLOBAL, false),
|
||||
ScriptGlobalGuiDataGet(false),
|
||||
@@ -65,8 +61,8 @@ public enum EnumPacketServer {
|
||||
|
||||
QuestOpenGui, QuestLogToServer, PartyLogToServer, UntrackQuest,
|
||||
|
||||
QuestGet, QuestCategoryGet,
|
||||
SaveTileEntity, MailOpenSetup,
|
||||
QuestGet,
|
||||
SaveTileEntity,
|
||||
DimensionTeleport, GetTileEntity, IsGuiOpen,
|
||||
|
||||
SavePartyData, CreateParty, GetPartyData, DisbandParty, KickPlayer, LeavePlayer, PartyInvite, GetPartyInviteList, AcceptInvite,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
public enum EnumPlayerPacket {
|
||||
// FollowerHire, // Finished
|
||||
// FollowerExtend,
|
||||
// FollowerState,
|
||||
Transport,
|
||||
BankUnlock,
|
||||
BankUpgrade,
|
||||
|
||||
Reference in new issue
Block a user