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/SubChunkStorage.h"
8#include "mc/world/level/chunk/sub_chunk_storage_unit/PruneType.h"
9
10// auto generated forward declare list
11// clang-format off
12class Block;
13class BlockPalette;
14class BlockPos;
15class BlockVolume;
16class IDataInput;
17class IDataOutput;
18class SpinLockImpl;
20class 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 SubChunk();
72
73public:
74 // member functions
75 // NOLINTBEGIN
76 MCAPI
77 SubChunk(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
78
79 MCAPI void _createBlockLightStorage();
80
81 MCAPI void _createSkyLightStorage();
82
83 MCAPI void _resetLight(bool maxSkyLight, bool maxLight);
84
85 MCAPI void _setBlock(uchar layer, ushort index, ::Block const& block);
86
87 MCAPI void deserialize(
88 ::IDataInput& stream,
89 ::BlockPalette const& palette,
90 ::SubChunkPos const& subChunkPos,
91 ::std::optional<::DeserializationChanges*> deserializationChanges
92 );
93
94 MCAPI void fetchBlocks(
95 ::BlockPos const& subChunkOrigin,
96 ::BlockPos const& volumeOrigin,
97 short dimensionMinHeight,
98 ::BlockVolume& volume
99 ) const;
100
101 MCAPI bool isUniform(::Block const& block) const;
102
103 MCAPI ::SubChunk& operator=(::SubChunk&& rhs);
104
105 MCAPI void prune(::SubChunkStorageUnit::PruneType pruneType);
106
107 MCAPI ::std::string recalculateHashAndSerialize(bool network);
108
109 MCAPI void reset(::Block const* resetBlock, bool maxSkyLight, bool fullyLit);
110
111 MCAPI void serialize(::IDataOutput& stream, bool network) const;
112
113 MCAPI void setBlocksToUniform(::Block const& initBlock, bool maxSkyLight, bool fullyLit);
114
115 MCAPI void setFromBlockVolume(::BlockVolume const& box, short height);
116
117 MCAPI void setSkyLight(ushort index, uchar lightValue);
118
119 MCAPI ~SubChunk();
120 // NOLINTEND
121
122public:
123 // static functions
124 // NOLINTBEGIN
125 MCAPI static void flushGarbageCollectors();
126 // NOLINTEND
127
128public:
129 // constructor thunks
130 // NOLINTBEGIN
131 MCAPI void*
132 $ctor(::Block const* initBlock, bool maxSkyLight, bool fullyLit, ::SpinLockImpl& spinLock, schar absoluteIndex);
133 // NOLINTEND
134
135public:
136 // destructor thunk
137 // NOLINTBEGIN
138 MCAPI void $dtor();
139 // NOLINTEND
140};
Definition BlockPalette.h:18
Definition BlockPos.h:18
Definition BlockVolume.h:13
Definition Block.h:38
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 SubChunk.h:24
Definition serialize.h:11