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 Data;
35 struct PlayerScanResult;
36 struct WeightedItemStack;
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<8, 152, ::ItemStack> itemStack;
55 // NOLINTEND
56
57 public:
58 // member functions
59 // NOLINTBEGIN
60 MCAPI ~WeightedItemStack();
61 // NOLINTEND
62
63 public:
64 // destructor thunk
65 // NOLINTBEGIN
66 MCFOLD void $dtor();
67 // NOLINTEND
68 };
69
70 struct Data {
71 public:
72 // member variables
73 // NOLINTBEGIN
74 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> mDetectedPlayers;
75 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> mCurrentMobs;
76 ::ll::TypedStorage<8, 8, uint64> mCooldownEndsAt;
77 ::ll::TypedStorage<8, 8, uint64> mNextMobSpawnsAt;
78 ::ll::TypedStorage<4, 4, int> mTotalMobsSpawned;
79 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SpawnData>> mNextSpawnData;
80 ::ll::TypedStorage<8, 32, ::std::string> mSelectedLootTableName;
81 ::ll::TypedStorage<4, 4, int> mOpeningDelay;
82 ::ll::TypedStorage<4, 4, int> mEjectionDelay;
83 ::ll::TypedStorage<4, 4, int> mMaxDistance;
84 ::ll::TypedStorage<8, 24, ::std::vector<::TrialSpawner::WeightedItemStack>> mDispensing;
85 ::ll::TypedStorage<8, 176, ::ActorDefinitionIdentifier> mActorDefId;
86 ::ll::TypedStorage<8, 24, ::WeakEntityRef> mDisplayEntity;
87 ::ll::TypedStorage<4, 4, float> mCurrentSpinSpeed;
88 ::ll::TypedStorage<4, 4, float> mPreviousSpinSpeed;
89 // NOLINTEND
90
91 public:
92 // member functions
93 // NOLINTBEGIN
94 MCAPI void reset();
95
96 MCAPI ~Data();
97 // NOLINTEND
98
99 public:
100 // destructor thunk
101 // NOLINTBEGIN
102 MCAPI void $dtor();
103 // NOLINTEND
104 };
105
107 public:
108 // member variables
109 // NOLINTBEGIN
110 ::ll::TypedStorage<1, 1, bool> haveTrialOmen;
111 ::ll::TypedStorage<8, 24, ::std::vector<::ActorUniqueID>> foundPlayers;
112 // NOLINTEND
113
114 public:
115 // member functions
116 // NOLINTBEGIN
117 MCAPI ~PlayerScanResult();
118 // NOLINTEND
119
120 public:
121 // destructor thunk
122 // NOLINTBEGIN
123 MCFOLD 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 // prevent constructor by default
141 TrialSpawner();
142
143public:
144 // member functions
145 // NOLINTBEGIN
146 MCAPI explicit TrialSpawner(::BlockPos const& pos);
147
148 MCAPI void _becomeOminous(::BlockSource& region, ::Block const& block);
149
150 MCAPI void _dispenseItemAboveRandomCombatant(::BlockSource& region);
151
152 MCAPI ::TrialSpawner::PlayerScanResult _doPlayerScan(::BlockSource& region);
153
154 MCAPI ::std::vector<::TrialSpawner::WeightedItemStack>& _getDispensingItems(::BlockSource& region);
155
156 MCAPI ::std::optional<::Vec3>
157 _getPositionToSpawnItemSpawner(::BlockSource& region, ::std::vector<::ActorUniqueID> const& eligibleActorIds) const;
158
159 MCAPI bool _hasLineOfSight(::BlockSource const& region, ::Vec3 from, ::Vec3 to, float maxRange) const;
160
161 MCAPI void _selectLootTable(::Level& level);
162
163 MCAPI void _sendParticlesForState(::BlockSource& region, ::BlockPos pos, ::TrialSpawner::SpawningLogicState state);
164
165 MCAPI void _sendSmallFlame(::BlockSource& region, ::Vec3 center);
166
167 MCAPI void _setUpdated(::BlockSource& region);
168
169 MCAPI void _spawnItemSpawner(::BlockSource& region, ::Vec3 pos, ::ItemStack const& itemToSpawn);
170
171 MCAPI ::std::optional<::ActorUniqueID> _spawnMob(::BlockSource& region, ::BlockPos blockActorPos, ::Vec3 spawnPos);
172
173 MCAPI void _tryRegisterNewPlayers(::BlockSource& region, ::TrialSpawner::SpawningLogicState currentState);
174
175 MCAPI void _updateStateMachine(::BlockSource& region);
176
177 MCAPI void applyUpdatePacket(::CompoundTag const& tag, ::BlockSource& region);
178
179 MCAPI ::Mob* createAndAddDisplayEntity(::BlockSource& region);
180
181 MCAPI ::SpawnData const* getOrCreateNextSpawnData(::Random& random);
182
183 MCAPI ::TrialSpawner::SpawningLogicState getSpawningLogicState(::BlockSource& region) const;
184
185 MCAPI void load(::CompoundTag const& data, ::TrialSpawnerConfigRegistry const& configRegistry);
186
187 MCAPI void removeDisplayEntity();
188
189 MCAPI void save(::CompoundTag& tag);
190
191 MCAPI void setEntityId(::ActorDefinitionIdentifier const& actorDefId, ::BlockSource& region);
192
193 MCAPI void tick(::BlockSource& region);
194 // NOLINTEND
195
196public:
197 // static functions
198 // NOLINTBEGIN
199 MCAPI static void _ejectItem(::BlockSource& region, ::Vec3 pos, ::ItemStack const& item);
200
201 MCAPI static void _ejectResultItems(
202 ::BlockSource& region,
203 ::BlockPos blockPos,
204 ::std::vector<::ItemStack> const& items,
205 int lootCount
206 );
207
208 MCAPI static ::std::optional<::Vec3>
209 _findFreePositionAbove(::BlockSource const& region, ::Vec3 const& from, int distance);
210
211 MCAPI static ::std::vector<::ItemStack> _getRandomLootTableItems(
212 ::Level& level,
213 ::Random& random,
214 ::DimensionType dimensionType,
215 ::std::string const& lootTableName
216 );
217
218 MCAPI static bool _isAllowedToSpawnInLevel(::Level& level);
219
220 MCAPI static void _removeMobByGameplay(::Level& level, ::Actor& mob);
221
222 MCAPI static ::std::unique_ptr<::Tag> _saveConfig(::TrialSpawnerConfig& config);
223 // NOLINTEND
224
225public:
226 // constructor thunks
227 // NOLINTBEGIN
228 MCAPI void* $ctor(::BlockPos const& pos);
229 // NOLINTEND
230};
Definition Actor.h:102
Definition AutomaticID.h:6
Definition BlockPos.h:17
Definition BlockSource.h:66
Definition Block.h:37
Definition CompoundTag.h:13
Definition Dimension.h:83
Definition ItemStack.h:23
Definition Level.h:243
Definition Mob.h:47
Definition Random.h:10
Definition SpawnData.h:14
Definition Tag.h:39
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:70
Definition TrialSpawner.h:106
Definition TrialSpawner.h:50