TU19: merge Minecraft.World/Containers

keeping virtual destructors where possible
This commit is contained in:
Tropical
2026-03-21 15:18:52 -05:00
parent db0a6b2e6a
commit f25cd66f4d
56 changed files with 1412 additions and 373 deletions

View File

@@ -1,6 +1,6 @@
#include "../Platform/stdafx.h"
#include "../Headers/net.minecraft.world.entity.player.h"
#include "../Network/Packets/ContainerOpenPacket.h"
#include "CompoundContainer.h"
CompoundContainer::CompoundContainer(int name, std::shared_ptr<Container> c1,
@@ -12,11 +12,33 @@ CompoundContainer::CompoundContainer(int name, std::shared_ptr<Container> c1,
this->c2 = c2;
}
int CompoundContainer::getContainerType() {
return ContainerOpenPacket::LARGE_CHEST;
}
unsigned int CompoundContainer::getContainerSize() {
return c1->getContainerSize() + c2->getContainerSize();
}
int CompoundContainer::getName() { return name; }
bool CompoundContainer::contains(std::shared_ptr<Container> c) {
return c1 == c || c2 == c;
}
std::wstring CompoundContainer::getName() {
if (c1->hasCustomName()) return c1->getName();
if (c2->hasCustomName()) return c2->getName();
return app.GetString(name);
}
std::wstring CompoundContainer::getCustomName() {
if (c1->hasCustomName()) return c1->getName();
if (c2->hasCustomName()) return c2->getName();
return L"";
}
bool CompoundContainer::hasCustomName() {
return c1->hasCustomName() || c2->hasCustomName();
}
std::shared_ptr<ItemInstance> CompoundContainer::getItem(unsigned int slot) {
if (slot >= c1->getContainerSize())
@@ -67,4 +89,9 @@ void CompoundContainer::startOpen() {
void CompoundContainer::stopOpen() {
c1->stopOpen();
c2->stopOpen();
}
bool CompoundContainer::canPlaceItem(int slot,
std::shared_ptr<ItemInstance> item) {
return true;
}