mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-22 02:35:26 +00:00
TU24
This commit is contained in:
@@ -61,17 +61,11 @@ wstring StructureFeatureIO::getEncodeId(StructurePiece *piece)
|
||||
}
|
||||
}
|
||||
|
||||
StructureStart *StructureFeatureIO::loadStaticStart(ByteArrayTag *tag, Level *level)
|
||||
StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *level)
|
||||
{
|
||||
StructureStart *start = nullptr;
|
||||
|
||||
ByteArrayInputStream bais(tag->data);
|
||||
DataInputStream dis(&bais);
|
||||
|
||||
int version = dis.readInt();
|
||||
wstring structureId = dis.readUTF();
|
||||
|
||||
auto it = startIdClassMap.find( structureId );
|
||||
auto it = startIdClassMap.find(tag->getString(L"id"));
|
||||
if(it != startIdClassMap.end())
|
||||
{
|
||||
start = (it->second)();
|
||||
@@ -79,30 +73,20 @@ StructureStart *StructureFeatureIO::loadStaticStart(ByteArrayTag *tag, Level *le
|
||||
|
||||
if (start != nullptr)
|
||||
{
|
||||
if (!version && !start->isValid())
|
||||
{
|
||||
start->clearDirty();
|
||||
start = nullptr;
|
||||
|
||||
app.DebugPrintf("Skipping Structure with id %ls as it was a broken data version\n", it->first.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
start->load(level, &dis);
|
||||
}
|
||||
start->load(level, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf( "Skipping Structure with id %ls", it->first.c_str() );
|
||||
app.DebugPrintf( "Skipping Structure with id %ls", tag->getString(L"id").c_str() );
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
StructurePiece *StructureFeatureIO::loadStaticPiece(DataInputStream *dis, Level *level)
|
||||
StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *level)
|
||||
{
|
||||
StructurePiece *piece = nullptr;
|
||||
|
||||
auto it = pieceIdClassMap.find(dis->readUTF() );
|
||||
auto it = pieceIdClassMap.find(tag->getString(L"id"));
|
||||
if(it != pieceIdClassMap.end())
|
||||
{
|
||||
piece = (it->second)();
|
||||
@@ -110,11 +94,11 @@ StructurePiece *StructureFeatureIO::loadStaticPiece(DataInputStream *dis, Level
|
||||
|
||||
if (piece != nullptr)
|
||||
{
|
||||
piece->load(level, dis);
|
||||
piece->load(level, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf( "Skipping Piece with id %ls", it->first.c_str() );
|
||||
app.DebugPrintf( "Skipping Piece with id %ls", tag->getString(L"id").c_str() );
|
||||
}
|
||||
return piece;
|
||||
}
|
||||
Reference in New Issue
Block a user