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