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<4, 4, int> mOpeningDelay;
103 ::ll::TypedStorage<4, 4, int> mEjectionDelay;
104 ::ll::TypedStorage<4, 4, int> mMaxDistance;
105 ::ll::TypedStorage<8, 24, ::std::vector<::TrialSpawner::WeightedItemStack>> mDispensing;
106 ::ll::TypedStorage<8, 176, ::ActorDefinitionIdentifier> mActorDefId;
107 ::ll::TypedStorage<8, 24, ::WeakEntityRef> mDisplayEntity;
108 ::ll::TypedStorage<4, 4, float> mCurrentSpinSpeed;
109 ::ll::TypedStorage<4, 4, float> mPreviousSpinSpeed;
110 // NOLINTEND
111
112 public:
113 // member functions
114 // NOLINTBEGIN
115 MCAPI void reset();
116
117 MCAPI ~Data();
118 // NOLINTEND
119
120 public:
121 // destructor thunk
122 // NOLINTBEGIN
123 MCAPI void $dtor();
124 // NOLINTEND
125 };
126
127public:
128 // member variables
129 // NOLINTBEGIN
130 ::ll::TypedStorage<4, 12, ::BlockPos const> mPosition;
131 ::ll::TypedStorage<4, 4, int> mPlayerSearchRange;
132 ::ll::TypedStorage<8, 360, ::TrialSpawner::Data> mData;
133 ::ll::TypedStorage<8, 144, ::TrialSpawnerConfig> mNormalConfig;
134 ::ll::TypedStorage<8, 144, ::TrialSpawnerConfig> mOminousConfig;
135 ::ll::TypedStorage<1, 1, bool> mIsOminous;
136 ::ll::TypedStorage<1, 1, bool> hasSpawnedItemSpawner;
137 // NOLINTEND
138
139public:
140 // member functions
141 // NOLINTBEGIN
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, ::Vec3 spawnPos);
168
169 MCAPI void _tryRegisterNewPlayers(::BlockSource& region, ::TrialSpawner::SpawningLogicState currentState);
170
171 MCAPI void _updateStateMachine(::BlockSource& region);
172
173 MCAPI void applyUpdatePacket(::CompoundTag const& tag, ::BlockSource& region);
174
175 MCAPI ::Mob* createAndAddDisplayEntity(::BlockSource& region);
176
177 MCAPI ::SpawnData const* getOrCreateNextSpawnData(::Random& random);
178
179 MCAPI ::TrialSpawner::SpawningLogicState getSpawningLogicState(::BlockSource& region) const;
180
181 MCAPI void load(::CompoundTag const& data, ::TrialSpawnerConfigRegistry const& configRegistry);
182
183 MCAPI void removeDisplayEntity();
184
185 MCAPI void save(::CompoundTag& tag);
186
187 MCAPI void setEntityId(::ActorDefinitionIdentifier const& actorDefId, ::BlockSource& region);
188
189 MCAPI void tick(::BlockSource& region);
190 // NOLINTEND
191
192public:
193 // static functions
194 // NOLINTBEGIN
195 MCAPI static void _ejectItem(::BlockSource& region, ::Vec3 pos, ::ItemStack const& item);
196
197 MCAPI static void _ejectResultItems(
198 ::BlockSource& region,
199 ::BlockPos blockPos,
200 ::std::vector<::ItemStack> const& items,
201 int lootCount
202 );
203
204 MCAPI static ::std::optional<::Vec3>
205 _findFreePositionAbove(::BlockSource const& region, ::Vec3 const& from, int distance);
206
207 MCAPI static ::std::vector<::ItemStack> _getRandomLootTableItems(
208 ::Level& level,
209 ::Random& random,
210 ::DimensionType dimensionType,
211 ::std::string const& lootTableName
212 );
213
214 MCAPI_C static char const* _getSmallFlameParticleName(bool isOminous);
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 MCAPI_C static void addSpawnParticles(::Level& level, ::Vec3 pos, bool isOminous);
225
226 MCAPI_C static void sendEjectItemParticles(::Level& level, ::BlockPos pos, bool isOminous);
227 // NOLINTEND
228};
Definition Actor.h:105
Definition BlockPos.h:19
Definition BlockSource.h:68
Definition Block.h:43
Definition CompoundTag.h:23
Definition Dimension.h:85
Definition ItemStack.h:26
Definition Level.h:249
Definition Mob.h:50
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