Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
NetworkChunkPublisher.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/network/NetworkIdentifier.h"
8#include "mc/server/ChunkPositionAndDimension.h"
9#include "mc/server/ClientGenerationRequestHandler.h"
10#include "mc/world/level/BlockPos.h"
11
12// auto generated forward declare list
13// clang-format off
14class ChunkPos;
15class ChunkSource;
16class ChunkViewSource;
17class ILevel;
18class LevelChunk;
22class Vec3;
23namespace ClientBlobCache::Server { class ActiveTransfersManager; }
24namespace ClientBlobCache::Server { class TransferBuilder; }
25// clang-format on
26
27class NetworkChunkPublisher {
28public:
29 // member variables
30 // NOLINTBEGIN
31 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
32 ::ll::TypedStorage<8, 8, ::ServerNetworkSystem*> mNetwork;
33 ::ll::TypedStorage<8, 176, ::NetworkIdentifier> mOwner;
34 ::ll::TypedStorage<8, 8, ::ClientBlobCache::Server::ActiveTransfersManager*> mClientCache;
35 ::ll::TypedStorage<1, 1, ::SubClientId> mSubClientId;
36 ::ll::TypedStorage<4, 12, ::BlockPos> mLastChunkUpdatePosition;
37 ::ll::TypedStorage<4, 4, uint> mLastChunkUpdateRadius;
38 ::ll::TypedStorage<4, 4, uint> mHandleForChunkBuildOrderUpdates;
39 ::ll::TypedStorage<4, 4, int> mChunksSentSinceStart;
40 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ChunkViewSource>> mSource;
41 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ChunkSource>> mNetworkChunkSource;
42 ::ll::TypedStorage<8, 64, ::std::function<void(::gsl::span<::std::shared_ptr<::LevelChunk>>)>> mAddCallback;
43 ::ll::TypedStorage<8, 32, ::std::string> mCacheSerializeBuffer;
44 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ChunkPositionAndDimension, ::std::weak_ptr<::LevelChunk>>>
45 mQueuedChunks;
46 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastGenerationRequestQueued;
47 ::ll::TypedStorage<1, 1, bool> mWaitingForServerChunks;
48 ::ll::TypedStorage<1, 1, bool> mInitialSpawnDone;
49 ::ll::TypedStorage<
50 8,
51 40,
52 ::std::queue<::ClientGenerationRequestHandler, ::std::deque<::ClientGenerationRequestHandler>>>
53 mGenerationRequests;
54 // NOLINTEND
55
56public:
57 // prevent constructor by default
58 NetworkChunkPublisher& operator=(NetworkChunkPublisher const&);
59 NetworkChunkPublisher(NetworkChunkPublisher const&);
60 NetworkChunkPublisher();
61
62public:
63 // virtual functions
64 // NOLINTBEGIN
65 virtual ~NetworkChunkPublisher() = default;
66 // NOLINTEND
67
68public:
69 // member functions
70 // NOLINTBEGIN
71 MCNAPI NetworkChunkPublisher(::ILevel& level, ::NetworkIdentifier const& owner, ::SubClientId subClientId);
72
73 MCAPI bool _sendQueuedChunk(
74 ::ChunkPositionAndDimension const& queuedChunk,
76 );
77
78 MCNAPI void _serializeAndCache(
79 ::LevelChunkPacket& packet,
81 ::std::function<void(::VarIntDataOutput&)>&& serialize
82 );
83
84 MCNAPI void addChunksToQueue(::std::vector<::ChunkPos> const& chunkPositions, bool isBiomeUpdate);
85
86 MCAPI void clearRegion();
87
88 MCNAPI void destroyRegion();
89
90#ifdef LL_PLAT_C
91 MCNAPI void handleGenerationRequests();
92#endif
93
94 MCNAPI void moveRegion(
95 ::BlockPos const& position,
96 uint blockRadius,
97 ::Vec3 const& direction,
98 bool notifyBroadcastSounds,
99 float minDistance
100 );
101
102 MCNAPI void prepareRegion(::ChunkSource& mainChunkSource, ::ChunkPos const& center);
103
104#ifdef LL_PLAT_C
105 MCNAPI void queueChunkGenerationRequests(
106 ::ChunkPos moveCenter,
107 int chunkRadius,
108 ::Vec3 const& direction,
109 ::std::vector<::ChunkPos> const& serverChunks
110 );
111#endif
112
113 MCNAPI void sendQueuedChunks();
114
115#ifdef LL_PLAT_C
116 MCNAPI void setClientsNetworkChunkSource(::std::shared_ptr<::ChunkSource> networkChunkSource);
117#endif
118 // NOLINTEND
119
120public:
121 // constructor thunks
122 // NOLINTBEGIN
123 MCNAPI void* $ctor(::ILevel& level, ::NetworkIdentifier const& owner, ::SubClientId subClientId);
124 // NOLINTEND
125
126public:
127 // vftables
128 // NOLINTBEGIN
129 MCNAPI static void** $vftable();
130 // NOLINTEND
131};
Definition BlockPos.h:14
Definition ChunkPos.h:13
Definition ChunkSource.h:37
Definition ChunkViewSource.h:23
Definition ActiveTransfersManager.h:19
Definition TransferBuilder.h:7
Definition ILevel.h:223
Definition LevelChunkPacket.h:19
Definition LevelChunk.h:76
MCAPI NetworkChunkPublisher(::ILevel &level, ::NetworkIdentifier const &owner, ::SubClientId subClientId)
static MCAPI void ** $vftable()
MCAPI void _serializeAndCache(::LevelChunkPacket &packet, ::ClientBlobCache::Server::TransferBuilder &transfer, ::std::function< void(::VarIntDataOutput &)> &&serialize)
MCAPI void moveRegion(::BlockPos const &position, uint blockRadius, ::Vec3 const &direction, bool notifyBroadcastSounds, float minDistance)
MCAPI void destroyRegion()
MCAPI void prepareRegion(::ChunkSource &mainChunkSource, ::ChunkPos const &center)
MCAPI void * $ctor(::ILevel &level, ::NetworkIdentifier const &owner, ::SubClientId subClientId)
MCAPI void addChunksToQueue(::std::vector<::ChunkPos > const &chunkPositions, bool isBiomeUpdate)
MCAPI void sendQueuedChunks()
Definition NetworkIdentifier.h:10
Definition ServerNetworkSystem.h:34
Definition VarIntDataOutput.h:13
Definition Vec3.h:10
Definition ChunkPositionAndDimension.h:9
Definition serialize.h:11