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() = default;
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, float) 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 const stringId,
167 ::std::string_view const scriptStringId,
168 ::std::string_view const description,
169 ::Enchant::VillagerTrading isAvailableForVillagerTraining,
170 int primarySlots,
171 int secondarySlots
172 );
173
174 MCAPI ::std::string getDescriptionId() const;
175 // NOLINTEND
176
177public:
178 // static functions
179 // NOLINTBEGIN
180 MCAPI static ::SharedTypes::EnchantSlot enchantSlotFromString(::std::string_view str);
181
182 MCAPI static ::Enchant const* getEnchantFromName(::HashedString const& name);
183
184 MCAPI static ::Enchant::Type getEnchantTypeFromName(::HashedString const& name);
185
186 MCAPI static void initEnchants(::BaseGameVersion const& baseGameVersion, ::Experiments const& experiments);
187
188 MCAPI static ::std::string stringFromEnchantSlot(::SharedTypes::EnchantSlot const& enchantSlot);
189 // NOLINTEND
190
191public:
192 // static variables
193 // NOLINTBEGIN
194 MCAPI static ::std::unordered_map<::HashedString, ::Enchant::Type>& mEnchantNameToType();
195
196 MCAPI static ::std::unordered_map<
197 ::SharedTypes::EnchantSlot,
198 ::std::string,
200 ::std::equal_to<::SharedTypes::EnchantSlot>>&
201 mEnchantSlotTypeEnumToStringMap();
202
203 MCAPI static ::std::unordered_map<::std::string, ::SharedTypes::EnchantSlot>& mEnchantSlotTypeNameToEnumMap();
204
205 MCAPI static ::std::vector<::std::unique_ptr<::Enchant>>& mEnchants();
206 // NOLINTEND
207
208public:
209 // constructor thunks
210 // NOLINTBEGIN
211 MCAPI void* $ctor(
212 ::Enchant::Type type,
213 ::Enchant::Frequency frequency,
214 ::std::string_view const stringId,
215 ::std::string_view const scriptStringId,
216 ::std::string_view const description,
217 ::Enchant::VillagerTrading isAvailableForVillagerTraining,
218 int primarySlots,
219 int secondarySlots
220 );
221 // NOLINTEND
222
223public:
224 // virtual function thunks
225 // NOLINTBEGIN
226 MCAPI bool $isCompatibleWith(::Enchant::Type type) const;
227
228 MCAPI int $getMinCost(int level) const;
229
230 MCAPI int $getMaxCost(int level) const;
231
232 MCFOLD int $getMinLevel() const;
233
234 MCFOLD int $getMaxLevel() const;
235
236 MCFOLD int $getDamageProtection(int level, ::ActorDamageSource const& source) const;
237
238 MCFOLD float $getAfterBreachArmorFraction(int, float) const;
239
240 MCFOLD float $getDamageBonus(int, ::Actor const&, ::Actor const&) const;
241
242 MCFOLD void $doPostAttack(::Actor& attacker, ::Actor& victim, int level) const;
243
244 MCFOLD void $doPostPiercingAttack(::Actor& attacker, int enchantLevel) const;
245
246 MCFOLD void $doPostItemHurtActor(::Actor&, ::Actor&, int) const;
247
248 MCFOLD void $doPostHurt(::ItemInstance& item, ::Actor& victim, ::Actor& attacker, int level) const;
249
250 MCFOLD bool $isMeleeDamageEnchant() const;
251
252 MCFOLD bool $isProtectionEnchant() const;
253
254 MCFOLD bool $isTreasureOnly() const;
255
256 MCFOLD bool $isDiscoverable() const;
257
258 MCFOLD bool $_isValidEnchantmentTypeForCategory(::Enchant::Type type) const;
259
260
261 // NOLINTEND
262};
263
264// clang-format off
265template <>
266MCAPI ::ll::type_id_ref Bedrock::typeid_storage_impl<class CommandRegistry, ::Enchant::Type>();
267// clang-format on
Definition ActorDamageSource.h:18
Definition Actor.h:113
Definition BaseGameVersion.h:8
Definition Experiments.h:10
Definition HashedString.h:5
Definition ItemInstance.h:15
Definition EnchantSlotEnumHasher.h:5