Get NPC Role packet

This commit is contained in:
somehussar committed 2025-02-03 04:32:59 +01:00
1 parent a5c3c6768b
commit 10f12ad036
7 files changed
+65 -13

No files matched your search

@@ -357,6 +357,8 @@ public class PacketHandler {
PLAYER_PACKET.registerPacket(new CompanionActionPacket());
PLAYER_PACKET.registerPacket(new GetNPCRole());
PLAYER_PACKET.registerPacket(new InputDevicePacket());
PLAYER_PACKET.registerPacket(new ScreenSizePacket());
@@ -10,8 +10,8 @@ public enum EnumPlayerPacket {
MailSend,
SaveSign, // TODO
SaveBook, // TODO
CompanionAction, // TODO: OpenInv, TalentExp
GetRole, // TODO
CompanionAction,
GetRole,
InputDevice,
ScreenSize
}
@@ -0,0 +1,47 @@
package kamkeel.npcs.network.packets.player;
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.network.packets.data.large.GuiDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.constants.EnumRoleType;
import java.io.IOException;
public class GetNPCRole extends AbstractPacket {
public static final String packetName = "Player|GetNPCRole";
@Override
public Enum getType() {
return EnumPlayerPacket.GetRole;
}
@Override
public PacketChannel getChannel() {
return PacketHandler.PLAYER_PACKET;
}
@Override
public boolean needsNPC() {
return true;
}
@Override
public void sendData(ByteBuf out) throws IOException {
}
@Override
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
if(!(player instanceof EntityPlayerMP))
return;
if (npc.advanced.role == EnumRoleType.None)
return;
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.roleInterface.writeToNBT(new NBTTagCompound()));
}
}