LeviLamina
Loading...
Searching...
No Matches
TrialSpawner.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/ecs/WeakEntityRef.h"
7#include "mc/world/actor/ActorDefinitionIdentifier.h"
8#include "mc/world/item/ItemStack.h"
9#include "mc/world/level/BlockPos.h"
10#include "mc/world/level/block/registry/TrialSpawnerConfig.h"
11
12// auto generated forward declare list
13// clang-format off
14class Actor;
15class Block;
16class BlockSource;
17class CompoundTag;
18class Level;
19class Mob;
20class Random;
21class SpawnData;
23class Vec3;
24struct ActorUniqueID;
25struct DimensionType;
26// clang-format on
27
28class TrialSpawner {
29public:
30 // TrialSpawner inner types declare
31 // clang-format off
32 struct PlayerScanResult;
33 struct WeightedItemStack;
34 struct Data;
35 // clang-format on
36
37 // TrialSpawner inner types define
38 enum class SpawningLogicState : int {
39 Inactive = 0,
40 WaitingForPlayers = 1,
41 Active = 2,
42 WaitingForRewardEjection = 3,
43 EjectingRewards = 4,
44 Cooldown = 5,
45 Count = 6,
46 };
47
49 public:
50 // member variables
51 // NOLINTBEGIN
52 ::ll::TypedStorage<1, 1, bool> haveTrialOmen;
53 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> foundPlayers;
54 // NOLINTEND
55
56 public:
57 // member functions
58 // NOLINTBEGIN
59 MCAPI ~PlayerScanResult();
60 // NOLINTEND
61
62 public:
63 // destructor thunk
64 // NOLINTBEGIN
65 MCFOLD void $dtor();
66 // NOLINTEND
67 };
68
70 public:
71 // member variables
72 // NOLINTBEGIN
73 ::ll::TypedStorage<8, 152, ::ItemStack> itemStack;
74 // NOLINTEND
75
76 public:
77 // member functions
78 // NOLINTBEGIN
79 MCAPI ~WeightedItemStack();
80 // NOLINTEND
81
82 public:
83 // destructor thunk
84 // NOLINTBEGIN
85 MCFOLD void $dtor();
86 // NOLINTEND
87 };
88
89 struct Data {
90 public:
91 // member variables
92 // NOLINTBEGIN
93 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> mDetectedPlayers;
94 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> mCurrentMobs;
95 ::ll::TypedStorage<8, 8, uint64> mCooldownEndsAt;
96 ::ll::TypedStorage<8, 8, uint64> mNextMobSpawnsAt;
97 ::ll::TypedStorage<4, 4, int> mTotalMobsSpawned;
98 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SpawnData>> mNextSpawnData;
99 ::ll::TypedStorage<8, 32, ::std::string> mSelectedLootTableName;
100 ::ll::TypedStorage<8, 24, ::std::vector<::TrialSpawner::WeightedItemStack>> mDispensing;
101 ::ll::TypedStorage<8, 176, ::ActorDefinitionIdentifier> mActorDefId;
102 ::ll::TypedStorage<8, 24, ::WeakEntityRef> mDisplayEntity;
103 ::ll::TypedStorage<4, 4, float> mCurrentSpinSpeed;
104 ::ll::TypedStorage<4, 4, float> mPreviousSpinSpeed;
105 ::ll::TypedStorage<1, 1, bool> mSkipNextMobCleanup;
106 // NOLINTEND
107
108 public:
109 // member functions
110 // NOLINTBEGIN
111 MCAPI ~Data();
112 // NOLINTEND
113
114 public:
115 // destructor thunk
116 // NOLINTBEGIN
117 MCAPI void $dtor();
118 // NOLINTEND
119 };
120
121public:
122 // member variables
123 // NOLINTBEGIN
124 ::ll::TypedStorage<4, 12, ::BlockPos const> mPosition;
125 ::ll::TypedStorage<4, 4, int> mPlayerSearchRange;
126 ::ll::TypedStorage<8, 352, ::TrialSpawner::Data> mData;
127 ::ll::TypedStorage<8, 144, ::TrialSpawnerConfig> mNormalConfig;
128 ::ll::TypedStorage<8, 144, ::TrialSpawnerConfig> mOminousConfig;
129 ::ll::TypedStorage<1, 1, bool> mIsOminous;
130 ::ll::TypedStorage<1, 1, bool> hasSpawnedItemSpawner;
131 // NOLINTEND
132
133public:
134 // prevent constructor by default
135 TrialSpawner();
136
137public:
138 // member functions
139 // NOLINTBEGIN
140 MCAPI explicit TrialSpawner(::BlockPos const& pos);
141
142 MCAPI void _becomeOminous(::BlockSource& region, ::Block const& block);
143
144 MCAPI void _dispenseItemAboveRandomCombatant(::BlockSource& region);
145
146 MCAPI ::TrialSpawner::PlayerScanResult _doPlayerScan(::BlockSource& region);
147
148 MCAPI void _ejectReward(::BlockSource& region, ::BlockPos pos) const;
149
150 MCAPI ::std::vector<::TrialSpawner::WeightedItemStack>& _getDispensingItems(::BlockSource& region);
151
152 MCAPI ::std::optional<::Vec3>
153 _getPositionToSpawnItemSpawner(::BlockSource& region, ::std::vector<::ActorUniqueID> const& eligibleActorIds) const;
154
155 MCAPI bool _hasLineOfSight(::BlockSource const& region, ::Vec3 from, ::Vec3 to, float maxRange) const;
156
157 MCAPI void _selectLootTable(::Level& level);
158
159 MCAPI void _sendParticlesForState(::BlockSource& region, ::BlockPos pos, ::TrialSpawner::SpawningLogicState state);
160
161 MCAPI void _sendSmallFlame(::BlockSource& region, ::Vec3 center);
162
163 MCAPI void _setUpdated(::BlockSource& region);
164
165 MCAPI void _spawnItemSpawner(::BlockSource& region, ::Vec3 pos, ::ItemStack const& itemToSpawn);
166
167 MCAPI ::std::optional<::ActorUniqueID> _spawnMob(::BlockSource& region, ::BlockPos blockActorPos);
168
169 MCAPI ::std::optional<::ActorUniqueID> _spawnMob(::BlockSource& region, ::BlockPos blockActorPos, ::Vec3 spawnPos);
170
171 MCAPI void _tryRegisterNewPlayers(::BlockSource& region, ::TrialSpawner::SpawningLogicState currentState);
172
173 MCAPI void _updateStateMachine(::BlockSource& region);
174
175 MCAPI void applyUpdatePacket(::CompoundTag const& tag, ::BlockSource& region);
176
177 MCAPI ::Mob* createAndAddDisplayEntity(::BlockSource& region);
178
179 MCAPI ::CompoundTag createUpdatePacket();
180
181#ifdef LL_PLAT_C
182 MCAPI float getCurrentSpinSpeed() const;
183#endif
184
185 MCAPI ::SpawnData const* getOrCreateNextSpawnData(::Random& random);
186
187#ifdef LL_PLAT_C
188 MCAPI float getPreviousSpinSpeed() const;
189#endif
190
191 MCAPI ::TrialSpawner::SpawningLogicState getSpawningLogicState(::BlockSource& region) const;
192
193 MCAPI void load(::CompoundTag const& data, ::TrialSpawnerConfigRegistry const& configRegistry);
194
195 MCAPI void removeDisplayEntity();
196
197 MCAPI void save(::CompoundTag& tag);
198
199 MCAPI void setEntityId(::ActorDefinitionIdentifier const& actorDefId, ::BlockSource& region);
200
201 MCAPI void tick(::BlockSource& region);
202
203#ifdef LL_PLAT_C
204 MCAPI ::Mob* tryGetOrCreateDisplayEntity(::BlockSource& region);
205#endif
206
207 MCAPI ~TrialSpawner();
208 // NOLINTEND
209
210public:
211 // static functions
212 // NOLINTBEGIN
213 MCAPI static void _ejectItem(::BlockSource& region, ::Vec3 pos, ::ItemStack const& item);
214
215 MCAPI static void _ejectResultItems(
216 ::BlockSource& region,
217 ::BlockPos blockPos,
218 ::std::vector<::ItemStack> const& items,
219 int lootCount
220 );
221
222 MCAPI static ::std::optional<::Vec3>
223 _findFreePositionAbove(::BlockSource const& region, ::Vec3 const& from, int distance);
224
225 MCAPI static ::std::vector<::ItemStack> _getRandomLootTableItems(
226 ::Level& level,
227 ::Random& random,
228 ::DimensionType dimensionType,
229 ::std::string const& lootTableName
230 );
231
232 MCAPI static void _removeMobByGameplay(::Level& level, ::Actor& mob);
233
234#ifdef LL_PLAT_C
235 MCAPI static void addSpawnParticles(::Level& level, ::Vec3 pos, bool isOminous);
236
237 MCAPI static void sendEjectItemParticles(::Level& level, ::BlockPos pos, bool isOminous);
238#endif
239 // NOLINTEND
240
241public:
242 // constructor thunks
243 // NOLINTBEGIN
244 MCAPI void* $ctor(::BlockPos const& pos);
245 // NOLINTEND
246
247public:
248 // destructor thunk
249 // NOLINTBEGIN
250 MCAPI void $dtor();
251 // NOLINTEND
252};
Definition Actor.h:125
Definition BlockPos.h:21
Definition BlockSource.h:73
Definition Block.h:69
Definition CompoundTag.h:23
Definition ItemStack.h:35
Definition Level.h:255
Definition Mob.h:57
Definition Random.h:10
Definition SpawnData.h:15
Definition TrialSpawnerConfigRegistry.h:10
Definition Vec3.h:10
Definition ActorDefinitionIdentifier.h:15
Definition ActorUniqueID.h:10
Definition DimensionType.h:5
Definition TrialSpawner.h:89
Definition TrialSpawner.h:48
Definition TrialSpawner.h:69