LeviLamina
Loading...
Searching...
No Matches
Enchant.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/deps/shared_types/item/EnchantSlot.h"
8
9// auto generated forward declare list
10// clang-format off
11class Actor;
13class BaseGameVersion;
14class Experiments;
15class ItemInstance;
17// clang-format on
18
19class Enchant {
20public:
21 // Enchant inner types define
22 enum class Activation : int {
23 Equipped = 0,
24 Held = 1,
25 Self = 2,
26 NumActivations = 3,
27 Invalid = 4,
28 };
29
30 enum class CompatibilityID : int {
31 NonConflict = 0,
32 Damage = 1,
33 Gathering = 2,
34 Protection = 3,
35 FrostStrider = 4,
36 MendingInfinity = 5,
37 LoyaltyRiptide = 6,
38 };
39
40 enum class Frequency : int {
41 Common = 30,
42 Uncommon = 10,
43 Rare = 3,
44 VeryRare = 1,
45 };
46
47 enum class Type : uchar {
48 Protection = 0,
49 FireProtection = 1,
50 FeatherFalling = 2,
51 BlastProtection = 3,
52 ProjectileProtection = 4,
53 Thorns = 5,
54 Respiration = 6,
55 DepthStrider = 7,
56 AquaAffinity = 8,
57 Sharpness = 9,
58 Smite = 10,
59 BaneOfArthropods = 11,
60 Knockback = 12,
61 FireAspect = 13,
62 Looting = 14,
63 Efficiency = 15,
64 SilkTouch = 16,
65 Unbreaking = 17,
66 Fortune = 18,
67 Power = 19,
68 Punch = 20,
69 Flame = 21,
70 Infinity = 22,
71 LuckOfTheSea = 23,
72 Lure = 24,
73 FrostWalker = 25,
74 Mending = 26,
75 CurseOfBinding = 27,
76 CurseOfVanishing = 28,
77 Impaling = 29,
78 Riptide = 30,
79 Loyalty = 31,
80 Channeling = 32,
81 Multishot = 33,
82 Piercing = 34,
83 QuickCharge = 35,
84 SoulSpeed = 36,
85 SwiftSneak = 37,
86 WindBurst = 38,
87 Density = 39,
88 Breach = 40,
89 Lunge = 41,
90 NumEnchantments = 42,
91 InvalidEnchantment = 43,
92 };
93
94 enum class VillagerTrading : int {
95 NotAvailable = 0,
96 Available = 1,
97 };
98
99 using Slot = ::SharedTypes::EnchantSlot;
100
101public:
102 // member variables
103 // NOLINTBEGIN
104 ::ll::TypedStorage<1, 1, ::Enchant::Type const> mEnchantType;
105 ::ll::TypedStorage<4, 4, ::Enchant::Frequency const> mFrequency;
106 ::ll::TypedStorage<1, 1, bool const> mIsAvailableInVillagerTrading;
107 ::ll::TypedStorage<4, 4, int const> mPrimarySlots;
108 ::ll::TypedStorage<4, 4, int const> mSecondarySlots;
109 ::ll::TypedStorage<4, 4, int const> mCompatibility;
110 ::ll::TypedStorage<8, 32, ::std::string const> mDescription;
111 ::ll::TypedStorage<8, 48, ::HashedString const> mStringId;
112 ::ll::TypedStorage<8, 48, ::HashedString const> mScriptStringId;
113 ::ll::TypedStorage<1, 1, bool> mIsDisabled;
114 // NOLINTEND
115
116public:
117 // prevent constructor by default
118 Enchant();
119
120public:
121 // virtual functions
122 // NOLINTBEGIN
123 virtual ~Enchant();
124
125 virtual bool isCompatibleWith(::Enchant::Type type) const;
126
127 virtual int getMinCost(int level) const;
128
129 virtual int getMaxCost(int level) const;
130
131 virtual int getMinLevel() const;
132
133 virtual int getMaxLevel() const;
134
135 virtual int getDamageProtection(int level, ::ActorDamageSource const& source) const;
136
137 virtual float getAfterBreachArmorFraction(int level, float armorFraction) const;
138
139 virtual float getDamageBonus(int, ::Actor const&, ::Actor const&) const;
140
141 virtual void doPostAttack(::Actor& attacker, ::Actor& victim, int level) const;
142
143 virtual void doPostPiercingAttack(::Actor& attacker, int enchantLevel) const;
144
145 virtual void doPostItemHurtActor(::Actor&, ::Actor&, int) const;
146
147 virtual void doPostHurt(::ItemInstance& item, ::Actor& victim, ::Actor& attacker, int level) const;
148
149 virtual bool isMeleeDamageEnchant() const;
150
151 virtual bool isProtectionEnchant() const;
152
153 virtual bool isTreasureOnly() const;
154
155 virtual bool isDiscoverable() const;
156
157 virtual bool _isValidEnchantmentTypeForCategory(::Enchant::Type type) const;
158 // NOLINTEND
159
160public:
161 // member functions
162 // NOLINTBEGIN
163 MCAPI Enchant(
164 ::Enchant::Type type,
165 ::Enchant::Frequency frequency,
166 ::std::string_view stringId,
167 ::std::string_view scriptStringId,
168 ::std::string_view description,
169 ::Enchant::VillagerTrading isAvailableForVillagerTraining,
170 int primarySlots,
171 int secondarySlots
172 );
173
174 MCAPI ::std::string getDescriptionId() const;
175
176 MCFOLD ::Enchant::Type getEnchantType() const;
177
178#ifdef LL_PLAT_S
179 MCFOLD ::HashedString const& getScriptStringId() const;
180#endif
181
182 MCFOLD ::HashedString const& getStringId() const;
183
184 MCAPI bool isAvailable() const;
185
186 MCFOLD bool isDisabled() const;
187 // NOLINTEND
188
189public:
190 // static functions
191 // NOLINTBEGIN
192 MCAPI static ::SharedTypes::EnchantSlot enchantSlotFromString(::std::string_view str);
193
194 MCAPI static ::Enchant const* getEnchant(::Enchant::Type const& type);
195
196 MCAPI static ::Enchant const* getEnchantFromName(::HashedString const& name);
197
198 MCAPI static ::Enchant::Type getEnchantTypeFromName(::HashedString const& name);
199
200 MCAPI static void initEnchants(::BaseGameVersion const& baseGameVersion, ::Experiments const& experiments);
201
202 MCAPI static void shutdownEnchants();
203
204 MCAPI static ::std::string stringFromEnchantSlot(::SharedTypes::EnchantSlot const& enchantSlot);
205 // NOLINTEND
206
207public:
208 // static variables
209 // NOLINTBEGIN
210 MCAPI static ::std::unordered_map<::HashedString, ::Enchant::Type>& mEnchantNameToType();
211
212 MCAPI static ::std::unordered_map<
213 ::SharedTypes::EnchantSlot,
214 ::std::string,
216 ::std::equal_to<::SharedTypes::EnchantSlot>>&
217 mEnchantSlotTypeEnumToStringMap();
218
219 MCAPI static ::std::unordered_map<::std::string, ::SharedTypes::EnchantSlot>& mEnchantSlotTypeNameToEnumMap();
220
221 MCAPI static ::std::vector<::std::unique_ptr<::Enchant>>& mEnchants();
222 // NOLINTEND
223
224public:
225 // constructor thunks
226 // NOLINTBEGIN
227 MCAPI void* $ctor(
228 ::Enchant::Type type,
229 ::Enchant::Frequency frequency,
230 ::std::string_view stringId,
231 ::std::string_view scriptStringId,
232 ::std::string_view description,
233 ::Enchant::VillagerTrading isAvailableForVillagerTraining,
234 int primarySlots,
235 int secondarySlots
236 );
237 // NOLINTEND
238
239public:
240 // destructor thunk
241 // NOLINTBEGIN
242 MCAPI void $dtor();
243 // NOLINTEND
244
245public:
246 // virtual function thunks
247 // NOLINTBEGIN
248 MCAPI bool $isCompatibleWith(::Enchant::Type type) const;
249
250 MCAPI int $getMinCost(int level) const;
251
252 MCAPI int $getMaxCost(int level) const;
253
254 MCFOLD int $getMinLevel() const;
255
256 MCFOLD int $getMaxLevel() const;
257
258 MCFOLD int $getDamageProtection(int level, ::ActorDamageSource const& source) const;
259
260 MCFOLD float $getAfterBreachArmorFraction(int level, float armorFraction) const;
261
262 MCFOLD float $getDamageBonus(int, ::Actor const&, ::Actor const&) const;
263
264 MCFOLD void $doPostAttack(::Actor& attacker, ::Actor& victim, int level) const;
265
266 MCFOLD void $doPostPiercingAttack(::Actor& attacker, int enchantLevel) const;
267
268 MCFOLD void $doPostItemHurtActor(::Actor&, ::Actor&, int) const;
269
270 MCFOLD void $doPostHurt(::ItemInstance& item, ::Actor& victim, ::Actor& attacker, int level) const;
271
272 MCFOLD bool $isMeleeDamageEnchant() const;
273
274 MCFOLD bool $isProtectionEnchant() const;
275
276 MCFOLD bool $isTreasureOnly() const;
277
278 MCFOLD bool $isDiscoverable() const;
279
280 MCFOLD bool $_isValidEnchantmentTypeForCategory(::Enchant::Type type) const;
281
282
283 // NOLINTEND
284
285public:
286 // vftables
287 // NOLINTBEGIN
288 MCAPI static void** $vftable();
289 // NOLINTEND
290};
291
292// clang-format off
293template <>
294MCAPI ::ll::type_id_ref Bedrock::typeid_storage_impl<class CommandRegistry, ::Enchant::Type>();
295// clang-format on
Definition ActorDamageSource.h:18
Definition Actor.h:125
Definition BaseGameVersion.h:13
Definition Experiments.h:14
Definition HashedString.h:5
Definition ItemInstance.h:15
Definition EnchantSlotEnumHasher.h:5