29 enum class BlockLayer : uchar {
35 enum class SubChunkState :
int {
38 IsLightingSystemSubChunk = 1,
40 ReceivedResponseFromServer = 3,
41 ProcessingSubChunk = 4,
42 WaitingForCacheResponse = 5,
43 ProcessedSubChunk = 6,
52 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mDirtyTicksCounter;
53 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SubChunkBrightnessStorage>> mSkyLight;
54 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SubChunkBrightnessStorage>> mBlockLight;
55 ::ll::TypedStorage<4, 4, ::SubChunk::SubChunkState> mSubChunkState;
56 ::ll::TypedStorage<1, 1, bool> mHasMaxSkyLight;
57 ::ll::TypedStorage<1, 1, bool> mNeedsInitLighting;
58 ::ll::TypedStorage<1, 1, bool> mNeedsClientLighting;
59 ::ll::TypedStorage<8, 16, ::std::unique_ptr<::SubChunkStorage<::Block>>[2]> mBlocks;
60 ::ll::TypedStorage<8, 16, ::SubChunkStorage<::Block>* [2]> mBlocksReadPtr;
61 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mWriteLock;
62 ::ll::TypedStorage<8, 8, uint64> mHash;
63 ::ll::TypedStorage<1, 1, bool> mHashDirty;
64 ::ll::TypedStorage<1, 1, schar> mAbsoluteIndex;
65 ::ll::TypedStorage<1, 1, bool> mIsReplacementSubChunk;
66 ::ll::TypedStorage<1, 1, uchar> mRenderChunkTrackingVersionNumber;
67 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
71 [[nodiscard]]
bool isUniform(
::Block const& block)
const {
72 if (!mBlocksReadPtr[0]->isUniform(block)) {
76 if (mBlocksReadPtr[1] !=
nullptr) {
77 return mBlocksReadPtr[1]->isUniform(block);
84 SubChunk& operator=(SubChunk
const&);
85 SubChunk(SubChunk
const&);
91 MCAPI SubChunk(::SubChunk&& rhs);
93 MCAPI SubChunk(
::Block const* initBlock,
bool maxSkyLight,
bool maxLight, schar absoluteIndex);
96 MCAPI
void _createBlockLightStorage();
98 MCAPI
void _createSkyLightStorage();
102 MCAPI
void _resetLight(
bool maxSkyLight,
bool maxLight);
105 MCAPI
void _setBlock(uchar layer, ushort index,
::Block const& block);
107 MCAPI
void deserialize(
111 ::std::optional<::DeserializationChanges*> deserializationChanges
114 MCAPI
void fetchBlocks(
117 short dimensionMinHeight,
122 MCAPI
bool isPlaceHolderSubChunk()
const;
125 MCAPI ::SubChunk& operator=(::SubChunk&& rhs);
127 MCAPI
void prune(::SubChunkStorageUnit::PruneType pruneType);
129 MCAPI ::std::string recalculateHashAndSerialize(
bool network);
131 MCAPI
void reset(
::Block const* resetBlock,
bool maxSkyLight,
bool fullyLit);
133 MCAPI
void serialize(
::IDataOutput& stream,
bool network)
const;
136 MCAPI
void setBlockLight(ushort index, uchar lightValue);
139 MCAPI
void setBlocksToUniform(
::Block const& initBlock,
bool maxSkyLight,
bool fullyLit);
141 MCAPI
void setFromBlockVolume(
152 MCAPI
void setSkyLight(ushort index, uchar lightValue);
161 MCAPI
void* $ctor(::SubChunk&& rhs);
163 MCAPI
void* $ctor(
::Block const* initBlock,
bool maxSkyLight,
bool maxLight, schar absoluteIndex);