LeviLamina
Loading...
Searching...
No Matches
Packet.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/SubClientId.h"
7#include "mc/deps/raknet/PacketPriority.h"
8#include "mc/network/Compressibility.h"
9#include "mc/network/MinecraftPacketIds.h"
10#include "mc/network/NetworkPeer.h"
11#include "mc/platform/Result.h"
12
13// auto generated forward declare list
14// clang-format off
15class BinaryStream;
18// clang-format on
19
20class Player;
21class Actor;
22class BlockPos;
25
26class Packet {
27public:
28 [[nodiscard]] constexpr explicit Packet(
29 PacketPriority priority = PacketPriority::MediumPriority,
30 NetworkPeer::Reliability reliability = NetworkPeer::Reliability::ReliableOrdered,
31 SubClientId clientSubId = SubClientId::PrimaryClient,
32 bool compress = true
33 )
34 : mPriority(priority),
35 mReliability(reliability),
36 mClientSubId(clientSubId),
37 mCompressible(compress ? Compressibility::Compressible : Compressibility::Incompressible) {}
38
44 LLAPI void sendTo(Player const& player) const;
45
52 LLAPI void sendTo(BlockPos const& pos, DimensionType dimId, optional_ref<Player const> except = std::nullopt) const;
53
60 LLAPI void sendTo(Actor const& actor, optional_ref<Player const> except = std::nullopt) const;
61
68 LLAPI void sendToClient(NetworkIdentifier const& identifier, ::SubClientId clientId) const;
69
70 LLAPI void sendToClient(NetworkIdentifierWithSubId const& identifierWithSubId) const;
71
75 LLAPI void sendToClients() const;
76
77 LLAPI void sendToClients(NetworkIdentifier const& exceptId, ::SubClientId exceptSubid) const;
78
79public:
80 // member variables
81 // NOLINTBEGIN
82 ::PacketPriority mPriority;
83 ::NetworkPeer::Reliability mReliability;
84 ::SubClientId mClientSubId;
85 bool mIsHandled;
86 ::std::chrono::steady_clock::time_point mReceiveTimepoint;
87 ::IPacketHandlerDispatcher const* mHandler;
88 ::Compressibility mCompressible;
89 // NOLINTEND
90
91public:
92 // virtual functions
93 // NOLINTBEGIN
94 // vIndex: 0
95 virtual ~Packet();
96
97 // vIndex: 1
98 virtual ::MinecraftPacketIds getId() const = 0;
99
100 // vIndex: 2
101 virtual ::std::string getName() const = 0;
102
103 // vIndex: 3
104 virtual ::Bedrock::Result<void> checkSize(uint64 packetSize, bool receiverIsServer) const;
105
106 // vIndex: 4
107 virtual void write(::BinaryStream&) const = 0;
108
109 // vIndex: 5
110 virtual ::Bedrock::Result<void> read(::ReadOnlyBinaryStream& bitStream);
111
112 // vIndex: 6
113 virtual bool disallowBatching() const;
114
115 // vIndex: 7
116 virtual bool isValid() const;
117
118 // vIndex: 8
119 virtual ::Bedrock::Result<void> _read(::ReadOnlyBinaryStream&) = 0;
120 // NOLINTEND
121
122public:
123 // member functions
124 // NOLINTBEGIN
125 MCAPI ::Bedrock::Result<void> readNoHeader(::ReadOnlyBinaryStream& bitstream, ::SubClientId const& subid);
126 // NOLINTEND
127
128public:
129 // destructor thunk
130 // NOLINTBEGIN
131 MCFOLD void $dtor();
132 // NOLINTEND
133
134public:
135 // virtual function thunks
136 // NOLINTBEGIN
137 MCAPI ::Bedrock::Result<void> $checkSize(uint64 packetSize, bool receiverIsServer) const;
138
139 MCAPI ::Bedrock::Result<void> $read(::ReadOnlyBinaryStream& bitStream);
140
141 MCFOLD bool $disallowBatching() const;
142
143 MCFOLD bool $isValid() const;
144 // NOLINTEND
145
146public:
147 // vftables
148 // NOLINTBEGIN
149 MCAPI static void** $vftable();
150 // NOLINTEND
151};
Definition Actor.h:104
Definition AutomaticID.h:6
Definition BinaryStream.h:10
Definition BlockPos.h:18
Definition IPacketHandlerDispatcher.h:12
Definition NetworkIdentifier.h:11
Definition Packet.h:26
LLAPI void sendTo(Player const &player) const
LLAPI void sendToClient(NetworkIdentifier const &identifier, ::SubClientId clientId) const
LLAPI void sendTo(BlockPos const &pos, DimensionType dimId, optional_ref< Player const > except=std::nullopt) const
LLAPI void sendToClients() const
LLAPI void sendTo(Actor const &actor, optional_ref< Player const > except=std::nullopt) const
Definition Player.h:119
Definition ReadOnlyBinaryStream.h:8
Definition optional_ref.h:10
Definition NetworkIdentifierWithSubId.h:14