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