Reorg -- Data Packets designed to send to Client

This commit is contained in:
Kam committed 2025-01-30 13:54:49 -05:00
1 parent da9ed1d60f
commit db2144116f
65 files changed
+459 -474

No files matched your search

+11 -12
View File
@@ -4,13 +4,12 @@ import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.enums.EnumSoundOperation;
import kamkeel.npcs.network.packets.client.DisableMouseInputPacket;
import kamkeel.npcs.network.packets.client.OverlayQuestTrackingPacket;
import kamkeel.npcs.network.packets.client.SoundManagementPacket;
import kamkeel.npcs.network.packets.client.SwingPlayerArmPacket;
import kamkeel.npcs.network.packets.client.gui.IsGuiOpenPacket;
import kamkeel.npcs.network.packets.data.*;
import kamkeel.npcs.network.packets.data.gui.GuiClosePacket;
import kamkeel.npcs.network.packets.data.gui.IsGuiOpenPacket;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import kamkeel.npcs.network.packets.data.large.PartyDataPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -295,17 +294,17 @@ public class NoppesUtilPlayer {
if(npc.roleInterface != null)
npc.roleInterface.interact(player);
else
PacketUtil.closeGUI(player, -1 , new NBTTagCompound());
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
}
else if(option.optionType == EnumOptionType.DialogOption){
NoppesUtilServer.openDialog(player, npc, option.getDialog(), optionId+1);
}
else if(option.optionType == EnumOptionType.CommandBlock){
PacketUtil.closeGUI(player, -1 , new NBTTagCompound());
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
NoppesUtilServer.runCommand(player, npc.getCommandSenderName(), option.command);
}
else
PacketUtil.closeGUI(player, -1 , new NBTTagCompound());
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
}
public static void updateQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
@@ -426,14 +425,14 @@ public class NoppesUtilPlayer {
}
QuestLogData data = new QuestLogData();
data.setData(player);
PacketUtil.sendGuiData(player, data.writeNBT());
GuiDataPacket.sendGuiData(player, data.writeNBT());
}
public static void sendTrackedQuest(EntityPlayerMP player) {
QuestLogData data = new QuestLogData();
data.setTrackedQuestKey(player);
PacketUtil.sendPartyData(player, data.writeTrackedQuest());
PartyDataPacket.sendPartyData(player, data.writeTrackedQuest());
}
public static boolean questCompletion(EntityPlayerMP player, int questId) {
@@ -635,7 +634,7 @@ public class NoppesUtilPlayer {
}
playerData.save();
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
QuestCompletionPacket.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
}
if(quest.type == EnumQuestType.Item && partyOptions.objectiveRequirement == EnumPartyObjectives.Shared){
+24 -20
View File
@@ -3,14 +3,18 @@ package noppes.npcs;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.controllers.SyncController;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.client.npc.DialogPacket;
import kamkeel.npcs.network.packets.client.ParticlePacket;
import kamkeel.npcs.network.packets.client.script.ScriptedParticlePacket;
import kamkeel.npcs.network.packets.client.npc.DeleteNpcPacket;
import kamkeel.npcs.network.packets.client.npc.EditNpcPacket;
import kamkeel.npcs.network.packets.client.npc.RolePacket;
import kamkeel.npcs.network.packets.client.gui.GuiTeleporterPacket;
import kamkeel.npcs.network.packets.data.gui.GuiClosePacket;
import kamkeel.npcs.network.packets.data.gui.GuiErrorPacket;
import kamkeel.npcs.network.packets.data.gui.GuiOpenPacket;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import kamkeel.npcs.network.packets.data.large.ScrollListPacket;
import kamkeel.npcs.network.packets.data.npc.DialogPacket;
import kamkeel.npcs.network.packets.data.ParticlePacket;
import kamkeel.npcs.network.packets.data.script.ScriptedParticlePacket;
import kamkeel.npcs.network.packets.data.npc.DeleteNpcPacket;
import kamkeel.npcs.network.packets.data.npc.EditNpcPacket;
import kamkeel.npcs.network.packets.data.npc.RolePacket;
import kamkeel.npcs.network.packets.data.gui.GuiTeleporterPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.Entity;
@@ -55,8 +59,8 @@ import java.io.IOException;
import java.text.DecimalFormat;
import java.util.*;
import static kamkeel.npcs.network.PacketUtil.sendScrollData;
import static kamkeel.npcs.network.PacketUtil.sendScrollGroup;
import static kamkeel.npcs.network.packets.data.large.ScrollDataPacket.sendScrollData;
import static kamkeel.npcs.network.packets.data.large.ScrollGroupPacket.sendScrollGroup;
public class NoppesUtilServer {
private static HashMap<String,Quest> editingQuests = new HashMap<String,Quest>();
@@ -298,13 +302,13 @@ public class NoppesUtilServer {
return;
}
else{
PacketUtil.openGUI((EntityPlayerMP)player, gui, i, j, k);
GuiOpenPacket.openGUI((EntityPlayerMP)player, gui, i, j, k);
}
ArrayList<String> list = getScrollData(player, gui, npc);
if(list == null || list.isEmpty())
return;
PacketUtil.sendList((EntityPlayerMP)player, list);
ScrollListPacket.sendList((EntityPlayerMP)player, list);
}
public static void sendOpenGuiNoDelay(final EntityPlayer player,
@@ -320,13 +324,13 @@ public class NoppesUtilServer {
return;
}
else{
PacketUtil.openGUI((EntityPlayerMP)player, gui, i, j, k);
GuiOpenPacket.openGUI((EntityPlayerMP)player, gui, i, j, k);
}
ArrayList<String> list = getScrollData(player, gui, npc);
if(list == null || list.isEmpty())
return;
PacketUtil.sendList((EntityPlayerMP)player, list);
ScrollListPacket.sendList((EntityPlayerMP)player, list);
}
@@ -671,7 +675,7 @@ public class NoppesUtilServer {
NBTTagCompound compound = option.writeNBT();
compound.setInteger("Position", pos);
PacketUtil.sendGuiData((EntityPlayerMP)player, compound);
GuiDataPacket.sendGuiData((EntityPlayerMP)player, compound);
}
}
@@ -707,7 +711,7 @@ public class NoppesUtilServer {
public static void setClonerGui(EntityPlayerMP player, int x, int y, int z){
if(player == null)
return;
PacketUtil.openGUI(player, EnumGuiType.Cloner, x, y, z);
GuiOpenPacket.openGUI(player, EnumGuiType.Cloner, x, y, z);
}
public static void setTeleporterGUI(EntityPlayerMP player){
@@ -724,13 +728,13 @@ public class NoppesUtilServer {
ContainerManageRecipes container = (ContainerManageRecipes) player.openContainer;
container.setRecipe(recipe);
PacketUtil.sendGuiData((EntityPlayerMP)player, recipe.writeNBT());
GuiDataPacket.sendGuiData((EntityPlayerMP)player, recipe.writeNBT());
}
public static void sendBank(EntityPlayerMP player,Bank bank) {
NBTTagCompound compound = new NBTTagCompound();
bank.writeEntityToNBT(compound);
PacketUtil.sendGuiData((EntityPlayerMP)player, compound);
GuiDataPacket.sendGuiData((EntityPlayerMP)player, compound);
if(player.openContainer instanceof ContainerManageBanks){
((ContainerManageBanks)player.openContainer).setBank(bank);
@@ -756,14 +760,14 @@ public class NoppesUtilServer {
}
public static void sendGuiError(EntityPlayer player, int i) {
PacketUtil.errorGUI((EntityPlayerMP)player, i, new NBTTagCompound());
GuiErrorPacket.errorGUI((EntityPlayerMP)player, i, new NBTTagCompound());
}
public static void sendGuiClose(EntityPlayerMP player, int i, NBTTagCompound comp) {
if(player.openContainer != player.inventoryContainer){
player.openContainer = player.inventoryContainer;
}
PacketUtil.closeGUI(player, i, comp);
GuiClosePacket.closeGUI(player, i, comp);
}
public static Entity spawnCloneWithProtection(NBTTagCompound compound, int x, int y,
@@ -3,9 +3,8 @@ package noppes.npcs;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemEditableBook;
@@ -29,7 +28,6 @@ import noppes.npcs.roles.RoleCompanion;
import java.io.IOException;
import java.util.Iterator;
import java.util.UUID;
public class PacketHandlerPlayer{
@@ -45,17 +43,7 @@ public class PacketHandlerPlayer{
}
private void player(ByteBuf buffer, EntityPlayerMP player, EnumPlayerPacket type) throws IOException {
if(type == EnumPlayerPacket.MarkData){
String uuid = ByteBufUtils.readString(buffer);
if(uuid == null)
return;
Entity entity = NoppesUtilServer.getEntityFromUUID(player.worldObj, UUID.fromString(uuid));
if(!(entity instanceof EntityNPCInterface))
return;
MarkData data = MarkData.get((EntityNPCInterface) entity);
}
else if(type == EnumPlayerPacket.CompanionTalentExp){
if(type == EnumPlayerPacket.CompanionTalentExp){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Companion || player != npc.getOwner())
return;
@@ -149,20 +137,20 @@ public class PacketHandlerPlayer{
if(npc == null || npc.advanced.role != EnumRoleType.Follower)
return;
NoppesUtilPlayer.extendFollower(player, npc);
PacketUtil.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPlayerPacket.FollowerState){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Follower)
return;
NoppesUtilPlayer.changeFollowerState(player,npc);
PacketUtil.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPlayerPacket.RoleGet){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role == EnumRoleType.None)
return;
PacketUtil.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPlayerPacket.Transport){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
@@ -214,11 +202,11 @@ public class PacketHandlerPlayer{
}
else if(type == EnumPlayerPacket.FactionsGet){
PlayerFactionData data = PlayerDataController.Instance.getPlayerData(player).factionData;
PacketUtil.sendGuiData(player, data.getPlayerGuiData());
GuiDataPacket.sendGuiData(player, data.getPlayerGuiData());
}
else if(type == EnumPlayerPacket.MailGet){
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
PacketUtil.sendGuiData(player, data.saveNBTData(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, data.saveNBTData(new NBTTagCompound()));
}
else if(type == EnumPlayerPacket.MailDelete){
long time = buffer.readLong();
@@ -232,7 +220,7 @@ public class PacketHandlerPlayer{
it.remove();
}
}
PacketUtil.sendGuiData(player, data.saveNBTData(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, data.saveNBTData(new NBTTagCompound()));
}
else if(type == EnumPlayerPacket.MailSend){
if(!(player.openContainer instanceof ContainerMail))
@@ -6,7 +6,11 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.relauncher.Side;
import foxz.utils.Market;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.ScrollSelectedPacket;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import kamkeel.npcs.network.packets.data.large.PartyDataPacket;
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
import kamkeel.npcs.network.packets.data.large.ScrollListPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -104,7 +108,7 @@ public class PacketHandlerServer{
WorldProvider provider = DimensionManager.createProviderFor(id);
map.put(provider.getDimensionName(), id);
}
PacketUtil.sendScrollData(player, map);
ScrollDataPacket.sendScrollData(player, map);
} else if(type == EnumPacketServer.TagsGet){
NoppesUtilServer.sendTagDataAll(player);
} else if (type == EnumPacketServer.NpcTagsGet) {
@@ -117,7 +121,7 @@ public class PacketHandlerServer{
}
}
compound.setTag("TagNames",tagList);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
} else if (type == EnumPacketServer.CacheAnimation) {
PlayerDataController.Instance.getPlayerData(player).animationData.cacheAnimation(buffer.readInt());
return;
@@ -138,7 +142,7 @@ public class PacketHandlerServer{
}
NBTTagCompound compound = new NBTTagCompound();
compound.setBoolean("Disband", true);
PacketUtil.sendPartyData(player, compound);
PartyDataPacket.sendPartyData(player, compound);
} else if (type == EnumPacketServer.KickPlayer) {
String kickPlayerName = ByteBufUtils.readString(buffer);
EntityPlayer kickPlayer = NoppesUtilServer.getPlayerByName(kickPlayerName);
@@ -338,7 +342,7 @@ public class PacketHandlerServer{
compound.setString("QuestCompleteWith", quest.completerNpc);
}
}
PacketUtil.sendPartyData(player, compound);
PartyDataPacket.sendPartyData(player, compound);
} else {
sendInviteData(player);
}
@@ -358,7 +362,7 @@ public class PacketHandlerServer{
list.appendTag(partyCompound);
}
compound.setTag("PartyInvites", list);
PacketUtil.sendPartyData(player, compound);
PartyDataPacket.sendPartyData(player, compound);
}
}
@@ -373,7 +377,7 @@ public class PacketHandlerServer{
compound.setBoolean("PlayerScriptsEnabled", ConfigScript.GlobalPlayerScripts);
compound.setBoolean("GlobalNPCScriptsEnabled", ConfigScript.GlobalNPCScripts);
compound.setBoolean("ForgeScriptsEnabled", ConfigScript.GlobalForgeScripts);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.ScriptGlobalGuiDataSave) {
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
@@ -396,7 +400,7 @@ public class PacketHandlerServer{
else if(type == EnumPacketServer.ScriptDataGet){
NBTTagCompound compound = npc.script.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
}
@@ -406,7 +410,7 @@ public class PacketHandlerServer{
compound.setString("ScriptLanguage", data.getLanguage());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
compound.setTag("ScriptConsole", NBTTags.NBTLongStringMap(data.getConsoleText()));
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
List<ScriptContainer> containers = data.getScripts();
for (int i = 0; i < containers.size(); i++) {
ScriptContainer container = containers.get(i);
@@ -414,7 +418,7 @@ public class PacketHandlerServer{
tabCompound.setInteger("Tab",i);
tabCompound.setTag("Script",container.writeToNBT(new NBTTagCompound()));
tabCompound.setInteger("TotalScripts",containers.size());
PacketUtil.sendGuiData(player, tabCompound);
GuiDataPacket.sendGuiData(player, tabCompound);
}
}
@@ -508,7 +512,7 @@ public class PacketHandlerServer{
iw.loadScriptData();
NBTTagCompound compound = iw.getMCNbt();
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
} else if (type == EnumPacketServer.ScriptItemDataSave) {
if (!player.capabilities.isCreativeMode) {
return;
@@ -531,7 +535,7 @@ public class PacketHandlerServer{
return;
NBTTagCompound compound = ((TileScripted) tile).getNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
} else if (type == EnumPacketServer.ScriptBlockDataSave) {
if (!player.capabilities.isCreativeMode) {
return;
@@ -568,7 +572,7 @@ public class PacketHandlerServer{
private void movingPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException {
if(type == EnumPacketServer.MovingPathGet){
PacketUtil.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MovingPathSave){
npc.ai.setMovingPath(NBTTags.getIntegerArraySet(ByteBufUtils.readNBT(buffer).getTagList("MovingPathNew",10)));
@@ -583,10 +587,10 @@ public class PacketHandlerServer{
TileEntity tile = player.worldObj.getTileEntity(buffer.readInt(), buffer.readInt(), buffer.readInt());
NBTTagCompound compound = new NBTTagCompound();
tile.writeToNBT(compound);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.DialogCategoriesGet){
PacketUtil.sendScrollData(player, DialogController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, DialogController.Instance.getScroll());
}
else if(type == EnumPacketServer.DialogsGetFromDialog){
Dialog dialog = DialogController.Instance.dialogs.get(buffer.readInt());
@@ -633,7 +637,7 @@ public class PacketHandlerServer{
Quest quest = QuestController.Instance.quests.get(dialog.quest);
if(quest != null)
compound.setString("DialogQuestName", quest.title);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
}
else if(type == EnumPacketServer.QuestGet){
@@ -642,20 +646,20 @@ public class PacketHandlerServer{
NBTTagCompound compound = new NBTTagCompound();
if(quest.hasNewQuest())
compound.setString("NextQuestTitle", quest.getNextQuest().title);
PacketUtil.sendGuiData(player, quest.writeToNBT(compound));
GuiDataPacket.sendGuiData(player, quest.writeToNBT(compound));
}
}
else if(type == EnumPacketServer.FactionGet){
NBTTagCompound compound = new NBTTagCompound();
Faction faction = FactionController.getInstance().get(buffer.readInt());
faction.writeNBT(compound);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagGet){
NBTTagCompound compound = new NBTTagCompound();
Tag tag = TagController.getInstance().get(buffer.readInt());
tag.writeNBT(compound);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
}
@@ -673,7 +677,7 @@ public class PacketHandlerServer{
List<String> list = new ArrayList<String>();
for(LinkedData data : LinkedNpcController.Instance.list)
list.add(data.name);
PacketUtil.sendList((EntityPlayerMP)player, list);
ScrollListPacket.sendList((EntityPlayerMP)player, list);
}
else if(type == EnumPacketServer.LinkedRemove){
LinkedNpcController.Instance.removeData(ByteBufUtils.readString(buffer));
@@ -681,15 +685,15 @@ public class PacketHandlerServer{
List<String> list = new ArrayList<String>();
for(LinkedData data : LinkedNpcController.Instance.list)
list.add(data.name);
PacketUtil.sendList((EntityPlayerMP)player, list);
ScrollListPacket.sendList((EntityPlayerMP)player, list);
}
else if(type == EnumPacketServer.LinkedGetAll){
List<String> list = new ArrayList<String>();
for(LinkedData data : LinkedNpcController.Instance.list)
list.add(data.name);
PacketUtil.sendList((EntityPlayerMP)player, list);
ScrollListPacket.sendList((EntityPlayerMP)player, list);
if(npc != null)
PacketUtil.setSelectedList(player, npc.linkedName);
ScrollSelectedPacket.setSelectedList(player, npc.linkedName);
}
else if(type == EnumPacketServer.LinkedSet){
npc.linkedName = ByteBufUtils.readString(buffer);
@@ -755,10 +759,10 @@ public class PacketHandlerServer{
}
else if(type == EnumPacketServer.RemoteFreeze){
CustomNpcs.FreezeNPCs = !CustomNpcs.FreezeNPCs;
PacketUtil.setSelectedList(player, CustomNpcs.FreezeNPCs?"Unfreeze NPCs":"Freeze NPCs");
ScrollSelectedPacket.setSelectedList(player, CustomNpcs.FreezeNPCs?"Unfreeze NPCs":"Freeze NPCs");
}
else if(type == EnumPacketServer.RemoteFreezeGet){
PacketUtil.setSelectedList(player, CustomNpcs.FreezeNPCs?"Unfreeze NPCs":"Freeze NPCs");
ScrollSelectedPacket.setSelectedList(player, CustomNpcs.FreezeNPCs?"Unfreeze NPCs":"Freeze NPCs");
}
else if(type == EnumPacketServer.RemoteReset){
Entity entity = player.worldObj.getEntityByID(buffer.readInt());
@@ -799,12 +803,12 @@ public class PacketHandlerServer{
NoppesUtilServer.setRecipeGui(player,recipe);
}
else if(type == EnumPacketServer.NaturalSpawnGetAll){
PacketUtil.sendScrollData(player, SpawnController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, SpawnController.Instance.getScroll());
}
else if(type == EnumPacketServer.NaturalSpawnGet){
SpawnData spawn = SpawnController.Instance.getSpawnData(buffer.readInt());
if(spawn != null){
PacketUtil.sendGuiData(player, spawn.writeNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, spawn.writeNBT(new NBTTagCompound()));
}
}
else if(type == EnumPacketServer.NaturalSpawnSave){
@@ -812,28 +816,28 @@ public class PacketHandlerServer{
data.readNBT(ByteBufUtils.readNBT(buffer));
SpawnController.Instance.saveSpawnData(data);
PacketUtil.sendScrollData(player, SpawnController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, SpawnController.Instance.getScroll());
}
else if(type == EnumPacketServer.NaturalSpawnRemove){
SpawnController.Instance.removeSpawnData(buffer.readInt());
PacketUtil.sendScrollData(player, SpawnController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, SpawnController.Instance.getScroll());
}
else if(type == EnumPacketServer.DialogCategorySave){
DialogCategory category = new DialogCategory();
category.readNBT(ByteBufUtils.readNBT(buffer));
DialogController.Instance.saveCategory(category);
PacketUtil.sendScrollData(player, DialogController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, DialogController.Instance.getScroll());
}
else if(type == EnumPacketServer.DialogCategoryRemove){
DialogController.Instance.removeCategory(buffer.readInt());
PacketUtil.sendScrollData(player, DialogController.Instance.getScroll());
ScrollDataPacket.sendScrollData(player, DialogController.Instance.getScroll());
}
else if(type == EnumPacketServer.DialogCategoryGet){
DialogCategory category = DialogController.Instance.categories.get(buffer.readInt());
if(category != null){
NBTTagCompound comp = category.writeNBT(new NBTTagCompound());
comp.removeTag("Dialogs");
PacketUtil.sendGuiData(player, comp);
GuiDataPacket.sendGuiData(player, comp);
}
}
else if(type == EnumPacketServer.DialogSave){
@@ -882,7 +886,7 @@ public class PacketHandlerServer{
if(option != null && option.hasDialog()){
NBTTagCompound compound = option.writeNBT();
compound.setInteger("Position", slot);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
}
else if(type == EnumPacketServer.DialogNpcRemove){
@@ -893,7 +897,7 @@ public class PacketHandlerServer{
if(category != null){
NBTTagCompound comp = category.writeNBT(new NBTTagCompound());
comp.removeTag("Dialogs");
PacketUtil.sendGuiData(player, comp);
GuiDataPacket.sendGuiData(player, comp);
}
}
else if(type == EnumPacketServer.QuestCategorySave){
@@ -932,7 +936,7 @@ public class PacketHandlerServer{
compound.setString("2", quest2.title);
if(quest3 != null)
compound.setString("3", quest3.title);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.QuestRemove){
Quest quest = QuestController.Instance.quests.get(buffer.readInt());
@@ -981,8 +985,8 @@ public class PacketHandlerServer{
return;
RoleTransporter role = (RoleTransporter) npc.roleInterface;
if(role.hasTransport()){
PacketUtil.sendGuiData(player, role.getLocation().writeNBT());
PacketUtil.setSelectedList(player, role.getLocation().category.title);
GuiDataPacket.sendGuiData(player, role.getLocation().writeNBT());
ScrollSelectedPacket.setSelectedList(player, role.getLocation().category.title);
}
}
else if(type == EnumPacketServer.FactionSet){
@@ -995,14 +999,14 @@ public class PacketHandlerServer{
NoppesUtilServer.sendFactionDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
faction.writeNBT(compound);
PacketUtil.sendGuiData(player, 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);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagSet){
this.setTags(npc,buffer);
@@ -1014,14 +1018,14 @@ public class PacketHandlerServer{
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
PacketUtil.sendGuiData(player, 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);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.PlayerDataGet){
int id = buffer.readInt();
@@ -1040,21 +1044,21 @@ public class PacketHandlerServer{
NoppesUtilServer.regenPlayerData(player);
}
else if(type == EnumPacketServer.MainmenuDisplayGet){
PacketUtil.sendGuiData(player, npc.display.writeToNBT(new NBTTagCompound()));
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){
PacketUtil.sendGuiData(player, npc.stats.writeToNBT(new NBTTagCompound()));
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){
PacketUtil.sendGuiData(player, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuInvSave){
npc.inventory.readEntityFromNBT(ByteBufUtils.readNBT(buffer));
@@ -1062,7 +1066,7 @@ public class PacketHandlerServer{
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAIGet){
PacketUtil.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAISave){
npc.ai.readToNBT(ByteBufUtils.readNBT(buffer));
@@ -1071,7 +1075,7 @@ public class PacketHandlerServer{
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAdvancedGet){
PacketUtil.sendGuiData(player, npc.advanced.writeToNBT(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.advanced.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAdvancedSave){
npc.advanced.readToNBT(ByteBufUtils.readNBT(buffer));
@@ -1102,10 +1106,10 @@ public class PacketHandlerServer{
if(npc.advanced.job == EnumJobType.Spawner)
((JobSpawner)npc.jobInterface).cleanCompound(compound);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
if(npc.advanced.job == EnumJobType.Spawner)
PacketUtil.sendGuiData(player, ((JobSpawner)npc.jobInterface).getTitles());
GuiDataPacket.sendGuiData(player, ((JobSpawner)npc.jobInterface).getTitles());
}
else if(type == EnumPacketServer.JobSpawnerAdd){
if(npc.advanced.job != EnumJobType.Spawner)
@@ -1119,7 +1123,7 @@ public class PacketHandlerServer{
else{
job.setJobCompound(buffer.readInt(), ByteBufUtils.readNBT(buffer));
}
PacketUtil.sendGuiData(player, job.getTitles());
GuiDataPacket.sendGuiData(player, job.getTitles());
}
else if(type == EnumPacketServer.RoleCompanionUpdate){
if(npc.advanced.role != EnumRoleType.Companion)
@@ -1132,7 +1136,7 @@ public class PacketHandlerServer{
return;
JobSpawner job = (JobSpawner) npc.jobInterface;
job.setJobCompound(buffer.readInt(), null);
PacketUtil.sendGuiData(player, job.getTitles());
GuiDataPacket.sendGuiData(player, job.getTitles());
}
else if(type == EnumPacketServer.RoleSave){
npc.roleInterface.readFromNBT(ByteBufUtils.readNBT(buffer));
@@ -1143,7 +1147,7 @@ public class PacketHandlerServer{
return;
NBTTagCompound compound = new NBTTagCompound();
compound.setBoolean("RoleData", true);
PacketUtil.sendGuiData(player, npc.roleInterface.writeToNBT(compound));
GuiDataPacket.sendGuiData(player, npc.roleInterface.writeToNBT(compound));
}
else if(type == EnumPacketServer.MerchantUpdate){
Entity entity = player.worldObj.getEntityByID(buffer.readInt());
@@ -1169,7 +1173,7 @@ public class PacketHandlerServer{
npc.updateAI = true;
}
else if(type == EnumPacketServer.TransformGet){
PacketUtil.sendGuiData(player, npc.transform.writeOptions(new NBTTagCompound()));
GuiDataPacket.sendGuiData(player, npc.transform.writeOptions(new NBTTagCompound()));
}
else if(type == EnumPacketServer.TransformLoad){
if(npc.transform.isValid())
@@ -1193,20 +1197,20 @@ public class PacketHandlerServer{
else if(type == EnumPacketServer.AnimationGet){
Animation animation = (Animation) AnimationController.getInstance().get(buffer.readInt());
NBTTagCompound compound = animation.writeToNBT();
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.AnimationRemove){
AnimationController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendAnimationDataAll(player);
NBTTagCompound compound = (new Animation()).writeToNBT();
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.AnimationSave){
Animation animation = new Animation();
animation.readFromNBT(ByteBufUtils.readNBT(buffer));
AnimationController.getInstance().saveAnimation(animation);
NoppesUtilServer.sendAnimationDataAll(player);
PacketUtil.sendGuiData(player, animation.writeToNBT());
GuiDataPacket.sendGuiData(player, animation.writeToNBT());
}
else
blockPackets(type, buffer, player);
@@ -1235,7 +1239,7 @@ public class PacketHandlerServer{
compound.setTag("List", list);
compound.setTag("ListDate", listDate);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else
warn(player,"WE 1 tried todo something with the wrong tool, probably a hacker");
@@ -1291,7 +1295,7 @@ public class PacketHandlerServer{
boolean bo = ServerCloneController.Instance.getCloneData(null, ByteBufUtils.readString(buffer), buffer.readInt()) != null;
NBTTagCompound compound = new NBTTagCompound();
compound.setBoolean("NameExists", bo);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.CloneSave){
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
@@ -1323,7 +1327,7 @@ public class PacketHandlerServer{
compound.setTag("List", list);
compound.setTag("ListDate", listDate);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.CloneList){
NBTTagList list = new NBTTagList();
@@ -1339,14 +1343,14 @@ public class PacketHandlerServer{
compound.setTag("List", list);
compound.setTag("ListDate", listDate);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.CloneTagList) {
int tab = buffer.readInt();
TagMap tagMap = ServerTagMapController.Instance.getTagMap(tab);
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("CloneTags", tagMap.writeNBT());
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.CloneAllTags) {
NBTTagCompound compound = new NBTTagCompound();
@@ -1358,7 +1362,7 @@ public class PacketHandlerServer{
validTagList.appendTag(tagCompound);
}
compound.setTag("AllTags", validTagList);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.CloneAllTagsShort) {
NBTTagCompound compound = new NBTTagCompound();
@@ -1370,7 +1374,7 @@ public class PacketHandlerServer{
validTagList.appendTag(tagCompound);
}
compound.setTag("ShortTags", validTagList);
PacketUtil.sendGuiData(player, compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.TagSet) {
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
@@ -5,15 +5,15 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import kamkeel.npcs.controllers.SyncController;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.enums.EnumSoundOperation;
import kamkeel.npcs.network.enums.EnumSyncAction;
import kamkeel.npcs.network.enums.EnumSyncType;
import kamkeel.npcs.network.packets.client.MarkDataPacket;
import kamkeel.npcs.network.packets.client.SoundManagementPacket;
import kamkeel.npcs.network.packets.client.VillagerListPacket;
import kamkeel.npcs.network.packets.client.large.LargeClonerPacket;
import kamkeel.npcs.network.packets.client.large.LargeSyncPacket;
import kamkeel.npcs.network.packets.data.MarkDataPacket;
import kamkeel.npcs.network.packets.data.SoundManagementPacket;
import kamkeel.npcs.network.packets.data.VillagerListPacket;
import kamkeel.npcs.network.packets.data.gui.GuiOpenPacket;
import kamkeel.npcs.network.packets.data.ClonerPacket;
import kamkeel.npcs.network.packets.data.large.SyncPacket;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -26,7 +26,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
@@ -101,7 +100,7 @@ public class ServerEventsHandler {
return;
PlayerData data = PlayerDataController.Instance.getPlayerData(event.entityPlayer);
ServerCloneController.Instance.cleanTags(compound);
PacketHandler.Instance.sendToPlayer(new LargeClonerPacket(compound), (EntityPlayerMP)event.entityPlayer);
PacketHandler.Instance.sendToPlayer(new ClonerPacket(compound), (EntityPlayerMP)event.entityPlayer);
data.cloned = compound;
if (event.target instanceof EntityNPCInterface) {
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface) event.target);
@@ -113,7 +112,7 @@ public class ServerEventsHandler {
return;
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
event.setCanceled(true);
PacketUtil.openGUI((EntityPlayerMP)event.entityPlayer, EnumGuiType.Script, 0, 0, 0);
GuiOpenPacket.openGUI((EntityPlayerMP)event.entityPlayer, EnumGuiType.Script, 0, 0, 0);
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
}
@@ -199,7 +198,7 @@ public class ServerEventsHandler {
}
if(block == Blocks.crafting_table && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
PacketHandler.Instance.sendToPlayer(new LargeSyncPacket(
PacketHandler.Instance.sendToPlayer(new SyncPacket(
EnumSyncType.WORKBENCH_RECIPES,
EnumSyncAction.RELOAD,
-1,
@@ -207,7 +206,7 @@ public class ServerEventsHandler {
), (EntityPlayerMP) player);
}
if(block == CustomItems.carpentyBench && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
PacketHandler.Instance.sendToPlayer(new LargeSyncPacket(
PacketHandler.Instance.sendToPlayer(new SyncPacket(
EnumSyncType.CARPENTRY_RECIPES,
EnumSyncAction.RELOAD,
-1,
@@ -1,7 +1,7 @@
package noppes.npcs.blocks;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.packets.client.gui.GuiOpenBookPacket;
import kamkeel.npcs.network.packets.data.gui.GuiOpenBookPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
@@ -2,7 +2,7 @@ package noppes.npcs.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.gui.GuiOpenPacket;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -41,7 +41,7 @@ public class BlockMailbox extends BlockContainer{
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!par1World.isRemote){
PacketUtil.openGUI((EntityPlayerMP)player, EnumGuiType.PlayerMailbox, i, j, k);
GuiOpenPacket.openGUI((EntityPlayerMP)player, EnumGuiType.PlayerMailbox, i, j, k);
}
return true;
}
@@ -1,9 +1,29 @@
package noppes.npcs.constants;
public enum EnumPlayerPacket {
FollowerHire,FollowerExtend,Trader, FollowerState, Transport, BankUnlock, BankUpgrade,
Dialog, QuestLog, TrackedQuest, CheckQuestCompletion, BankSlotOpen, FactionsGet,
MailGet, MailDelete, MailSend, MailRead, MailboxOpenMail,
SignSave, SaveBook, CompanionOpenInv, RoleGet, KeyPressed,
MouseClicked, CompanionTalentExp, ScreenSize, MarkData
FollowerHire,
FollowerExtend,
FollowerState,
Transport,
BankUnlock,
BankUpgrade,
Dialog,
QuestLog,
TrackedQuest,
CheckQuestCompletion,
BankSlotOpen,
FactionsGet,
MailGet,
MailDelete,
MailSend,
MailRead,
MailboxOpenMail,
SignSave,
SaveBook,
CompanionOpenInv,
RoleGet,
KeyPressed,
MouseClicked,
CompanionTalentExp,
ScreenSize
}
@@ -2,8 +2,8 @@ package noppes.npcs.controllers;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.client.script.ScriptOverlayDataPacket;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import kamkeel.npcs.network.packets.data.script.ScriptOverlayDataPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -29,13 +29,13 @@ public class CustomGuiController {
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player.getMCEntity();
entityPlayerMP.openGui(CustomNpcs.instance, EnumGuiType.CustomGui.ordinal(), player.getWorld().getMCWorld(), gui.getSlots().size(), 0, 0);
((ContainerCustomGui)((EntityPlayerMP)player.getMCEntity()).openContainer).setGui(gui, (EntityPlayer)player.getMCEntity());
PacketUtil.sendGuiData((EntityPlayerMP)player.getMCEntity(), gui.toNBT());
GuiDataPacket.sendGuiData((EntityPlayerMP)player.getMCEntity(), gui.toNBT());
}
public static boolean updateGui(IPlayer player, ScriptGui gui) {
if (((EntityPlayerMP)player.getMCEntity()).openContainer instanceof ContainerCustomGui) {
((ContainerCustomGui)((EntityPlayerMP)player.getMCEntity()).openContainer).setGui(gui, (EntityPlayer)player.getMCEntity());
PacketUtil.sendGuiData((EntityPlayerMP)player.getMCEntity(), gui.toNBT());
GuiDataPacket.sendGuiData((EntityPlayerMP)player.getMCEntity(), gui.toNBT());
return true;
} else {
return false;
@@ -1,6 +1,8 @@
package noppes.npcs.controllers;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import kamkeel.npcs.network.packets.data.large.PartyDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
@@ -67,8 +69,8 @@ public class PartyController {
playerData.partyUUID = null;
if(player != null){
sendInviteData((EntityPlayerMP) player);
PacketUtil.sendAchievement((EntityPlayerMP) player, true, "party.disbandAlert", "");
PacketUtil.sendChatAlert((EntityPlayerMP) player, "\u00A7c", "party.disbandMessage", "!");
AchievementPacket.sendAchievement((EntityPlayerMP) player, true, "party.disbandAlert", "");
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "\u00A7c", "party.disbandMessage", "!");
}
}
}
@@ -83,14 +85,14 @@ public class PartyController {
for(String name : party.getPlayerNames()){
EntityPlayer playerMP = NoppesUtilServer.getPlayerByName(name);
if(playerMP != null){
PacketUtil.sendAchievement((EntityPlayerMP) playerMP, true, "party.kickOtherAlert", kickPlayerName);
PacketUtil.sendChatAlert((EntityPlayerMP) playerMP, "\u00A7e", kickPlayerName, " \u00A74", "party.kickOtherChat", "!");
AchievementPacket.sendAchievement((EntityPlayerMP) playerMP, true, "party.kickOtherAlert", kickPlayerName);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) playerMP, "\u00A7e", kickPlayerName, " \u00A74", "party.kickOtherChat", "!");
}
}
if(kickPlayer != null){
PacketUtil.sendAchievement((EntityPlayerMP) kickPlayer, true, "party.kickYouAlert", "");
PacketUtil.sendChatAlert((EntityPlayerMP) kickPlayer, "\u00A74", "party.kickYouChat", "!");
AchievementPacket.sendAchievement((EntityPlayerMP) kickPlayer, true, "party.kickYouAlert", "");
ChatAlertPacket.sendChatAlert((EntityPlayerMP) kickPlayer, "\u00A74", "party.kickYouChat", "!");
}
}
@@ -101,12 +103,12 @@ public class PartyController {
for(String name : party.getPlayerNames()){
EntityPlayer playerMP = NoppesUtilServer.getPlayerByName(name);
if(playerMP != null){
PacketUtil.sendAchievement((EntityPlayerMP) playerMP, true, "party.leaveOtherAlert", leavingPlayer.getCommandSenderName());
PacketUtil.sendChatAlert((EntityPlayerMP) playerMP, "\u00A7e", leavingPlayer.getCommandSenderName(), " \u00A7c", "party.leaveOtherChat", "!");
AchievementPacket.sendAchievement((EntityPlayerMP) playerMP, true, "party.leaveOtherAlert", leavingPlayer.getCommandSenderName());
ChatAlertPacket.sendChatAlert((EntityPlayerMP) playerMP, "\u00A7e", leavingPlayer.getCommandSenderName(), " \u00A7c", "party.leaveOtherChat", "!");
}
}
PacketUtil.sendAchievement((EntityPlayerMP) leavingPlayer, true, "party.leaveYouAlert", "");
PacketUtil.sendChatAlert((EntityPlayerMP) leavingPlayer, "\u00A7c", "party.leaveYouChat", "!");
AchievementPacket.sendAchievement((EntityPlayerMP) leavingPlayer, true, "party.leaveYouAlert", "");
ChatAlertPacket.sendChatAlert((EntityPlayerMP) leavingPlayer, "\u00A7c", "party.leaveYouChat", "!");
}
public void pingPartyUpdate(Party party){
@@ -133,7 +135,7 @@ public class PartyController {
if(playerMP != null){
PlayerData playerData = PlayerDataController.Instance.getPlayerData(playerMP);
if(playerData != null){
PacketUtil.sendPartyData((EntityPlayerMP) playerMP, compound);
PartyDataPacket.sendPartyData((EntityPlayerMP) playerMP, compound);
}
}
}
@@ -164,7 +166,7 @@ public class PartyController {
if(playerMP != null){
PlayerData playerData = PlayerDataController.Instance.getPlayerData(playerMP);
if(playerData != null){
PacketUtil.sendPartyData((EntityPlayerMP) playerMP, compound);
PartyDataPacket.sendPartyData((EntityPlayerMP) playerMP, compound);
}
}
}
@@ -182,7 +184,7 @@ public class PartyController {
System.arraycopy(chatAlerts, 0, args, 1, chatAlerts.length);
args[args.length - 1] = "!"; // Add "!" at the end
PacketUtil.sendChatAlert((EntityPlayerMP) playerMP, args);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) playerMP, args);
}
}
}
@@ -1,6 +1,7 @@
package noppes.npcs.controllers;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentTranslation;
@@ -44,8 +45,8 @@ public class PlayerQuestController {
data.activeQuests.put(questData.quest.id,questData);
if (questData.sendAlerts) {
PacketUtil.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", questData.quest.title);
PacketUtil.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", questData.quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", questData.quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", questData.quest.title);
}
playerData.updateClient = true;
} else {
@@ -75,8 +76,8 @@ public class PlayerQuestController {
}
}
if (questData != null && questData.sendAlerts) {
PacketUtil.sendAchievement((EntityPlayerMP) player, false, "quest.completed", questData.quest.title);
PacketUtil.sendChatAlert((EntityPlayerMP) player, "quest.completed", ": ", questData.quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.completed", questData.quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.completed", ": ", questData.quest.title);
}
playerdata.updateClient = true;
}
@@ -97,8 +98,8 @@ public class PlayerQuestController {
}
}
if (questData != null && questData.sendAlerts) {
PacketUtil.sendAchievement((EntityPlayerMP) player, false, "quest.completed", questData.quest.title);
PacketUtil.sendChatAlert((EntityPlayerMP) player, "quest.completed", ": ", questData.quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.completed", questData.quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.completed", ": ", questData.quest.title);
}
playerdata.updateClient = true;
}
@@ -1,6 +1,6 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
@@ -108,7 +108,7 @@ public class BankData {
container.setCurrency(item);
}
PacketUtil.sendGuiData((EntityPlayerMP) player, compound);
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
private ContainerNPCBankInterface getContainer(EntityPlayer player){
Container con = player.openContainer;
@@ -1,7 +1,8 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.addon.DBCAddon;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -265,8 +266,8 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
if (party != null && this.partyUUID == null && !this.partyInvites.contains(party.getPartyUUID())) {
this.partyInvites.add(party.getPartyUUID());
PacketUtil.sendAchievement((EntityPlayerMP) player, true, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
PacketUtil.sendChatAlert((EntityPlayerMP) player, "\u00A7a", "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
AchievementPacket.sendAchievement((EntityPlayerMP) player, true, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "\u00A7a", "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
}
}
@@ -1,8 +1,9 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.client.OverlayQuestTrackingPacket;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import kamkeel.npcs.network.packets.data.OverlayQuestTrackingPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
@@ -219,8 +220,8 @@ public class PlayerQuestData implements IPlayerQuestData {
QuestData questdata = new QuestData(quest);
activeQuests.put(id, questdata);
PacketUtil.sendAchievement((EntityPlayerMP) parent.player, false, "quest.newquest", quest.title);
PacketUtil.sendChatAlert((EntityPlayerMP) parent.player, "quest.newquest", ": ", quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) parent.player, false, "quest.newquest", quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) parent.player, "quest.newquest", ": ", quest.title);
parent.updateClient = true;
}
@@ -1,6 +1,6 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
@@ -139,7 +139,7 @@ public class Quest implements ICompatibilty, IQuest {
public boolean instantComplete(EntityPlayer player, QuestData data) {
if(completion == EnumQuestCompletion.Instant && NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id)){
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
QuestCompletionPacket.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
return true;
}
return false;
@@ -8,12 +8,12 @@ import io.netty.buffer.ByteBuf;
import kamkeel.npcs.addon.DBCAddon;
import kamkeel.npcs.addon.client.DBCClient;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.enums.EnumSoundOperation;
import kamkeel.npcs.network.packets.client.ChatBubblePacket;
import kamkeel.npcs.network.packets.client.SoundManagementPacket;
import kamkeel.npcs.network.packets.client.npc.UpdateNpcPacket;
import kamkeel.npcs.network.packets.client.npc.WeaponNpcPacket;
import kamkeel.npcs.network.packets.data.ChatBubblePacket;
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
import kamkeel.npcs.network.packets.data.SoundManagementPacket;
import kamkeel.npcs.network.packets.data.npc.UpdateNpcPacket;
import kamkeel.npcs.network.packets.data.npc.WeaponNpcPacket;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -454,7 +454,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
else if (data != null){
NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id);
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
QuestCompletionPacket.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
}
else if (dialog != null){
NoppesUtilServer.openDialog(player, this, dialog, 0);
@@ -1,8 +1,10 @@
package noppes.npcs.scripted.entity;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.PacketUtil;
import kamkeel.npcs.network.packets.client.script.ScriptOverlayClosePacket;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import kamkeel.npcs.network.packets.data.gui.GuiClosePacket;
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
@@ -265,8 +267,8 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
QuestData questdata = new QuestData(quest);
data.questData.activeQuests.put(id, questdata);
PacketUtil.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", quest.title);
PacketUtil.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", quest.title);
data.updateClient = true;
}
@@ -758,7 +760,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public void closeGui() {
((EntityPlayerMP)this.entity).closeContainer();
PacketUtil.closeGUI(player, -1 , new NBTTagCompound());
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
}
public void showCustomOverlay(ICustomOverlay overlay) {