LeviLamina
Loading...
Searching...
No Matches
WorldGenerator.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/buffer_span.h"
7#include "mc/platform/threading/Mutex.h"
8#include "mc/world/level/ChunkPos.h"
9#include "mc/world/level/DividedPos2d.h"
10#include "mc/world/level/chunk/ChunkSource.h"
11#include "mc/world/level/levelgen/v1/IPreliminarySurfaceProvider.h"
12
13// auto generated forward declare list
14// clang-format off
15class Biome;
16class BiomeArea;
17class BiomeSource;
18class BlockPos;
19class BlockSource;
20class BlockVolume;
22class BoundingBox;
23class Dimension;
24class HashedString;
25class LevelChunk;
26class Random;
29// clang-format on
30
31class WorldGenerator : public ::ChunkSource, public ::IPreliminarySurfaceProvider {
32public:
33 // WorldGenerator inner types declare
34 // clang-format off
36 // clang-format on
37
38 // WorldGenerator inner types define
40 public:
41 // member variables
42 // NOLINTBEGIN
43 ::ll::TypedStorage<4, 4, uint> mWidth;
44 ::ll::TypedStorage<4, 4, uint> mDepth;
45 ::ll::TypedStorage<4, 4, uint> mHeight;
46 // NOLINTEND
47 };
48
49public:
50 // member variables
51 // NOLINTBEGIN
52 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::StructureFeatureRegistry>> mStructureFeatureRegistry;
53 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mCreateStructuresAndVisitedPositionsMutex;
54 ::ll::TypedStorage<8, 72, ::std::condition_variable> mStructureInstanceWaitVar;
55 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mActiveStructureInstanceCreateCount;
56 ::ll::TypedStorage<8, 64, ::std::unordered_set<::ChunkPos>> mVisitedPositions;
57 // NOLINTEND
58
59public:
60 // prevent constructor by default
61 WorldGenerator();
62
63public:
64 // virtual functions
65 // NOLINTBEGIN
66 virtual ~WorldGenerator() /*override*/;
67
68 virtual ::HashedString findStructureFeatureTypeAt(::BlockPos const& pos);
69
70 virtual bool isStructureFeatureTypeAt(::BlockPos const& pos, ::HashedString type) const;
71
72 virtual bool findNearestStructureFeature(
73 ::HashedString feature,
74 ::BlockPos const& origin,
75 ::BlockPos& pos,
76 bool mustBeInNewChunks,
77 ::std::optional<::HashedString> biomeTag
78 );
79
80 virtual ::StructureFeature* getStructureFeatureOfType(::HashedString type) const;
81
82 virtual void garbageCollectBlueprints(::buffer_span<::ChunkPos> activeChunks);
83
84 virtual void prepareHeights(
85 ::BlockVolume& box,
86 ::ChunkPos const& chunkPos,
87 ::std::vector<short>* ZXheights,
88 bool factorInBeardsAndShavers
89 ) = 0;
90
91 virtual ::BiomeArea getBiomeArea(::BoundingBox const& area, uint scale) const = 0;
92
93 virtual ::BiomeSource const& getBiomeSource() const = 0;
94
95 virtual ::WorldGenerator::BlockVolumeDimensions getBlockVolumeDimensions() const = 0;
96
97 virtual ::BlockPos findSpawnPosition() const = 0;
98
99 virtual void
100 postProcessMobsAt(::BlockSource& region, int chunkWestBlock, int chunkNorthBlock, ::Random& random) /*override*/;
101
102 virtual void postProcessMobsAt(::BlockSource& region, ::BoundingBox const& chunkBB) const /*override*/;
103
104 virtual ::std::optional<short> getPreliminarySurfaceLevel(::DividedPos2d<4> worldQuartPos) const /*override*/;
105
106 virtual void debugRender();
107
108 virtual void propagateCombinedChunkSource(::ChunkSource* chunkSource);
109
110 virtual void decorateWorldGenLoadChunk(
111 ::Biome const& biome,
112 ::LevelChunk& lc,
113 ::BlockVolumeTarget& target,
114 ::Random& random,
115 ::ChunkPos const& pos
116 ) const = 0;
117
118 virtual void decorateWorldGenPostProcess(
119 ::Biome const& biome,
120 ::LevelChunk& lc,
121 ::BlockSource& source,
122 ::Random& random
123 ) const = 0;
124 // NOLINTEND
125
126public:
127 // member functions
128 // NOLINTBEGIN
129 MCAPI explicit WorldGenerator(::Dimension& dimension);
130
131 MCAPI
132 WorldGenerator(::Dimension& dimension, ::std::unique_ptr<::StructureFeatureRegistry> structureFeatureRegistry);
133
134 MCAPI void addHardcodedSpawnAreas(::LevelChunk& lc);
135
136 MCAPI ::std::vector<short> computeChunkHeightMap(::ChunkPos const& pos);
137
138 MCFOLD ::StructureFeatureRegistry& getStructureFeatureRegistry() const;
139
140 MCAPI void postProcessStructureFeatures(::BlockSource& region, ::Random& random, int chunkX, int chunkZ);
141
142 MCAPI void postProcessStructures(::BlockSource& region, ::Random& chunkX, int chunkZ, int);
143
144 MCAPI void preProcessStructures(::Dimension& dimension, ::ChunkPos const& cp, ::BiomeSource const& biomeSource);
145
146 MCAPI void prepareStructureFeatureBlueprints(
147 ::Dimension& dimension,
148 ::ChunkPos const& cp,
149 ::BiomeSource const& biomeSource,
150 ::IPreliminarySurfaceProvider const& preliminarySurfaceProvider
151 );
152
153 MCAPI void tick();
154
155 MCAPI void waitForStructures();
156 // NOLINTEND
157
158public:
159 // static variables
160 // NOLINTBEGIN
161 MCAPI static uint64 const& TICKING_QUEUE_PASS_LIMIT();
162 // NOLINTEND
163
164public:
165 // constructor thunks
166 // NOLINTBEGIN
167 MCAPI void* $ctor(::Dimension& dimension);
168
169 MCAPI void* $ctor(::Dimension& dimension, ::std::unique_ptr<::StructureFeatureRegistry> structureFeatureRegistry);
170 // NOLINTEND
171
172public:
173 // destructor thunk
174 // NOLINTBEGIN
175 MCAPI void $dtor();
176 // NOLINTEND
177
178public:
179 // virtual function thunks
180 // NOLINTBEGIN
181 MCAPI ::HashedString $findStructureFeatureTypeAt(::BlockPos const& pos);
182
183 MCAPI bool $isStructureFeatureTypeAt(::BlockPos const& pos, ::HashedString type) const;
184
185 MCAPI bool $findNearestStructureFeature(
186 ::HashedString feature,
187 ::BlockPos const& origin,
188 ::BlockPos& pos,
189 bool mustBeInNewChunks,
190 ::std::optional<::HashedString> biomeTag
191 );
192
193 MCAPI ::StructureFeature* $getStructureFeatureOfType(::HashedString type) const;
194
195 MCAPI void $garbageCollectBlueprints(::buffer_span<::ChunkPos> activeChunks);
196
197 MCAPI void $postProcessMobsAt(::BlockSource& region, int chunkWestBlock, int chunkNorthBlock, ::Random& random);
198
199 MCAPI void $postProcessMobsAt(::BlockSource& region, ::BoundingBox const& chunkBB) const;
200
201 MCAPI ::std::optional<short> $getPreliminarySurfaceLevel(::DividedPos2d<4> worldQuartPos) const;
202
203 MCFOLD void $debugRender();
204
205 MCFOLD void $propagateCombinedChunkSource(::ChunkSource* chunkSource);
206
207
208 // NOLINTEND
209
210public:
211 // vftables
212 // NOLINTBEGIN
214
215 MCNAPI static void** $vftableForChunkSource();
216 // NOLINTEND
217};
Definition BiomeArea.h:11
Definition BiomeSource.h:24
Definition Biome.h:24
Definition BlockPos.h:21
Definition BlockSource.h:72
Definition BlockVolumeTarget.h:27
Definition BlockVolume.h:14
Definition BoundingBox.h:13
Definition ChunkPos.h:11
Definition Dimension.h:88
Definition DividedPos2d.h:7
Definition HashedString.h:5
Definition IPreliminarySurfaceProvider.h:8
Definition LevelChunk.h:87
Definition Random.h:10
Definition StructureFeatureRegistry.h:19
Definition StructureFeature.h:26
static MCAPI void ** $vftableForChunkSource()
static MCAPI void ** $vftableForIPreliminarySurfaceProvider()
Definition buffer_span.h:6
Definition WorldGenerator.h:39