12class RuntimePacket final :
public ::Packet {
15 std::unique_ptr<ll::network::Packet> ownedPacket;
17 PacketRuntimeId runtimeId{};
20 runtimeId = packet.getRuntimeId();
21 mReliability = packet.mReliability;
22 mPriority = packet.mPriority;
23 mCompressible = packet.mCompressible;
24 mSenderSubId = packet.mSenderSubId;
28 RuntimePacket() =
default;
30 RuntimePacket(std::unique_ptr<ll::network::Packet> packet)
31 : ownedPacket(std::move(packet)),
32 packet(ownedPacket.get()) {
34 runtimeId = packet->getRuntimeId();
35 mReliability = packet->mReliability;
36 mPriority = packet->mPriority;
37 mCompressible = packet->mCompressible;
38 mSenderSubId = packet->mSenderSubId;
42 [[nodiscard]]
constexpr PacketRuntimeId getRuntimeId()
const {
return runtimeId; }
44 [[nodiscard]]
bool isOwned()
const {
return ownedPacket !=
nullptr; }
45 [[nodiscard]]
constexpr bool hasPacket()
const {
return packet.has_value(); }
51 [[nodiscard]]
constexpr void movePacket(std::unique_ptr<ll::network::Packet> newPacket) {
52 ownedPacket = std::move(newPacket);
53 packet = ownedPacket.get();
56 [[nodiscard]]
constexpr std::unique_ptr<ll::network::Packet> releasePacket() {
58 return std::move(ownedPacket);
62 [[nodiscard]] MinecraftPacketIds getId()
const override;
63 [[nodiscard]] std::string getName()
const override;