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.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -7,9 +7,9 @@
#include "net.minecraft.world.item.enchantment.h"
#include "EnchantmentMenu.h"
EnchantmentMenu::EnchantmentMenu(shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt)
EnchantmentMenu::EnchantmentMenu(std::shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt)
{
enchantSlots = shared_ptr<EnchantmentContainer>( new EnchantmentContainer(this) );
enchantSlots = std::shared_ptr<EnchantmentContainer>( new EnchantmentContainer(this) );
for(int i = 0; i < 3; ++i)
{
@@ -77,9 +77,9 @@ void EnchantmentMenu::setData(int id, int value)
}
}
void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr<Container> container but wasn't using it, so removed to simplify things
void EnchantmentMenu::slotsChanged() // 4J used to take a std::shared_ptr<Container> container but wasn't using it, so removed to simplify things
{
shared_ptr<ItemInstance> item = enchantSlots->getItem(0);
std::shared_ptr<ItemInstance> item = enchantSlots->getItem(0);
if (item == NULL || !item->isEnchantable())
{
@@ -150,9 +150,9 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr<Container>
}
}
bool EnchantmentMenu::clickMenuButton(shared_ptr<Player> player, int i)
bool EnchantmentMenu::clickMenuButton(std::shared_ptr<Player> player, int i)
{
shared_ptr<ItemInstance> item = enchantSlots->getItem(0);
std::shared_ptr<ItemInstance> item = enchantSlots->getItem(0);
if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) )
{
if (!level->isClientSide)
@@ -194,34 +194,34 @@ bool EnchantmentMenu::clickMenuButton(shared_ptr<Player> player, int i)
}
void EnchantmentMenu::removed(shared_ptr<Player> player)
void EnchantmentMenu::removed(std::shared_ptr<Player> player)
{
AbstractContainerMenu::removed(player);
if (level->isClientSide) return;
shared_ptr<ItemInstance> item = enchantSlots->removeItemNoUpdate(0);
std::shared_ptr<ItemInstance> item = enchantSlots->removeItemNoUpdate(0);
if (item != NULL)
{
player->drop(item);
}
}
bool EnchantmentMenu::stillValid(shared_ptr<Player> player)
bool EnchantmentMenu::stillValid(std::shared_ptr<Player> player)
{
if (level->getTile(x, y, z) != Tile::enchantTable_Id) return false;
if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false;
return true;
}
shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex)
std::shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex)
{
shared_ptr<ItemInstance> clicked = nullptr;
std::shared_ptr<ItemInstance> clicked = nullptr;
Slot *slot = slots->at(slotIndex);
Slot *IngredientSlot = slots->at(INGREDIENT_SLOT);
if (slot != NULL && slot->hasItem())
{
shared_ptr<ItemInstance> stack = slot->getItem();
std::shared_ptr<ItemInstance> stack = slot->getItem();
clicked = stack->copy();
if (slotIndex == INGREDIENT_SLOT)
@@ -238,8 +238,8 @@ shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> play
else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END)
{
// if the item is an enchantable tool
if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) )
if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) )
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
{
@@ -258,7 +258,7 @@ shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> play
{
// if the item is an enchantable tool
if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) )
if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) )
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
{