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