Skip to content
LeviMC
English
AutoLightDark
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 virtual ::std::unique_ptr<::StructureStart> createStructureStart(
79 ::Dimension& generator,
80 ::BiomeSource const& biomeSource,
81 ::Random& random,
82 ::ChunkPos const& lc,
83 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
84 ) = 0;
85
86 virtual ::StructureStart* getStructureAt(int cellX, int cellY, int cellZ);
87 // NOLINTEND
88
89public:
90 // member functions
91 // NOLINTBEGIN
92 MCAPI StructureFeature(uint seed, ::HashedString structureFeatureType);
93
94 MCNAPI void createBlueprints(
95 ::Dimension& dimension,
96 ::ChunkPos const& cp,
97 ::BiomeSource const& biomeSource,
98 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel
99 );
100
101 MCNAPI void foreachIntersectingStructureStart(::BoundingBox const& bb, ::std::function<void(::StructureStart&)> fn);
102
103 MCAPI void garbageCollectBlueprints(::buffer_span<::ChunkPos> activeChunks, uint safetyBorder);
104
105 MCNAPI void postProcessMobsAt(::BlockSource& region, int chunkWestBlock, int chunkNorthBlock, ::Random& random);
106 // NOLINTEND
107
108public:
109 // static functions
110 // NOLINTBEGIN
112 ::Dimension& dimension,
113 ::IPreliminarySurfaceProvider const& preliminarySurfaceLevel,
114 ::StructureFeature& feature,
115 ::std::optional<::HashedString> const& biomeTag,
116 ::BiomeSource const& biomeSource,
117 ::BlockPos const& origin,
118 ::BlockPos& result,
119 int featureSpacing,
120 int minFeatureSeparation,
121 int randomSalt,
122 bool tiltedSpacing,
123 int maxSearchRadius,
124 bool mustBeInNewChunks
125 );
126
127 MCNAPI static ::ChunkPos getChunkPosInSpace(
128 ::ChunkPos const& cp,
129 ::Random& random,
130 uint levelSeed,
131 int spacing,
132 int separation,
133 int salt,
134 bool tiltedSpacing
135 );
136 // NOLINTEND
137
138public:
139 // constructor thunks
140 // NOLINTBEGIN
141 MCAPI void* $ctor(uint seed, ::HashedString structureFeatureType);
142 // NOLINTEND
143
144public:
145 // destructor thunk
146 // NOLINTBEGIN
147 MCAPI void $dtor();
148 // NOLINTEND
149
150public:
151 // virtual function thunks
152 // NOLINTBEGIN
153 MCFOLD bool $shouldAddHardcodedSpawnAreas() const;
154
155 MCFOLD bool $shouldPostProcessMobs() const;
156
157 MCFOLD ::gsl::span<::BiomeIdType const> $getRequiredBiomes() 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
171
172 // NOLINTEND
173
174public:
175 // vftables
176 // NOLINTBEGIN
177 MCNAPI static void** $vftable();
178 // NOLINTEND
179};
Definition BiomeSource.h:23
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition BoundingBox.h:13
Definition ChunkPos.h:13
Definition Dimension.h:86
Definition HashedString.h:5
Definition IPreliminarySurfaceProvider.h:8
Definition Random.h:10
MCAPI void postProcessMobsAt(::BlockSource &region, int chunkWestBlock, int chunkNorthBlock, ::Random &random)
MCAPI void createBlueprints(::Dimension &dimension, ::ChunkPos const &cp, ::BiomeSource const &biomeSource, ::IPreliminarySurfaceProvider const &preliminarySurfaceLevel)
static MCAPI bool findNearestFeaturePositionBySpacing(::Dimension &dimension, ::IPreliminarySurfaceProvider const &preliminarySurfaceLevel, ::StructureFeature &feature, ::std::optional<::HashedString > const &biomeTag, ::BiomeSource const &biomeSource, ::BlockPos const &origin, ::BlockPos &result, int featureSpacing, int minFeatureSeparation, int randomSalt, bool tiltedSpacing, int maxSearchRadius, bool mustBeInNewChunks)
MCAPI void foreachIntersectingStructureStart(::BoundingBox const &bb, ::std::function< void(::StructureStart &)> fn)
static MCAPI ::ChunkPos getChunkPosInSpace(::ChunkPos const &cp, ::Random &random, uint levelSeed, int spacing, int separation, int salt, bool tiltedSpacing)
static MCAPI void ** $vftable()
Definition StructureStart.h:15
Definition buffer_span.h:6
Definition BiomeIdType.h:8