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<1, 1, bool> mHasMaxSkyLight;
55 ::ll::TypedStorage<4, 4, ::SubChunk::SubChunkState> mSubChunkState;
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 MCAPI
78 SubChunk(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
79
80 MCAPI void _createBlockLightStorage();
81
82 MCAPI void _createSkyLightStorage();
83
84 MCAPI void _resetLight(bool maxSkyLight, bool maxLight);
85
86 MCAPI void _setBlock(uchar layer, ushort index, ::Block const& block);
87
88 MCAPI void deserialize(
89 ::IDataInput& stream,
90 ::BlockPalette const& palette,
91 ::SubChunkPos const& subChunkPos,
92 ::std::optional<::DeserializationChanges*> deserializationChanges
93 );
94
95 MCAPI void fetchBlocks(
96 ::BlockPos const& subChunkOrigin,
97 ::BlockPos const& volumeOrigin,
98 short dimensionMinHeight,
99 ::BlockVolume& volume
100 ) const;
101
102 MCAPI_C ::SubChunkBrightnessStorage::LightPair getLight(ushort idx) const;
103
104 MCAPI_C bool isPlaceHolderSubChunk() const;
105
106 MCAPI bool isUniform(::Block const& block) const;
107
108 MCAPI ::SubChunk& operator=(::SubChunk&& rhs);
109
110 MCAPI void prune(::SubChunkStorageUnit::PruneType pruneType);
111
112 MCAPI ::std::string recalculateHashAndSerialize(bool network);
113
114 MCAPI void reset(::Block const* resetBlock, bool maxSkyLight, bool fullyLit);
115
116 MCAPI void serialize(::IDataOutput& stream, bool network) const;
117
118 MCAPI void setBlocksToUniform(::Block const& initBlock, bool maxSkyLight, bool fullyLit);
119
120 MCAPI void setFromBlockVolume(::BlockVolume const& box, short height);
121
122 MCAPI void setSkyLight(ushort index, uchar lightValue);
123
124 MCAPI ~SubChunk();
125 // NOLINTEND
126
127public:
128 // static functions
129 // NOLINTBEGIN
130 MCAPI static void flushGarbageCollectors();
131 // NOLINTEND
132
133public:
134 // constructor thunks
135 // NOLINTBEGIN
136 MCAPI void*
137 $ctor(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
138 // NOLINTEND
139
140public:
141 // destructor thunk
142 // NOLINTBEGIN
143 MCAPI void $dtor();
144 // NOLINTEND
145};
Definition BlockPalette.h:19
Definition BlockPos.h:19
Definition BlockVolume.h:13
Definition Block.h:43
Definition IDataInput.h:8
Definition IDataOutput.h:5
Definition SpinLockImpl.h:5
Definition SubChunkBrightnessStorage.h:5
Definition SubChunkPos.h:5
Definition DeserializationChanges.h:12