LeviLamina
Loading...
Searching...
No Matches
StructureFeature.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/deps/core/utility/buffer_span.h"
8#include "mc/platform/threading/Mutex.h"
9#include "mc/world/level/ChunkPos.h"
10
11// auto generated forward declare list
12// clang-format off
13class Biome;
14class BiomeSource;
15class BlockPos;
16class BlockSource;
17class BoundingBox;
18class Dimension;
20class LevelChunk;
21class Random;
22class StructureStart;
23struct BiomeIdType;
24// clang-format on
25
26class StructureFeature {
27public:
28 // StructureFeature inner types define
29 using StructureMap = ::std::unordered_map<::ChunkPos, ::std::unique_ptr<::StructureStart>>;
30
31public:
32 // member variables
33 // NOLINTBEGIN
34 ::ll::TypedStorage<8, 48, ::HashedString> mStructureFeatureType;
35 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ChunkPos, ::std::unique_ptr<::StructureStart>>> mCachedStructures;
36 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mCacheMutex;
37 ::ll::TypedStorage<8, 64, ::std::unordered_set<::ChunkPos>> mVisitedPositions;
38 ::ll::TypedStorage<4, 4, uint> mRadius;
39 ::ll::TypedStorage<4, 4, int> mXScale;
40 ::ll::TypedStorage<4, 4, int> mZScale;
41 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mCreateBlueprintsAndVisitedPositionsMutex;
42 ::ll::TypedStorage<8, 72, ::std::condition_variable> mBlueprintWaitVar;
43 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mActiveBlueprintCreateCount;
44 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mBlueprintsFinished;
45 // NOLINTEND
46
47public:
48 // prevent constructor by default
49 StructureFeature();
50
51public:
52 // virtual functions
53 // NOLINTBEGIN
54 virtual ~StructureFeature();
55
56 virtual bool shouldAddHardcodedSpawnAreas() const;
57
58 virtual bool shouldPostProcessMobs() const;
59
60 virtual ::gsl::span<::BiomeIdType const> getRequiredBiomes() const;
61
62 virtual bool getNearestGeneratedFeature(
63 ::Dimension& dimension,
64 ::BiomeSource const& biomeSource,
65 ::BlockPos const& origin,
66 ::BlockPos& pos,
67 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
68 bool mustBeInNewChunks,
69 ::std::optional<::HashedString> const& biomeTag
70 );
71
72 virtual bool isFeatureChunk(
73 ::BiomeSource const& biomeSource,
74 ::Random& random,
75 ::ChunkPos const& pos,
76 uint levelSeed,
77 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
78 ::Dimension const& dimension
79 ) = 0;
80
81 virtual ::std::unique_ptr<::StructureStart> createStructureStart(
82 ::Dimension& generator,
83 ::BiomeSource const& biomeSource,
84 ::Random& random,
85 ::ChunkPos const& lc,
86 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
87 ) = 0;
88
89 virtual ::StructureStart* getStructureAt(int cellX, int cellY, int cellZ);
90 // NOLINTEND
91
92public:
93 // member functions
94 // NOLINTBEGIN
95 MCAPI StructureFeature(uint seed, ::HashedString structureFeatureType);
96
97 MCAPI void addFeature(
98 ::Dimension& dimension,
99 ::Random& random,
100 ::ChunkPos const& cp,
101 ::BiomeSource const& biomeSource,
102 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
103 );
104
105 MCAPI void addHardcodedSpawnAreas(::LevelChunk& lc);
106
107 MCAPI ::BlockPos chunkStartAtSurfaceLevel(
108 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
109 ::ChunkPos pos,
110 int defaultYLevel
111 );
112
113 MCAPI void createBlueprints(
114 ::Dimension& dimension,
115 ::ChunkPos const& cp,
116 ::BiomeSource const& biomeSource,
117 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
118 );
119
120 MCAPI ::std::vector<::ChunkPos> findFarAwayStructures(::buffer_span<::ChunkPos> activeChunks, uint safetyBorder);
121
122 MCAPI void foreachIntersectingStructureStart(::BoundingBox const& bb, ::std::function<void(::StructureStart&)> fn);
123
124 MCAPI void garbageCollectBlueprints(::buffer_span<::ChunkPos> activeChunks, uint safetyBorder);
125
126 MCAPI bool postProcess(::BlockSource& region, ::Random& random, int chunkX, int chunkZ);
127
128 MCAPI void postProcessMobsAt(::BlockSource& region, int chunkWestBlock, int chunkNorthBlock, ::Random& random);
129 // NOLINTEND
130
131public:
132 // static functions
133 // NOLINTBEGIN
134 MCAPI static bool findNearestFeaturePositionBySpacing(
135 ::Dimension& dimension,
136 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
137 ::StructureFeature& feature,
138 ::std::optional<::HashedString> const& biomeTag,
139 ::BiomeSource const& biomeSource,
140 ::BlockPos const& origin,
141 ::BlockPos& result,
142 int featureSpacing,
143 int minFeatureSeparation,
144 int randomSalt,
145 bool tiltedSpacing,
146 int maxSearchRadius,
147 bool mustBeInNewChunks
148 );
149
150 MCAPI static ::std::pair<::BlockPos const, ::Biome const*> getBiomeForFeatureGeneration(
151 ::BiomeSource const& biomeSource,
152 ::ChunkPos const& chunkPos,
153 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
154 );
155
156 MCAPI static ::ChunkPos getChunkPosInSpace(
157 ::ChunkPos const& cp,
158 ::Random& random,
159 uint levelSeed,
160 int spacing,
161 int separation,
162 int salt,
163 bool tiltedSpacing
164 );
165
166 MCAPI static void setRandomSeedFor(::Random& result, int x, int z, int salt, uint levelSeed);
167 // NOLINTEND
168
169public:
170 // constructor thunks
171 // NOLINTBEGIN
172 MCAPI void* $ctor(uint seed, ::HashedString structureFeatureType);
173 // NOLINTEND
174
175public:
176 // destructor thunk
177 // NOLINTBEGIN
178 MCAPI void $dtor();
179 // NOLINTEND
180
181public:
182 // virtual function thunks
183 // NOLINTBEGIN
184 MCFOLD bool $shouldAddHardcodedSpawnAreas() const;
185
186 MCFOLD bool $shouldPostProcessMobs() const;
187
188 MCFOLD ::gsl::span<::BiomeIdType const> $getRequiredBiomes() const;
189
190 MCAPI bool $getNearestGeneratedFeature(
191 ::Dimension& dimension,
192 ::BiomeSource const& biomeSource,
193 ::BlockPos const& origin,
194 ::BlockPos& pos,
195 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
196 bool mustBeInNewChunks,
197 ::std::optional<::HashedString> const& biomeTag
198 );
199
200 MCAPI ::StructureStart* $getStructureAt(int cellX, int cellY, int cellZ);
201
202
203 // NOLINTEND
204
205public:
206 // vftables
207 // NOLINTBEGIN
208 MCNAPI static void** $vftable();
209 // NOLINTEND
210};
Definition BiomeSource.h:24
Definition Biome.h:24
Definition BlockPos.h:21
Definition BlockSource.h:73
Definition BoundingBox.h:13
Definition ChunkPos.h:11
Definition Dimension.h:89
Definition HashedString.h:5
Definition IPreliminarySurfaceProvider.h:8
Definition LevelChunk.h:87
Definition Random.h:10
static MCAPI void ** $vftable()
Definition StructureStart.h:15
Definition buffer_span.h:6
Definition BiomeIdType.h:8