Added support for the GeneratorName setting in Anvil worlds

This commit is contained in:
cry-inc 2013-05-10 21:50:41 +02:00
parent e20a1277c3
commit eb7c3a9cc5

View file

@ -50,6 +50,7 @@ namespace Substrate
new SchemaNodeScaler("RandomSeed", TagType.TAG_LONG), new SchemaNodeScaler("RandomSeed", TagType.TAG_LONG),
new SchemaNodeScaler("version", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("version", TagType.TAG_INT, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("LevelName", TagType.TAG_STRING, SchemaOptions.OPTIONAL), new SchemaNodeScaler("LevelName", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("generatorName", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("raining", TagType.TAG_BYTE, SchemaOptions.OPTIONAL), new SchemaNodeScaler("raining", TagType.TAG_BYTE, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("thundering", TagType.TAG_BYTE, SchemaOptions.OPTIONAL), new SchemaNodeScaler("thundering", TagType.TAG_BYTE, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("rainTime", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("rainTime", TagType.TAG_INT, SchemaOptions.OPTIONAL),
@ -77,6 +78,7 @@ namespace Substrate
private long _randomSeed; private long _randomSeed;
private int? _version; private int? _version;
private string _name; private string _name;
private string _generator;
private byte? _raining; private byte? _raining;
private byte? _thundering; private byte? _thundering;
@ -175,6 +177,16 @@ namespace Substrate
} }
} }
/// <summary>
/// Gets or sets the name of the world generator.
/// </summary>
/// <remarks>This should be 'default', 'flat', or 'largeBiomes'.</remarks>
public string GeneratorName
{
get { return _generator; }
set { _generator = value; }
}
/// <summary> /// <summary>
/// Gets or sets a value indicating that it is raining in the world. /// Gets or sets a value indicating that it is raining in the world.
/// </summary> /// </summary>
@ -273,6 +285,7 @@ namespace Substrate
//_version = 19132; //_version = 19132;
_version = 19133; _version = 19133;
_name = "Untitled"; _name = "Untitled";
_generator = "default";
_hardcore = 0; _hardcore = 0;
GameType = GameType.SURVIVAL; GameType = GameType.SURVIVAL;
@ -298,6 +311,7 @@ namespace Substrate
_randomSeed = p._randomSeed; _randomSeed = p._randomSeed;
_version = p._version; _version = p._version;
_name = p._name; _name = p._name;
_generator = p._generator;
_raining = p._raining; _raining = p._raining;
_thundering = p._thundering; _thundering = p._thundering;
@ -408,6 +422,10 @@ namespace Substrate
_name = ctree["LevelName"].ToTagString(); _name = ctree["LevelName"].ToTagString();
} }
if (ctree.ContainsKey("generatorName")) {
_generator = ctree["generatorName"].ToTagString();
}
if (ctree.ContainsKey("raining")) { if (ctree.ContainsKey("raining")) {
_raining = ctree["raining"].ToTagByte(); _raining = ctree["raining"].ToTagByte();
} }
@ -478,6 +496,10 @@ namespace Substrate
data["LevelName"] = new TagNodeString(_name); data["LevelName"] = new TagNodeString(_name);
} }
if (_generator != null) {
data["generatorName"] = new TagNodeString(_generator);
}
if (_raining != null) { if (_raining != null) {
data["raining"] = new TagNodeByte(_raining ?? 0); data["raining"] = new TagNodeByte(_raining ?? 0);
} }