LeviLamina
Loading...
Searching...
No Matches
SubChunk.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/level/chunk/DirtyTicksCounter.h"
7#include "mc/world/level/chunk/SubChunkBrightnessStorage.h"
8#include "mc/world/level/chunk/SubChunkStorage.h"
9#include "mc/world/level/chunk/sub_chunk_storage_unit/PruneType.h"
10
11// auto generated forward declare list
12// clang-format off
13class Block;
14class BlockPalette;
15class BlockPos;
16class BlockVolume;
17class IDataInput;
18class IDataOutput;
19class SpinLockImpl;
21class SubChunkPos;
23// clang-format on
24
25struct SubChunk {
26public:
27 // SubChunk inner types define
28 enum class BlockLayer : uchar {
29 Standard = 0,
30 Extra = 1,
31 Count = 2,
32 };
33
34 enum class SubChunkState : int {
35 Invalid = -1,
36 Normal = 0,
37 IsLightingSystemSubChunk = 1,
38 NeedsRequest = 2,
39 ReceivedResponseFromServer = 3,
40 ProcessingSubChunk = 4,
41 WaitingForCacheResponse = 5,
42 ProcessedSubChunk = 6,
43 RequestFinished = 7,
44 };
45
46 using Layer = uchar;
47
48public:
49 // member variables
50 // NOLINTBEGIN
51 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mDirtyTicksCounter;
52 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SubChunkBrightnessStorage>> mSkyLight;
53 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SubChunkBrightnessStorage>> mBlockLight;
54 ::ll::TypedStorage<4, 4, ::SubChunk::SubChunkState> mSubChunkState;
55 ::ll::TypedStorage<1, 1, bool> mHasMaxSkyLight;
56 ::ll::TypedStorage<1, 1, bool> mNeedsInitLighting;
57 ::ll::TypedStorage<1, 1, bool> mNeedsClientLighting;
58 ::ll::TypedStorage<8, 16, ::std::unique_ptr<::SubChunkStorage<::Block>>[2]> mBlocks;
59 ::ll::TypedStorage<8, 16, ::SubChunkStorage<::Block>* [2]> mBlocksReadPtr;
60 ::ll::TypedStorage<8, 8, ::SpinLockImpl*> mWriteLock;
61 ::ll::TypedStorage<8, 8, uint64> mHash;
62 ::ll::TypedStorage<1, 1, bool> mHashDirty;
63 ::ll::TypedStorage<1, 1, schar> mAbsoluteIndex;
64 ::ll::TypedStorage<1, 1, bool> mIsReplacementSubChunk;
65 ::ll::TypedStorage<1, 1, uchar> mRenderChunkTrackingVersionNumber;
66 // NOLINTEND
67
68public:
69 // prevent constructor by default
70 SubChunk& operator=(SubChunk const&);
71 SubChunk(SubChunk const&);
72 SubChunk();
73
74public:
75 // member functions
76 // NOLINTBEGIN
77#ifdef LL_PLAT_S
78 MCAPI SubChunk(::SubChunk&& rhs);
79
80 MCAPI
81 SubChunk(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
82#endif
83
84#ifdef LL_PLAT_C
85 MCAPI void _createBlockLightStorage();
86
87 MCAPI void _createSkyLightStorage();
88#endif
89
90#ifdef LL_PLAT_S
91 MCAPI void _resetLight(bool maxSkyLight, bool maxLight);
92#endif
93
94 MCAPI void _setBlock(uchar layer, ushort index, ::Block const& block);
95
96 MCAPI void deserialize(
97 ::IDataInput& stream,
98 ::BlockPalette const& palette,
99 ::SubChunkPos const& subChunkPos,
100 ::std::optional<::DeserializationChanges*> deserializationChanges
101 );
102
103 MCAPI void fetchBlocks(
104 ::BlockPos const& subChunkOrigin,
105 ::BlockPos const& volumeOrigin,
106 short dimensionMinHeight,
107 ::BlockVolume& volume
108 ) const;
109
110#ifdef LL_PLAT_C
111 MCAPI bool isPlaceHolderSubChunk() const;
112#endif
113
114 MCAPI ::SubChunk& operator=(::SubChunk&& rhs);
115
116 MCAPI void prune(::SubChunkStorageUnit::PruneType pruneType);
117
118 MCAPI ::std::string recalculateHashAndSerialize(bool network);
119
120 MCAPI void reset(::Block const* resetBlock, bool maxSkyLight, bool fullyLit);
121
122 MCAPI void serialize(::IDataOutput& stream, bool network) const;
123
124#ifdef LL_PLAT_S
125 MCAPI void setBlockLight(ushort index, uchar lightValue);
126#endif
127
128 MCAPI void setBlocksToUniform(::Block const& initBlock, bool maxSkyLight, bool fullyLit);
129
130 MCAPI void setFromBlockVolume(::BlockVolume const& box, short height);
131
132#ifdef LL_PLAT_C
133 MCAPI void setLight(ushort idx, ::SubChunkBrightnessStorage::LightPair pair);
134#endif
135
136#ifdef LL_PLAT_S
137 MCAPI void setSkyLight(ushort index, uchar lightValue);
138#endif
139
140 MCAPI ~SubChunk();
141 // NOLINTEND
142
143public:
144 // constructor thunks
145 // NOLINTBEGIN
146#ifdef LL_PLAT_S
147 MCAPI void* $ctor(::SubChunk&& rhs);
148
149 MCAPI void*
150 $ctor(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
151#endif
152 // NOLINTEND
153
154public:
155 // destructor thunk
156 // NOLINTBEGIN
157 MCAPI void $dtor();
158 // NOLINTEND
159};
Definition BlockPalette.h:19
Definition BlockPos.h:21
Definition BlockVolume.h:14
Definition Block.h:41
Definition IDataInput.h:8
Definition IDataOutput.h:5
Definition SpinLockImpl.h:5
Definition SubChunkBrightnessStorage.h:5
Definition SubChunkPos.h:5
Definition DeserializationChanges.h:14
Definition SubChunkBrightnessStorage.h:13