aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/EnchantmentHelper.h
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
commit7074f35e4ba831e358117842b99ee35b87f85ae5 (patch)
tree7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/EnchantmentHelper.h
parentd63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff)
shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
Diffstat (limited to 'Minecraft.World/EnchantmentHelper.h')
-rw-r--r--Minecraft.World/EnchantmentHelper.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/Minecraft.World/EnchantmentHelper.h b/Minecraft.World/EnchantmentHelper.h
index 9f7de5c5..18cc7266 100644
--- a/Minecraft.World/EnchantmentHelper.h
+++ b/Minecraft.World/EnchantmentHelper.h
@@ -12,9 +12,9 @@ private:
static Random random;
public:
- static int getEnchantmentLevel(int enchantmentId, shared_ptr<ItemInstance> piece);
- static unordered_map<int, int> *getEnchantments(shared_ptr<ItemInstance> item);
- static void setEnchantments(unordered_map<int, int> *enchantments, shared_ptr<ItemInstance> item);
+ static int getEnchantmentLevel(int enchantmentId, std::shared_ptr<ItemInstance> piece);
+ static unordered_map<int, int> *getEnchantments(std::shared_ptr<ItemInstance> item);
+ static void setEnchantments(unordered_map<int, int> *enchantments, std::shared_ptr<ItemInstance> item);
static int getEnchantmentLevel(int enchantmentId, ItemInstanceArray inventory);
@@ -27,7 +27,7 @@ private:
virtual void doEnchantment(Enchantment *enchantment, int level) = 0;
};
- static void runIterationOnItem(EnchantmentIterationMethod &method, shared_ptr<ItemInstance> piece);
+ static void runIterationOnItem(EnchantmentIterationMethod &method, std::shared_ptr<ItemInstance> piece);
static void runIterationOnInventory(EnchantmentIterationMethod &method, ItemInstanceArray inventory);
class GetDamageProtectionIteration : public EnchantmentIterationMethod
@@ -43,20 +43,20 @@ private:
/**
* Fetches the protection value for enchanted items.
- *
+ *
* @param inventory
* @param source
* @return
*/
public:
- static int getDamageProtection(shared_ptr<Inventory> inventory, DamageSource *source);
+ static int getDamageProtection(std::shared_ptr<Inventory> inventory, DamageSource *source);
private:
class GetDamageBonusIteration : public EnchantmentIterationMethod
{
public:
int sum;
- shared_ptr<Mob> target;
+ std::shared_ptr<Mob> target;
virtual void doEnchantment(Enchantment *enchantment, int level);
};
@@ -64,27 +64,27 @@ private:
static GetDamageBonusIteration getDamageBonusIteration;
/**
- *
+ *
* @param inventory
* @param target
* @return
*/
public:
- static int getDamageBonus(shared_ptr<Inventory> inventory, shared_ptr<Mob> target);
- static int getKnockbackBonus(shared_ptr<Inventory> inventory, shared_ptr<Mob> target);
- static int getFireAspect(shared_ptr<Mob> source);
- static int getOxygenBonus(shared_ptr<Inventory> inventory);
- static int getDiggingBonus(shared_ptr<Inventory> inventory);
- static int getDigDurability(shared_ptr<Inventory> inventory);
- static bool hasSilkTouch(shared_ptr<Inventory> inventory);
- static int getDiggingLootBonus(shared_ptr<Inventory> inventory);
- static int getKillingLootBonus(shared_ptr<Inventory> inventory);
- static bool hasWaterWorkerBonus(shared_ptr<Inventory> inventory);
- static int getArmorThorns(shared_ptr<Mob> source);
- static shared_ptr<ItemInstance> getRandomItemWith(Enchantment *enchantment, shared_ptr<Mob> source);
+ static int getDamageBonus(std::shared_ptr<Inventory> inventory, std::shared_ptr<Mob> target);
+ static int getKnockbackBonus(std::shared_ptr<Inventory> inventory, std::shared_ptr<Mob> target);
+ static int getFireAspect(std::shared_ptr<Mob> source);
+ static int getOxygenBonus(std::shared_ptr<Inventory> inventory);
+ static int getDiggingBonus(std::shared_ptr<Inventory> inventory);
+ static int getDigDurability(std::shared_ptr<Inventory> inventory);
+ static bool hasSilkTouch(std::shared_ptr<Inventory> inventory);
+ static int getDiggingLootBonus(std::shared_ptr<Inventory> inventory);
+ static int getKillingLootBonus(std::shared_ptr<Inventory> inventory);
+ static bool hasWaterWorkerBonus(std::shared_ptr<Inventory> inventory);
+ static int getArmorThorns(std::shared_ptr<Mob> source);
+ static std::shared_ptr<ItemInstance> getRandomItemWith(Enchantment *enchantment, std::shared_ptr<Mob> source);
/**
- *
+ *
* @param random
* @param slot
* The table slot, 0-2
@@ -94,17 +94,17 @@ public:
* Which item that is being enchanted.
* @return The enchantment cost, 0 means unchantable, 50 is max.
*/
- static int getEnchantmentCost(Random *random, int slot, int bookcases, shared_ptr<ItemInstance> itemInstance);
+ static int getEnchantmentCost(Random *random, int slot, int bookcases, std::shared_ptr<ItemInstance> itemInstance);
- static shared_ptr<ItemInstance> enchantItem(Random *random, shared_ptr<ItemInstance> itemInstance, int enchantmentCost);
+ static std::shared_ptr<ItemInstance> enchantItem(Random *random, std::shared_ptr<ItemInstance> itemInstance, int enchantmentCost);
/**
- *
+ *
* @param random
* @param itemInstance
* @param enchantmentCost
* @return
*/
- static vector<EnchantmentInstance *> *selectEnchantment(Random *random, shared_ptr<ItemInstance> itemInstance, int enchantmentCost);
- static unordered_map<int, EnchantmentInstance *> *getAvailableEnchantmentResults(int value, shared_ptr<ItemInstance> itemInstance);
+ static vector<EnchantmentInstance *> *selectEnchantment(Random *random, std::shared_ptr<ItemInstance> itemInstance, int enchantmentCost);
+ static unordered_map<int, EnchantmentInstance *> *getAvailableEnchantmentResults(int value, std::shared_ptr<ItemInstance> itemInstance);
}; \ No newline at end of file