LeviLamina
Loading...
Searching...
No Matches
EnchantUtils.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/item/enchanting/Enchant.h"
7#include "mc/world/item/enchanting/EquipmentFilter.h"
8
9// auto generated forward declare list
10// clang-format off
11class Actor;
13class BlockSource;
15class HashedString;
16class Item;
17class ItemEnchants;
18class ItemInstance;
19class ItemStack;
20class ItemStackBase;
21class Mob;
22class Random;
23class Vec3;
24struct ActorUniqueID;
25struct EnchantResult;
26namespace Bedrock::Safety { class RedactableString; }
27// clang-format on
28
29namespace EnchantUtils {
30// functions
31// NOLINTBEGIN
32MCAPI void appendEnchantToFormattedText(
33 ::Enchant::Type type,
34 ::std::string_view enchantName,
35 ::Bedrock::Safety::RedactableString& formattedEnchantmentText
36);
37
38MCAPI bool applyEnchant(::ItemStackBase& out, ::EnchantmentInstance const& enchant, bool allowNonVanilla);
39
40MCAPI bool applyEnchant(::ItemStackBase& out, ::Enchant::Type type, int level, bool allowNonVanilla);
41
42MCAPI int applyEnchant(::ItemStackBase& out, ::ItemEnchants const& enchants, bool allowNonVanilla);
43
44MCAPI float
45calculateAfterBreachArmorFraction(::ActorUniqueID const& attackerID, ::Mob const& target, float armorFraction);
46
47MCAPI ::EnchantResult
48canEnchant(::ItemStackBase const& item, ::EnchantmentInstance const& enchant, bool allowNonVanilla);
49
50MCAPI ::EnchantResult canEnchant(::ItemStackBase const& item, ::Enchant::Type type, int level, bool allowNonVanilla);
51
52MCAPI int
53combineEnchantedItems(::ItemStack const& first, ::ItemStack const& second, ::ItemStack& out, bool bookEnchant);
54
55MCAPI void doPostHurtEffects(::Mob& victim, ::Mob& attacker);
56
57MCAPI void doPostItemHurtActorEffects(::Actor& victim, ::Actor& attacker, ::ItemEnchants const& preHurtEnchantments);
58
59MCAPI void doPostPiercingAttackEffects(::Actor& attacker);
60
61MCAPI void doPreDamageEffects(::Actor& victim, ::Actor& attacker);
62
63MCAPI ::ItemInstance generateEnchantedBook(::EnchantmentInstance const& enchant);
64
65MCAPI ::std::vector<::std::pair<::EnchantmentInstance, int>>
66getAvailableEnchantmentResults(::Item const* item, int value, bool treasure);
67
68MCAPI ::std::vector<::Vec3> getBookCasePositions(::BlockSource& source, ::Vec3 const& pos);
69
70MCAPI void getCurses(::ItemStackBase const& item, ::std::vector<::EnchantmentInstance>& outputCurses);
71
72MCAPI float getDamageReduction(::ActorDamageSource const& source, ::Mob const& target);
73
74MCAPI ::std::vector<int> getEnchantCosts(::ItemStackBase const& itemInst, int bookcaseCount);
75
76MCAPI int getEnchantLevel(::Enchant::Type enchantType, ::ItemStackBase const& stack);
77
78MCAPI ::std::string getEnchantNameAndLevel(::Enchant::Type id, int level);
79
80#ifdef LL_PLAT_C
81MCAPI ::std::string getEnchantStringId(::Enchant::Type id);
82#endif
83
84MCAPI ::std::vector<::Vec3> getEnchantingTablePositions(::BlockSource& source, ::Vec3 const& pos);
85
86MCAPI ::Enchant::Type getEnchantmentId(::HashedString const& stringId);
87
88MCAPI ::std::string getLevelString(int level);
89
90MCAPI float getMeleeDamageBonus(::Actor const& victim, ::Actor const& attacker);
91
92MCAPI ::ItemStack const& getRandomDamagedItemWithMending(::Mob const& equipped);
93
94MCAPI ::ItemStack const& getRandomItemWith(::Enchant::Type type, ::Mob const& equipped, ::EquipmentFilter filter);
95
96MCAPI ::std::string getRandomName();
97
98MCAPI int getTotalProtectionLevels(::Enchant::Type type, ::Mob const& target);
99
100MCAPI int getTradeableRandomEnchantIndex(::Random& random);
101
102MCAPI bool hasCurse(::ItemStackBase const& item);
103
104MCAPI bool hasEnchant(::Enchant::Type enchantType, ::ItemStackBase const& item);
105
106MCAPI bool isCurse(::Enchant::Type enchantType);
107
108MCFOLD void randomlyEnchant(::ItemInstance& out, int cost, int valueBuff, bool treasure);
109
110MCFOLD void randomlyEnchant(::ItemStack& out, int cost, int valueBuff, bool treasure);
111
112MCAPI void removeEnchants(::ItemStack& out);
113
114MCAPI ::ItemEnchants selectEnchantments(::Item const* item, int enchantCost, int valueBuff, bool treasure);
115// NOLINTEND
116
117} // namespace EnchantUtils
Definition ActorDamageSource.h:18
Definition Actor.h:125
Definition RedactableString.h:10
Definition BlockSource.h:73
Definition EnchantmentInstance.h:8
Definition HashedString.h:5
Definition ItemEnchants.h:15
Definition ItemInstance.h:15
Definition ItemStackBase.h:52
Definition ItemStack.h:35
Definition Item.h:71
Definition Mob.h:57
Definition Random.h:10
Definition Vec3.h:10
Definition ActorUniqueID.h:10
Definition EnchantResult.h:8