neoLegacy/Minecraft.World/WrittenBookItem.cpp
SevenToaster509 546a279cc9 Book & Quill - Initial Commit
Implement Book & Quill:
- IUIScene_WritingBookMenu and UIScene_BookAndQuillMenu for UI
- Edited UIControl_Label to add direct editing (quite hardcoded to my needs right now)
- Reimplement scrapped custom payload packets for books and signing
- Other misc changes

TODO:
- Coloured and scambled text
- Book copying
- Clean up code
2026-04-05 15:05:03 +01:00

48 lines
1.3 KiB
C++

#include "stdafx.h"
#include "HtmlString.h"
#include "WrittenBook.h"
#include "../Minecraft.Client/Minecraft.h"
#include "../Minecraft.Client/MultiplayerLocalPlayer.h"
WrittenBookItem::WrittenBookItem(int id) : Item(id)
{
}
bool WrittenBookItem::isFoil(shared_ptr<ItemInstance> itemInstance)
{
return true;
}
const Rarity* WrittenBookItem::getRarity(shared_ptr<ItemInstance> itemInstance)
{
return Rarity::common;
}
shared_ptr<ItemInstance> WrittenBookItem::use(shared_ptr<ItemInstance> instance, Level* level, shared_ptr<Player> player)
{
//shared_ptr<MultiplayerLocalPlayer> player1 = Minecraft::GetInstance()->player;
//player1->openItemInstanceGui(instance, player1);
player->openItemInstanceGui(instance, player);
return instance;
}
bool WrittenBookItem::TestUse(shared_ptr<ItemInstance> itemInstance, Level* level, shared_ptr<Player> player)
{
return true;
}
void WrittenBookItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, vector<HtmlString>* lines, bool advanced)
{
if (!itemInstance->hasTag())
{
return;
}
HtmlString stringd = HtmlString(L"By " + (itemInstance->tag->getString(L"author")), eHTMLColor_7, false, false);
HtmlString stringf = HtmlString(L"Original", eHTMLColor_7, false, false);
lines->push_back(stringd);
lines->push_back(stringf);
//lines->push_back(wstring(L"tone"));
}