summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp12
-rw-r--r--src/WorldStorage/WSSAnvil.cpp9
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))
{