Files
MinecraftConsoles/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp
ModMaker101 a9be52c41a Project modernization (#630)
* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
2026-03-08 09:56:03 +07:00

45 lines
1.1 KiB
C++

#include "stdafx.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.h"
#include "Tutorial.h"
#include "TakeItemHint.h"
TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength)
: TutorialHint(id, tutorial, -1, e_Hint_TakeItem)
{
m_iItemsCount = itemsLength;
m_iItems= new int [m_iItemsCount];
for(unsigned int i=0;i<m_iItemsCount;i++)
{
m_iItems[i]=items[i];
}
}
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item)
{
if(item != nullptr)
{
bool itemFound = false;
for(unsigned int i=0;i<m_iItemsCount;i++)
{
if(item->id == m_iItems[i])
{
itemFound = true;
break;
}
}
if(itemFound)
{
// Display hint
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails();
message->m_messageId = item->getUseDescriptionId();
message->m_titleId = item->getDescriptionId();
message->m_icon = item->id;
message->m_delay = true;
return m_tutorial->setMessage(this, message);
}
}
return false;
}