diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-24 15:17:20 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-24 15:17:20 +0200 |
commit | 1d588b5195507f52c25d57a627c3304c024770ce (patch) | |
tree | 7d8e0f404ae062a37049e9532e2dceb9ae5ddb09 /src/WorldStorage | |
parent | Merge branch 'master' into WorldLoader (diff) | |
download | cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar.gz cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar.bz2 cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar.lz cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar.xz cuberite-1d588b5195507f52c25d57a627c3304c024770ce.tar.zst cuberite-1d588b5195507f52c25d57a627c3304c024770ce.zip |
Diffstat (limited to 'src/WorldStorage')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 12 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index 0e364d8b0..a052bf5f3 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -81,6 +81,18 @@ void cNBTChunkSerializer::Finish(void) memset(m_BlockLight, 0, sizeof(m_BlockLight)); memset(m_BlockSkyLight, 0, sizeof(m_BlockSkyLight)); } + + // Check if "Entity" and "TileEntities" lists exists. MCEdit requires this. + if (!m_HasHadEntity) + { + a_Writer.BeginList("Entities", TAG_Compound); + a_Writer.EndList(); + } + if (!m_HasHadBlockEntity) + { + a_Writer.BeginList("TileEntities", TAG_Compound); + a_Writer.EndList(); + } } diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 3821ad976..bd814e2c7 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -51,6 +51,7 @@ #include "../Entities/ItemFrame.h" #include "../Protocol/MojangAPI.h" +#include "Server.h" @@ -99,7 +100,7 @@ cWSSAnvil::cWSSAnvil(cWorld * a_World, int a_CompressionFactor) : Writer.BeginCompound("Data"); Writer.AddByte("allowCommands", 1); Writer.AddByte("Difficulty", 2); - Writer.AddByte("hardcore", 0); + Writer.AddByte("hardcore", cRoot::Get()->GetServer()->IsHardcore() ? 1 : 0); Writer.AddByte("initialized", 1); Writer.AddByte("MapFeatures", 1); Writer.AddByte("raining", a_World->IsWeatherRain() ? 1 : 0); @@ -457,12 +458,6 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_ 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)) { |