Files
GabsPuNs-Project_Zenith_Main/Minecraft.World/StructureFeatureSavedData.cpp
GabsPuNs 3b09eb95db New File System and Cleanup some code Part 3
* Remove stdafx.h and some <unordered_set> includes
* Update Minecraft Server Defines and remove more unused folders/files
* Unbloat stdafx.h from Minecraft.World
2026-06-07 00:10:47 -04:00

49 lines
1.1 KiB
C++

#include "StructureFeatureSavedData.h"
wstring StructureFeatureSavedData::TAG_FEATURES = L"Features";
StructureFeatureSavedData::StructureFeatureSavedData(const wstring &idName) : SavedData(idName)
{
this->pieceTags = new CompoundTag(TAG_FEATURES);
}
StructureFeatureSavedData::~StructureFeatureSavedData()
{
delete pieceTags;
}
void StructureFeatureSavedData::load(CompoundTag *tag)
{
this->pieceTags = tag->getCompound(TAG_FEATURES);
}
void StructureFeatureSavedData::save(CompoundTag *tag)
{
tag->put(TAG_FEATURES, pieceTags->copy() );
}
void StructureFeatureSavedData::putFeatureTag(byteArray data, int chunkX, int chunkZ)
{
wstring name = createFeatureTagId(chunkX, chunkZ);
if (pieceTags->contains(name))
{
delete pieceTags->getCompound(name);
pieceTags->remove(name);
}
CompoundTag* tag = new CompoundTag(name);
tag->putByteArray(L"data", data);
pieceTags->put(name, tag);
}
wstring StructureFeatureSavedData::createFeatureTagId(int chunkX, int chunkZ)
{
return L"[" + std::to_wstring(chunkX) + L"," + std::to_wstring(chunkZ) + L"]";
}
CompoundTag *StructureFeatureSavedData::getFullTag()
{
return pieceTags;
}