summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-23 19:16:17 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-23 19:16:17 +0200
commit366af5067b987e7d4ad233e258b9e93d6f472afe (patch)
tree31ce4291a0b2b09250754795870ae9de5f4086f0 /src/WorldStorage/WSSAnvil.cpp
parentMerge pull request #1372 from mc-server/EntityCustomName (diff)
downloadcuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar.gz
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar.bz2
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar.lz
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar.xz
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.tar.zst
cuberite-366af5067b987e7d4ad233e258b9e93d6f472afe.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 10cc39083..8dc4088b7 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -96,10 +96,26 @@ cWSSAnvil::cWSSAnvil(cWorld * a_World, int a_CompressionFactor) :
if (!cFile::Exists(fnam))
{
cFastNBTWriter Writer;
- Writer.BeginCompound("");
- Writer.AddInt("SpawnX", (int)(a_World->GetSpawnX()));
- Writer.AddInt("SpawnY", (int)(a_World->GetSpawnY()));
- Writer.AddInt("SpawnZ", (int)(a_World->GetSpawnZ()));
+ Writer.BeginCompound("Data");
+ Writer.AddByte("allowCommands", 1);
+ Writer.AddByte("Difficulty", 2);
+ Writer.AddByte("hardcore", 0);
+ Writer.AddByte("initialized", 1);
+ Writer.AddByte("MapFeatures", 1);
+ Writer.AddByte("raining", a_World->IsWeatherRain() ? 1 : 0);
+ Writer.AddByte("thundering", a_World->IsWeatherStorm() ? 1 : 0);
+ Writer.AddInt("GameType", (int)a_World->GetGameMode());
+ Writer.AddInt("generatorVersion", 1);
+ Writer.AddInt("SpawnX", (int)a_World->GetSpawnX());
+ Writer.AddInt("SpawnY", (int)a_World->GetSpawnY());
+ Writer.AddInt("SpawnZ", (int)a_World->GetSpawnZ());
+ Writer.AddInt("version", 19133);
+ Writer.AddLong("DayTime", (Int64)a_World->GetTimeOfDay());
+ Writer.AddLong("Time", a_World->GetWorldAge());
+ Writer.AddLong("SizeOnDisk", 0);
+ Writer.AddString("generatorName", "default");
+ Writer.AddString("generatorOptions", "");
+ Writer.AddString("LevelName", a_World->GetName());
Writer.EndCompound();
Writer.Finish();
@@ -440,6 +456,13 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_
a_Writer.BeginCompound("Level");
a_Writer.AddInt("xPos", a_Chunk.m_ChunkX);
a_Writer.AddInt("zPos", a_Chunk.m_ChunkZ);
+
+ // Add "Entities" and "TileEntities". MCEdit can't load the chunk if one of these lists doesn't exists.
+ a_Writer.BeginList("Entities", TAG_Compound);
+ a_Writer.EndList();
+ a_Writer.BeginList("TileEntities", TAG_Compound);
+ a_Writer.EndList();
+
cNBTChunkSerializer Serializer(a_Writer);
if (!m_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, Serializer))
{
@@ -454,7 +477,10 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_
a_Writer.AddByteArray("Biomes", (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes));
a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes), ARRAYCOUNT(Serializer.m_Biomes));
}
-
+
+ // Save heightmap (Vanilla require this):
+ a_Writer.AddIntArray("HeightMap", (const int *)Serializer.m_VanillaHeightMap, ARRAYCOUNT(Serializer.m_VanillaHeightMap));
+
// Save blockdata:
a_Writer.BeginList("Sections", TAG_Compound);
size_t SliceSizeBlock = cChunkDef::Width * cChunkDef::Width * 16;
@@ -485,6 +511,9 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_
{
a_Writer.AddByte("MCSIsLightValid", 1);
}
+
+ // Save the world age to the chunk data. Required by vanilla and mcedit.
+ a_Writer.AddLong("LastUpdate", m_World->GetWorldAge());
// Store the flag that the chunk has all the ores, trees, dungeons etc. MCS chunks are always complete.
a_Writer.AddByte("TerrainPopulated", 1);