December 2014 files

This commit is contained in:
Loki Rautio
2026-03-01 11:00:23 -06:00
parent b691c43c44
commit 8fd3ac6e37
2049 changed files with 260190 additions and 134787 deletions

View File

@@ -2,14 +2,18 @@
#include "net.minecraft.world.entity.player.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.item.h"
#include "net.minecraft.world.h"
#include "ItemInstance.h"
#include "RecordingItem.h"
#include "GenericStats.h"
unordered_map<wstring, RecordingItem *> RecordingItem::BY_NAME;
RecordingItem::RecordingItem(int id, const wstring& recording) : Item(id), recording( recording )
{
this->maxStackSize = 1;
BY_NAME[recording] = this;
}
Icon *RecordingItem::getIcon(int auxValue)
@@ -20,13 +24,13 @@ Icon *RecordingItem::getIcon(int auxValue)
bool RecordingItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly)
{
// 4J-PB - Adding a test only version to allow tooltips to be displayed
if (level->getTile(x, y, z) == Tile::recordPlayer_Id && level->getData(x, y, z) == 0)
if (level->getTile(x, y, z) == Tile::jukebox_Id && level->getData(x, y, z) == 0)
{
if(!bTestUseOnOnly)
{
if (level->isClientSide) return true;
((RecordPlayerTile *) Tile::recordPlayer)->setRecord(level, x, y, z, id);
((JukeboxTile *) Tile::jukebox)->setRecord(level, x, y, z, itemInstance);
level->levelEvent(nullptr, LevelEvent::SOUND_PLAY_RECORDING, x, y, z, id);
itemInstance->count--;
@@ -40,17 +44,14 @@ bool RecordingItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Play
return false;
}
void RecordingItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, vector<wstring> *lines, bool advanced, vector<wstring> &unformattedStrings)
void RecordingItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, vector<HtmlString> *lines, bool advanced)
{
eMinecraftColour rarityColour = getRarity(shared_ptr<ItemInstance>())->color;
int colour = app.GetHTMLColour(rarityColour);
wchar_t formatted[256];
eMinecraftColour color = getRarity(shared_ptr<ItemInstance>())->color;
swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,L"C418 - ", recording.c_str());
wchar_t text[256];
swprintf(text, 256, L"%ls %ls", L"C418 -", recording.c_str());
lines->push_back(formatted);
unformattedStrings.push_back(recording);
lines->push_back(HtmlString(text, color));
}
const Rarity *RecordingItem::getRarity(shared_ptr<ItemInstance> itemInstance)
@@ -62,3 +63,16 @@ void RecordingItem::registerIcons(IconRegister *iconRegister)
{
icon = iconRegister->registerIcon(L"record_" + recording);
}
RecordingItem *RecordingItem::getByName(const wstring &name)
{
AUTO_VAR(it,BY_NAME.find(name));
if(it != BY_NAME.end())
{
return it->second;
}
else
{
return NULL;
}
}