Skip to content
LeviMC
English
AutoLightDark
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 IRandom;
17class Item;
18class ItemEnchants;
19class ItemStack;
20class ItemStackBase;
21class Mob;
22class Vec3;
23struct ActorUniqueID;
24struct EnchantResult;
25namespace Bedrock::Safety { class RedactableString; }
26// clang-format on
27
28namespace EnchantUtils {
29// functions
30// NOLINTBEGIN
31LLNDAPI ::std::vector<::std::pair<::EnchantmentInstance, int>>
32getAvailableEnchantmentResults(::Item const* item, int value, bool treasure);
33
34MCNAPI void appendEnchantToFormattedText(
35 ::Enchant::Type type,
36 ::std::string_view enchantName,
37 ::Bedrock::Safety::RedactableString& formattedEnchantmentText
38);
39
40MCAPI bool applyEnchant(::ItemStackBase& out, ::EnchantmentInstance const& enchant, bool allowNonVanilla);
41
42MCAPI int applyEnchant(::ItemStackBase& out, ::ItemEnchants const& enchants, bool allowNonVanilla);
43
44MCNAPI float
45calculateAfterBreachArmorFraction(::ActorUniqueID const& attackerID, ::Mob const& target, float armorFraction);
46
47MCAPI ::EnchantResult
48canEnchant(::ItemStackBase const& item, ::EnchantmentInstance const& enchant, bool allowNonVanilla);
49
50MCAPI int
51combineEnchantedItems(::ItemStack const& first, ::ItemStack const& second, ::ItemStack& out, bool bookEnchant);
52
53MCNAPI void doPostHurtEffects(::Mob& victim, ::Mob& attacker);
54
55MCNAPI void doPostPiercingAttackEffects(::Actor& attacker);
56
57MCNAPI void doPreDamageEffects(::Actor& victim, ::Actor& attacker);
58
59MCAPI ::std::vector<::Vec3> getBookCasePositions(::BlockSource& source, ::Vec3 const& pos);
60
61MCNAPI void getCurses(::ItemStackBase const& item, ::std::vector<::EnchantmentInstance>& outputCurses);
62
63MCNAPI float getDamageReduction(::ActorDamageSource const& source, ::Mob const& target);
64
65MCAPI ::std::vector<int> getEnchantCosts(::IRandom& random, ::ItemStackBase const& itemInst, int bookcaseCount);
66
67MCAPI int getEnchantLevel(::Enchant::Type enchantType, ::ItemStackBase const& stack);
68
69MCAPI ::std::string getEnchantNameAndLevel(::Enchant::Type id, int level);
70
71#ifdef LL_PLAT_C
72MCNAPI ::std::string getEnchantStringId(::Enchant::Type id);
73#endif
74
75MCNAPI ::std::vector<::Vec3> getEnchantingTablePositions(::BlockSource& source, ::Vec3 const& pos);
76
77MCAPI ::Enchant::Type getEnchantmentId(::HashedString const& stringId);
78
79MCNAPI float getMeleeDamageBonus(::Actor const& victim, ::Actor const& attacker);
80
81MCAPI ::ItemStack const& getRandomDamagedItemWithMending(::IRandom& random, ::Mob const& equipped);
82
83MCNAPI ::ItemStack const& getRandomItemWith(::Enchant::Type type, ::Mob const& equipped, ::EquipmentFilter filter);
84
85MCNAPI ::std::string getRandomName(::IRandom& random);
86
87MCNAPI int getTotalProtectionLevels(::Enchant::Type type, ::Mob const& target);
88
89MCNAPI int getTradeableRandomEnchantIndex(::IRandom& random);
90
91MCAPI bool hasEnchant(::Enchant::Type enchantType, ::ItemStackBase const& item);
92
93MCAPI void randomlyEnchant(::IRandom& random, ::ItemStackBase& out, int cost, int valueBuff, bool treasure);
94
95MCAPI void removeEnchants(::ItemStack& out);
96
97MCNAPI ::ItemEnchants
98selectEnchantments(::IRandom& random, ::Item const* item, int enchantCost, int valueBuff, bool treasure);
99// NOLINTEND
100
101} // namespace EnchantUtils
Definition ActorDamageSource.h:18
Definition Actor.h:116
Definition RedactableString.h:10
Definition BlockSource.h:72
Definition EnchantmentInstance.h:8
Definition HashedString.h:5
Definition IRandom.h:10
Definition ItemEnchants.h:13
Definition ItemStackBase.h:45
Definition ItemStack.h:26
Definition Item.h:73
Definition Mob.h:58
Definition Vec3.h:10
Definition ActorUniqueID.h:5
Definition EnchantResult.h:8