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