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