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:
@@ -6,7 +6,7 @@
|
||||
#include "net.minecraft.stats.h"
|
||||
#include "BrewingStandMenu.h"
|
||||
|
||||
BrewingStandMenu::BrewingStandMenu(shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand)
|
||||
BrewingStandMenu::BrewingStandMenu(std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand)
|
||||
{
|
||||
tc = 0;
|
||||
|
||||
@@ -57,14 +57,14 @@ void BrewingStandMenu::setData(int id, int value)
|
||||
if (id == 0) brewingStand->setBrewTime(value);
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::stillValid(shared_ptr<Player> player)
|
||||
bool BrewingStandMenu::stillValid(std::shared_ptr<Player> player)
|
||||
{
|
||||
return brewingStand->stillValid(player);
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex)
|
||||
std::shared_ptr<ItemInstance> BrewingStandMenu::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);
|
||||
Slot *PotionSlot1 = slots->at(BOTTLE_SLOT_START);
|
||||
@@ -73,7 +73,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
shared_ptr<ItemInstance> stack = slot->getItem();
|
||||
std::shared_ptr<ItemInstance> stack = slot->getItem();
|
||||
clicked = stack->copy();
|
||||
|
||||
if ((slotIndex >= BOTTLE_SLOT_START && slotIndex <= BOTTLE_SLOT_END) || (slotIndex == INGREDIENT_SLOT))
|
||||
@@ -101,7 +101,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END)
|
||||
{
|
||||
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
|
||||
if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) &&
|
||||
if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) &&
|
||||
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ) )
|
||||
{
|
||||
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
|
||||
@@ -125,7 +125,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
else if (slotIndex >= USE_ROW_SLOT_START && slotIndex < USE_ROW_SLOT_END)
|
||||
{
|
||||
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
|
||||
if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) &&
|
||||
if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) &&
|
||||
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ))
|
||||
{
|
||||
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
|
||||
@@ -140,7 +140,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!moveItemStackTo(stack, INV_SLOT_START, INV_SLOT_END, false))
|
||||
{
|
||||
return nullptr;
|
||||
@@ -173,12 +173,12 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
return clicked;
|
||||
}
|
||||
|
||||
BrewingStandMenu::PotionSlot::PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x, y)
|
||||
BrewingStandMenu::PotionSlot::PotionSlot(std::shared_ptr<Player> player, std::shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x, y)
|
||||
{
|
||||
this->player = player;
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::PotionSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
bool BrewingStandMenu::PotionSlot::mayPlace(std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
return mayPlaceItem(item);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ int BrewingStandMenu::PotionSlot::getMaxStackSize()
|
||||
return 1;
|
||||
}
|
||||
|
||||
void BrewingStandMenu::PotionSlot::onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried)
|
||||
void BrewingStandMenu::PotionSlot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried)
|
||||
{
|
||||
carried->onCraftedBy(this->player->level, dynamic_pointer_cast<Player>( this->player->shared_from_this() ), 1);
|
||||
if (carried->id == Item::potion_Id && carried->getAuxValue() > 0)
|
||||
@@ -196,23 +196,23 @@ void BrewingStandMenu::PotionSlot::onTake(shared_ptr<Player> player, shared_ptr<
|
||||
Slot::onTake(player, carried);
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr<ItemInstance> second)
|
||||
bool BrewingStandMenu::PotionSlot::mayCombine(std::shared_ptr<ItemInstance> second)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr<ItemInstance> item)
|
||||
bool BrewingStandMenu::PotionSlot::mayPlaceItem(std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x ,y)
|
||||
BrewingStandMenu::IngredientsSlot::IngredientsSlot(std::shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x ,y)
|
||||
{
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
bool BrewingStandMenu::IngredientsSlot::mayPlace(std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (item != NULL)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BrewingStandMenu::IngredientsSlot::mayCombine(shared_ptr<ItemInstance> second)
|
||||
bool BrewingStandMenu::IngredientsSlot::mayCombine(std::shared_ptr<ItemInstance> second)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user