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