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/SimpleContainer.cpp | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'Minecraft.World/SimpleContainer.cpp') diff --git a/Minecraft.World/SimpleContainer.cpp b/Minecraft.World/SimpleContainer.cpp index e29bc790..147bab0a 100644 --- a/Minecraft.World/SimpleContainer.cpp +++ b/Minecraft.World/SimpleContainer.cpp @@ -5,9 +5,11 @@ #include "SimpleContainer.h" -SimpleContainer::SimpleContainer(int name, int size) +SimpleContainer::SimpleContainer(int name, wstring stringName, bool customName, int size) { this->name = name; + this->stringName = stringName; + this->customName = customName; this->size = size; items = new ItemInstanceArray( size ); @@ -46,14 +48,14 @@ shared_ptr SimpleContainer::removeItem(unsigned int slot, int coun { shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; - this->setChanged(); + setChanged(); return item; } else { shared_ptr i = (*items)[slot]->remove(count); if ((*items)[slot]->count == 0) (*items)[slot] = nullptr; - this->setChanged(); + setChanged(); return i; } } @@ -75,7 +77,7 @@ void SimpleContainer::setItem(unsigned int slot, shared_ptr item) { (*items)[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); - this->setChanged(); + setChanged(); } unsigned int SimpleContainer::getContainerSize() @@ -83,9 +85,25 @@ unsigned int SimpleContainer::getContainerSize() return size; } -int SimpleContainer::getName() +wstring SimpleContainer::getName() { - return name; + return stringName.empty() ? app.GetString(name) : stringName; +} + +wstring SimpleContainer::getCustomName() +{ + return hasCustomName() ? stringName : L""; +} + +bool SimpleContainer::hasCustomName() +{ + return customName; +} + +void SimpleContainer::setCustomName(const wstring &name) +{ + customName = true; + this->stringName = name; } int SimpleContainer::getMaxStackSize() @@ -95,16 +113,18 @@ int SimpleContainer::getMaxStackSize() void SimpleContainer::setChanged() { - // 4J - removing this as we don't seem to have any implementation of a listener containerChanged function, and shared_from_this is proving tricky to add to containers -#if 0 if (listeners != NULL) for (unsigned int i = 0; i < listeners->size(); i++) { - listeners->at(i)->containerChanged(shared_from_this()); + listeners->at(i)->containerChanged();//shared_from_this()); } -#endif } bool SimpleContainer::stillValid(shared_ptr player) +{ + return true; +} + +bool SimpleContainer::canPlaceItem(int slot, shared_ptr item) { return true; } \ No newline at end of file -- cgit v1.2.3