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