mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 19:42:19 +00:00
Merge branch 'packet' of https://github.com/KAMKEEL/CustomNPC-Plus into packet
This commit is contained in:
commit
b5d294dd20
8 files changed
+87
-22
No files matched your search
@@ -16,6 +16,7 @@ import kamkeel.npcs.network.packets.data.npc.*;
|
||||
import kamkeel.npcs.network.packets.data.script.*;
|
||||
import kamkeel.npcs.network.packets.player.BankPacket;
|
||||
import kamkeel.npcs.network.packets.player.FollowerPacket;
|
||||
import kamkeel.npcs.network.packets.player.TransportPacket;
|
||||
import kamkeel.npcs.network.packets.request.*;
|
||||
import kamkeel.npcs.network.packets.request.animation.*;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
@@ -323,6 +324,8 @@ public class PacketHandler {
|
||||
public void registerPlayerPackets() {
|
||||
PLAYER_PACKET.registerPacket(new FollowerPacket());
|
||||
|
||||
PLAYER_PACKET.registerPacket(new TransportPacket());
|
||||
|
||||
PLAYER_PACKET.registerPacket(new BankPacket());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,21 @@ package kamkeel.npcs.network.enums;
|
||||
|
||||
public enum EnumPlayerPacket {
|
||||
FollowerAction,
|
||||
Transport, // TODO
|
||||
Transport,
|
||||
BankAction,
|
||||
Dialog, // TODO
|
||||
QuestLog, // TODO
|
||||
TrackedQuest, // TODO
|
||||
CheckQuestCompletion, // TODO
|
||||
|
||||
FactionsGet, // TODO
|
||||
MailAction, // TODO: Get, Delete, Send, Read, OpenMail
|
||||
SaveSign, // TODO
|
||||
SaveBook, // TODO
|
||||
Companion, // TODO: OpenInv, TalentExp
|
||||
RoleGet, // TODO
|
||||
KeyPressed, // TODO
|
||||
MouseClicked, // TODO
|
||||
ScreenSize; // TODO
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,16 +10,14 @@ import kamkeel.npcs.network.enums.EnumPlayerPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.BankData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BankPacket extends AbstractPacket {
|
||||
public static final String packetName = "Player|Follower";
|
||||
public static final String packetName = "Player|Bank";
|
||||
|
||||
private Action type;
|
||||
private int slotID;
|
||||
@@ -63,8 +61,6 @@ public class BankPacket extends AbstractPacket {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
if (type == null)
|
||||
return;
|
||||
out.writeInt(type.ordinal());
|
||||
|
||||
if (type == Action.OpenSlot) {
|
||||
|
||||
@@ -12,9 +12,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package kamkeel.npcs.network.packets.player;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumPlayerPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TransportPacket extends AbstractPacket {
|
||||
public static final String packetName = "Player|Transport";
|
||||
|
||||
private String destination;
|
||||
|
||||
public TransportPacket() {
|
||||
|
||||
}
|
||||
|
||||
public TransportPacket(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumPlayerPacket.Transport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.PLAYER_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeString(out, destination);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (npc.advanced.role != EnumRoleType.Transporter)
|
||||
return;
|
||||
NoppesUtilPlayer.transport((EntityPlayerMP) player, npc, ByteBufUtils.readString(in));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user