mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-21 21:13:53 +00:00
parent
8a2a62ea1d
commit
119bff3514
1373 changed files with 12049 additions and 12049 deletions
|
|
@ -34,24 +34,24 @@ void SimpleContainer::removeListener(net_minecraft_world::ContainerListener *lis
|
|||
listeners->erase( it );
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> SimpleContainer::getItem(unsigned int slot)
|
||||
shared_ptr<ItemInstance> SimpleContainer::getItem(unsigned int slot)
|
||||
{
|
||||
return (*items)[slot];
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> SimpleContainer::removeItem(unsigned int slot, int count)
|
||||
shared_ptr<ItemInstance> SimpleContainer::removeItem(unsigned int slot, int count)
|
||||
{
|
||||
if ((*items)[slot] != NULL) {
|
||||
if ((*items)[slot]->count <= count)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = (*items)[slot];
|
||||
shared_ptr<ItemInstance> item = (*items)[slot];
|
||||
(*items)[slot] = nullptr;
|
||||
this->setChanged();
|
||||
return item;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<ItemInstance> i = (*items)[slot]->remove(count);
|
||||
shared_ptr<ItemInstance> i = (*items)[slot]->remove(count);
|
||||
if ((*items)[slot]->count == 0) (*items)[slot] = nullptr;
|
||||
this->setChanged();
|
||||
return i;
|
||||
|
|
@ -60,18 +60,18 @@ std::shared_ptr<ItemInstance> SimpleContainer::removeItem(unsigned int slot, int
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> SimpleContainer::removeItemNoUpdate(int slot)
|
||||
shared_ptr<ItemInstance> SimpleContainer::removeItemNoUpdate(int slot)
|
||||
{
|
||||
if ((*items)[slot] != NULL)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = (*items)[slot];
|
||||
shared_ptr<ItemInstance> item = (*items)[slot];
|
||||
(*items)[slot] = nullptr;
|
||||
return item;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SimpleContainer::setItem(unsigned int slot, std::shared_ptr<ItemInstance> item)
|
||||
void SimpleContainer::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
(*items)[slot] = item;
|
||||
if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize();
|
||||
|
|
@ -104,7 +104,7 @@ void SimpleContainer::setChanged()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool SimpleContainer::stillValid(std::shared_ptr<Player> player)
|
||||
bool SimpleContainer::stillValid(shared_ptr<Player> player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue