12class RuntimePacket final :
public ::Packet {
15 std::unique_ptr<ll::network::Packet> mOwnedPacket;
17 PacketRuntimeId mRuntimeId{};
20 mRuntimeId = 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 : mOwnedPacket(std::move(packet)),
32 mPacket(mOwnedPacket.get()) {
34 mRuntimeId = mPacket->getRuntimeId();
35 mReliability = mPacket->mReliability;
36 mPriority = mPacket->mPriority;
37 mCompressible = mPacket->mCompressible;
38 mSenderSubId = mPacket->mSenderSubId;
42 [[nodiscard]]
constexpr PacketRuntimeId getRuntimeId()
const {
return mRuntimeId; }
44 [[nodiscard]]
bool isOwned()
const {
return mOwnedPacket !=
nullptr; }
45 [[nodiscard]]
constexpr bool hasPacket()
const {
return mPacket.has_value(); }
51 constexpr void movePacket(std::unique_ptr<ll::network::Packet> newPacket) {
52 mOwnedPacket = std::move(newPacket);
53 mPacket = mOwnedPacket.get();
56 [[nodiscard]]
constexpr std::unique_ptr<ll::network::Packet> releasePacket() {
58 return std::move(mOwnedPacket);
62 LLNDAPI MinecraftPacketIds getId()
const override;
63 LLNDAPI std::string_view getName()
const override;