aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/EnchantedBookItem.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/EnchantedBookItem.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.World/EnchantedBookItem.cpp')
-rw-r--r--Minecraft.World/EnchantedBookItem.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Minecraft.World/EnchantedBookItem.cpp b/Minecraft.World/EnchantedBookItem.cpp
index 70b15be4..88776c18 100644
--- a/Minecraft.World/EnchantedBookItem.cpp
+++ b/Minecraft.World/EnchantedBookItem.cpp
@@ -35,12 +35,12 @@ const Rarity *EnchantedBookItem::getRarity(shared_ptr<ItemInstance> itemInstance
ListTag<CompoundTag> *EnchantedBookItem::getEnchantments(shared_ptr<ItemInstance> item)
{
- if (item->tag == nullptr || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()))
+ if (item->tag == NULL || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()))
{
return new ListTag<CompoundTag>();
}
- return static_cast<ListTag<CompoundTag> *>(item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()));
+ return (ListTag<CompoundTag> *) item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str());
}
void EnchantedBookItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, vector<HtmlString> *lines, bool advanced)
@@ -49,7 +49,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, s
ListTag<CompoundTag> *list = getEnchantments(itemInstance);
- if (list != nullptr)
+ if (list != NULL)
{
wstring unformatted = L"";
for (int i = 0; i < list->size(); i++)
@@ -57,7 +57,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, s
int type = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID);
int level = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL);
- if (Enchantment::enchantments[type] != nullptr)
+ if (Enchantment::enchantments[type] != NULL)
{
lines->push_back(Enchantment::enchantments[type]->getFullname(level));
}
@@ -78,7 +78,7 @@ void EnchantedBookItem::addEnchantment(shared_ptr<ItemInstance> item, Enchantmen
{
if (tag->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL) < enchantment->level)
{
- tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast<short>(enchantment->level));
+ tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short) enchantment->level);
}
add = false;
@@ -90,8 +90,8 @@ void EnchantedBookItem::addEnchantment(shared_ptr<ItemInstance> item, Enchantmen
{
CompoundTag *tag = new CompoundTag();
- tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, static_cast<short>(enchantment->enchantment->id));
- tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast<short>(enchantment->level));
+ tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, (short) enchantment->enchantment->id);
+ tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short) enchantment->level);
enchantments->add(tag);
}
@@ -102,7 +102,7 @@ void EnchantedBookItem::addEnchantment(shared_ptr<ItemInstance> item, Enchantmen
shared_ptr<ItemInstance> EnchantedBookItem::createForEnchantment(EnchantmentInstance *enchant)
{
- shared_ptr<ItemInstance> item = std::make_shared<ItemInstance>(this);
+ shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>(new ItemInstance(this));
addEnchantment(item, enchant);
return item;
}
@@ -118,7 +118,7 @@ void EnchantedBookItem::createForEnchantment(Enchantment *enchant, vector<shared
shared_ptr<ItemInstance> EnchantedBookItem::createForRandomLoot(Random *random)
{
Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())];
- shared_ptr<ItemInstance> book = std::make_shared<ItemInstance>(id, 1, 0);
+ shared_ptr<ItemInstance> book = shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0));
int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel());
addEnchantment(book, new EnchantmentInstance(enchantment, level));
@@ -134,7 +134,7 @@ WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random)
WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random, int minCount, int maxCount, int weight)
{
Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())];
- shared_ptr<ItemInstance> book = std::make_shared<ItemInstance>(id, 1, 0);
+ shared_ptr<ItemInstance> book = shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0));
int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel());
addEnchantment(book, new EnchantmentInstance(enchantment, level));