mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Reorg -- Data Packets designed to send to Client
This commit is contained in:
1 parent
da9ed1d60f
commit
db2144116f
65 files changed
+459
-474
No files matched your search
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user