From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: feat: TU19 (Dec 2014) Features & Content (#155) * try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki --- Minecraft.World/RecordingItem.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'Minecraft.World/RecordingItem.cpp') diff --git a/Minecraft.World/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 24be1190..3b501899 100644 --- a/Minecraft.World/RecordingItem.cpp +++ b/Minecraft.World/RecordingItem.cpp @@ -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 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, shared_ptr 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, shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void RecordingItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced) { - eMinecraftColour rarityColour = getRarity(shared_ptr())->color; - int colour = app.GetHTMLColour(rarityColour); - wchar_t formatted[256]; - - swprintf(formatted, 256, L"%ls",colour,L"C418 - ", recording.c_str()); + eMinecraftColour color = getRarity(shared_ptr())->color; - lines->push_back(formatted); + wchar_t text[256]; + swprintf(text, 256, L"%ls %ls", L"C418 -", recording.c_str()); - unformattedStrings.push_back(recording); + lines->push_back(HtmlString(text, color)); } const Rarity *RecordingItem::getRarity(shared_ptr 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; + } +} \ No newline at end of file -- cgit v1.2.3