LeviLamina
Loading...
Searching...
No Matches
Spawner.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/actor/spawn_category/Type.h"
7#include "mc/world/level/SpawnBlockRequirements.h"
8#include "mc/world/level/chunk/LevelChunk.h"
9#include "mc/world/level/material/MaterialType.h"
10
11// auto generated forward declare list
12// clang-format off
13class Actor;
15class Biome;
16class BlockPos;
17class BlockSource;
18class ChunkPos;
19class IRandom;
21class ItemActor;
22class ItemStack;
23class LevelChunk;
25class Mob;
26class MobSpawnRules;
27class Random;
29class SpawnConditions;
31class Vec3;
33struct ActorUniqueID;
34struct SpawnSettings;
35namespace br::spawn { class EntityTypeCache; }
36namespace br::spawn { class SpawnPlacements; }
37namespace br::spawn { struct State; }
38// clang-format on
39
40class Spawner {
41public:
42 // Spawner inner types define
43 using MobSpawnedCallback = ::std::function<void(::Mob&)>;
44
45 using SpawnMobClusterCallback = ::std::function<void(::BlockPos const&, ::SpawnConditions&)>;
46
47 using SpawnStructureMobCallback =
48 ::std::function<void(::BlockPos const&, ::LevelChunk::SpawningArea const&, ::SpawnConditions const&)>;
49
50 using GetSpawningAreasCallback =
51 ::std::function<::gsl::span<::LevelChunk::SpawningArea const>(::LevelChunk const&)>;
52
53 using AncientCityPredicate = ::std::function<bool(::BlockSource const&, ::BlockPos)>;
54
55 using SpawnTickCallback = ::std::function<void(::BlockPos, ::SpawnConditions)>;
56
57public:
58 // virtual functions
59 // NOLINTBEGIN
60 // vIndex: 0
61 virtual ~Spawner();
62
63 // vIndex: 1
64 virtual void initializeServerSide(::ResourcePackManager&, ::IWorldRegistriesProvider&) = 0;
65
66 // vIndex: 2
67 virtual ::SpawnSettings const& getSpawnSettings() const = 0;
68
69 // vIndex: 3
70 virtual void setSpawnSettings(::SpawnSettings const&) = 0;
71
72 // vIndex: 4
73 virtual ::ActorSpawnRuleGroup const* getSpawnRules() const = 0;
74
75 // vIndex: 5
76 virtual ::ActorSpawnRuleGroup* getSpawnRulesMutable() const = 0;
77
78 // vIndex: 6
79 virtual ::SpawnGroupRegistry const* getSpawnGroupRegistry() const = 0;
80
81 // vIndex: 7
82 virtual ::br::spawn::EntityTypeCache* getEntityTypeCache() const = 0;
83
84 // vIndex: 8
85 virtual ::Mob* spawnMob(
86 ::BlockSource& region,
88 ::Actor* spawner,
89 ::Vec3 const& pos,
90 bool naturalSpawn,
91 bool surface,
92 bool fromSpawner
93 );
94
95 // vIndex: 9
96 virtual ::ItemActor*
97 spawnItem(::BlockSource& region, ::ItemStack const& inst, ::Actor* spawner, ::Vec3 const& pos, int throwTime);
98
99 // vIndex: 10
100 virtual ::Actor* spawnProjectile(
101 ::BlockSource& region,
103 ::Actor* spawner,
104 ::Vec3 const& position,
105 ::Vec3 const& direction
106 );
107
108 // vIndex: 11
109 virtual void postProcessSpawnMobs(::BlockSource&, int, int, ::Random&) = 0;
110
111 // vIndex: 12
112 virtual void tick(::BlockSource&, ::LevelChunkVolumeData const&, ::ChunkPos const) = 0;
113
114 // vIndex: 13
115 virtual void tickMobCount() = 0;
116
117 // vIndex: 14
118 virtual void incrementSpawnableTickedMob() = 0;
119
120 // vIndex: 15
121 virtual uint getSpawnableTickedMobCountPrevious() const = 0;
122
123 // vIndex: 16
124 virtual ::std::unordered_set<::ActorUniqueID>
125 spawnMobGroup(::BlockSource&, ::std::string const&, ::Vec3 const&, bool, bool, ::std::function<void(::Mob&)>&&) = 0;
126
127 // vIndex: 17
128 virtual ::br::spawn::SpawnPlacements& getSpawnPlacements() = 0;
129
130 // vIndex: 18
131 virtual ::std::tuple<::std::array<::SpawnCategory::Type, 8>, uint64>
132 filteredSpawningCategories(::br::spawn::State const&, bool, bool, bool) const;
133
134 // vIndex: 19
135 virtual void spawnForChunk(
139 ::gsl::span<::SpawnCategory::Type>,
140 ::IRandom&
141 ) const;
142
143 // vIndex: 20
144 virtual void spawnMobsForChunkGeneration(::BlockSource&, ::Biome const&, ::ChunkPos, ::IRandom&) const;
145 // NOLINTEND
146
147public:
148 // static functions
149 // NOLINTBEGIN
150 MCAPI static bool findNextSpawnBlockUnder(
151 ::BlockSource const& region,
152 ::BlockPos& pos,
153 ::std::optional<::MaterialType> materialToSpawnIn,
154 ::SpawnBlockRequirements spawnBlockRequirements
155 );
156
157 MCAPI static bool isSpawnPositionOk(
158 ::MobSpawnRules const& rules,
159 ::BlockSource& region,
160 ::BlockPos const& pos,
161 bool validateDistToPlayer
162 );
163 // NOLINTEND
164
165public:
166 // destructor thunk
167 // NOLINTBEGIN
168 MCAPI void $dtor();
169 // NOLINTEND
170
171public:
172 // virtual function thunks
173 // NOLINTBEGIN
174 MCAPI ::Mob* $spawnMob(
175 ::BlockSource& region,
177 ::Actor* spawner,
178 ::Vec3 const& pos,
179 bool naturalSpawn,
180 bool surface,
181 bool fromSpawner
182 );
183
184 MCAPI ::ItemActor*
185 $spawnItem(::BlockSource& region, ::ItemStack const& inst, ::Actor* spawner, ::Vec3 const& pos, int throwTime);
186
187 MCAPI ::Actor* $spawnProjectile(
188 ::BlockSource& region,
190 ::Actor* spawner,
191 ::Vec3 const& position,
192 ::Vec3 const& direction
193 );
194
195 MCAPI ::std::tuple<::std::array<::SpawnCategory::Type, 8>, uint64>
196 $filteredSpawningCategories(::br::spawn::State const&, bool, bool, bool) const;
197
198 MCFOLD void $spawnForChunk(
202 ::gsl::span<::SpawnCategory::Type>,
203 ::IRandom&
204 ) const;
205
206 MCFOLD void $spawnMobsForChunkGeneration(::BlockSource&, ::Biome const&, ::ChunkPos, ::IRandom&) const;
207 // NOLINTEND
208
209public:
210 // vftables
211 // NOLINTBEGIN
212 MCNAPI static void** $vftable();
213 // NOLINTEND
214};
Definition ActorSpawnRuleGroup.h:17
Definition Actor.h:103
Definition Biome.h:26
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition ChunkPos.h:11
Definition IRandom.h:10
Definition IWorldRegistriesProvider.h:26
Definition ItemActor.h:27
Definition ItemStack.h:25
Definition LevelChunkVolumeData.h:18
Definition LevelChunk.h:74
Definition MobSpawnRules.h:16
Definition Mob.h:47
Definition Random.h:11
Definition ResourcePackManager.h:23
Definition SpawnConditions.h:5
Definition SpawnGroupRegistry.h:15
Definition Spawner.h:40
static MCAPI void ** $vftable()
Definition Vec3.h:10
Definition ActorDefinitionIdentifier.h:15
Definition ActorUniqueID.h:5
Definition LevelChunk.h:121
Definition SpawnSettings.h:14
Definition State.h:10