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;
21// clang-format on
22
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, ::Bedrock::Threading::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
47
48public:
49 // virtual functions
50 // NOLINTBEGIN
51 // vIndex: 0
52 virtual ~StructureFeature();
53
54 // vIndex: 1
55 virtual bool shouldAddHardcodedSpawnAreas() const;
56
57 // vIndex: 2
58 virtual bool shouldPostProcessMobs() const;
59
60 // vIndex: 3
61 virtual bool getNearestGeneratedFeature(
62 ::Dimension& dimension,
63 ::BiomeSource const& biomeSource,
64 ::BlockPos const& origin,
65 ::BlockPos& pos,
66 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
67 bool mustBeInNewChunks,
68 ::std::optional<::HashedString> const& biomeTag
69 );
70
71 // vIndex: 4
72 virtual bool isFeatureChunk(
73 ::BiomeSource const&,
74 ::Random&,
75 ::ChunkPos const&,
76 uint,
78 ::Dimension const&
79 ) = 0;
80
81 // vIndex: 5
82 virtual ::std::unique_ptr<::StructureStart> createStructureStart(
84 ::BiomeSource const&,
85 ::Random&,
86 ::ChunkPos const&,
88 ) = 0;
89
90 // vIndex: 6
91 virtual ::StructureStart* getStructureAt(int cellX, int cellY, int cellZ);
92 // NOLINTEND
93
94public:
95 // member functions
96 // NOLINTBEGIN
97 MCAPI StructureFeature(uint seed, ::HashedString structureFeatureType);
98
99 MCAPI void addFeature(
100 ::Dimension& dimension,
101 ::Random& random,
102 ::ChunkPos const& cp,
103 ::BiomeSource const& biomeSource,
104 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
105 );
106
107 MCAPI void createBlueprints(
108 ::Dimension& dimension,
109 ::ChunkPos const& cp,
110 ::BiomeSource const& biomeSource,
111 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
112 );
113
114 MCAPI ::std::vector<::ChunkPos> findFarAwayStructures(::buffer_span<::ChunkPos> activeChunks, uint safetyBorder);
115
116 MCAPI void foreachIntersectingStructureStart(::BoundingBox const& bb, ::std::function<void(::StructureStart&)> fn);
117
118 MCAPI void garbageCollectBlueprints(::buffer_span<::ChunkPos> activeChunks, uint safetyBorder);
119
120 MCAPI bool isInsideBoundingFeature(int cellX, int cellY, int cellZ);
121
122 MCAPI void postProcessMobsAt(::BlockSource& region, int chunkWestBlock, int chunkNorthBlock, ::Random& random);
123 // NOLINTEND
124
125public:
126 // static functions
127 // NOLINTBEGIN
128 MCAPI static bool findNearestFeaturePositionBySpacing(
129 ::Dimension& dimension,
130 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
131 ::StructureFeature& feature,
132 ::std::optional<::HashedString> const& biomeTag,
133 ::BiomeSource const& biomeSource,
134 ::BlockPos const& origin,
135 ::BlockPos& result,
136 int featureSpacing,
137 int minFeatureSeparation,
138 int randomSalt,
139 bool tiltedSpacing,
140 int maxSearchRadius,
141 bool mustBeInNewChunks
142 );
143
144 MCAPI static ::ChunkPos getChunkPosInSpace(
145 ::ChunkPos const& cp,
146 ::Random& random,
147 uint levelSeed,
148 int spacing,
149 int separation,
150 int salt,
151 bool tiltedSpacing
152 );
153 // NOLINTEND
154
155public:
156 // constructor thunks
157 // NOLINTBEGIN
158 MCAPI void* $ctor(uint seed, ::HashedString structureFeatureType);
159 // NOLINTEND
160
161public:
162 // destructor thunk
163 // NOLINTBEGIN
164 MCAPI void $dtor();
165 // NOLINTEND
166
167public:
168 // virtual function thunks
169 // NOLINTBEGIN
170 MCFOLD bool $shouldAddHardcodedSpawnAreas() const;
171
172 MCFOLD bool $shouldPostProcessMobs() const;
173
174 MCAPI bool $getNearestGeneratedFeature(
175 ::Dimension& dimension,
176 ::BiomeSource const& biomeSource,
177 ::BlockPos const& origin,
178 ::BlockPos& pos,
179 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
180 bool mustBeInNewChunks,
181 ::std::optional<::HashedString> const& biomeTag
182 );
183
184 MCAPI ::StructureStart* $getStructureAt(int cellX, int cellY, int cellZ);
185 // NOLINTEND
186
187public:
188 // vftables
189 // NOLINTBEGIN
190 MCNAPI static void** $vftable();
191 // NOLINTEND
192};
Definition BiomeSource.h:19
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition BoundingBox.h:13
Definition ChunkPos.h:11
Definition Dimension.h:83
Definition HashedString.h:5
Definition IPreliminarySurfaceProvider.h:8
Definition Random.h:11
Definition StructureFeature.h:23
static MCAPI void ** $vftable()
Definition StructureStart.h:15
Definition buffer_span.h:6