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