Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
WorldGenConfiguration.cs
Go to the documentation of this file.
1
using
System.IO
;
2
using
System.Reflection
;
3
using
Newtonsoft.Json;
4
using
Newtonsoft.Json.Linq;
5
using
Terraria.IO
;
6
7
namespace
Terraria.WorldBuilding
;
8
9
public
class
WorldGenConfiguration
:
GameConfiguration
10
{
11
private
readonly JObject
_biomeRoot
;
12
13
private
readonly JObject
_passRoot
;
14
15
public
WorldGenConfiguration
(JObject configurationRoot)
16
: base(configurationRoot)
17
{
18
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
19
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
20
//IL_0026: Expected O, but got Unknown
21
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
22
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
23
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
24
//IL_0045: Expected O, but got Unknown
25
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
26
_003F val = (JObject)configurationRoot[
"Biomes"
];
27
if
((
int
)val == 0)
28
{
29
val =
new
JObject();
30
}
31
_biomeRoot
= (JObject)val;
32
_003F val2 = (JObject)configurationRoot[
"Passes"
];
33
if
((
int
)val2 == 0)
34
{
35
val2 =
new
JObject();
36
}
37
_passRoot
= (JObject)val2;
38
}
39
40
public
T
CreateBiome<T>
() where T :
MicroBiome
, new()
41
{
42
return
CreateBiome<T>
(typeof(T).
Name
);
43
}
44
45
public
T
CreateBiome<T>
(
string
name) where T :
MicroBiome
,
new
()
46
{
47
JToken val =
default
(JToken);
48
if
(
_biomeRoot
.TryGetValue(name, ref val))
49
{
50
return
val.ToObject<T>();
51
}
52
return
new
T();
53
}
54
55
public
GameConfiguration
GetPassConfiguration
(
string
name)
56
{
57
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
58
//IL_0026: Expected O, but got Unknown
59
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
60
//IL_001b: Expected O, but got Unknown
61
JToken val =
default
(JToken);
62
if
(
_passRoot
.TryGetValue(name, ref val))
63
{
64
return
new
GameConfiguration
((JObject)val);
65
}
66
return
new
GameConfiguration
(
new
JObject());
67
}
68
69
public
static
WorldGenConfiguration
FromEmbeddedPath
(
string
path)
70
{
71
using
Stream
stream =
Assembly
.
GetExecutingAssembly
().GetManifestResourceStream(path);
72
using
StreamReader
streamReader =
new
StreamReader
(stream);
73
return
new
WorldGenConfiguration
(JsonConvert.DeserializeObject<JObject>(streamReader.ReadToEnd()));
74
}
75
}
System.IO.StreamReader
Definition
StreamReader.cs:9
System.IO.Stream
Definition
Stream.cs:11
System.Reflection.Assembly.GetExecutingAssembly
static RuntimeAssembly GetExecutingAssembly(ref StackCrawlMark stackMark)
Definition
Assembly.cs:198
System.Reflection.Assembly
Definition
Assembly.cs:16
Terraria.IO.GameConfiguration.GameConfiguration
GameConfiguration(JObject configurationRoot)
Definition
GameConfiguration.cs:9
Terraria.IO.GameConfiguration
Definition
GameConfiguration.cs:6
Terraria.WorldBuilding.MicroBiome
Definition
MicroBiome.cs:4
Terraria.WorldBuilding.WorldGenConfiguration.WorldGenConfiguration
WorldGenConfiguration(JObject configurationRoot)
Definition
WorldGenConfiguration.cs:15
Terraria.WorldBuilding.WorldGenConfiguration.GetPassConfiguration
GameConfiguration GetPassConfiguration(string name)
Definition
WorldGenConfiguration.cs:55
Terraria.WorldBuilding.WorldGenConfiguration.FromEmbeddedPath
static WorldGenConfiguration FromEmbeddedPath(string path)
Definition
WorldGenConfiguration.cs:69
Terraria.WorldBuilding.WorldGenConfiguration._passRoot
readonly JObject _passRoot
Definition
WorldGenConfiguration.cs:13
Terraria.WorldBuilding.WorldGenConfiguration._biomeRoot
readonly JObject _biomeRoot
Definition
WorldGenConfiguration.cs:11
Terraria.WorldBuilding.WorldGenConfiguration.CreateBiome< T >
T CreateBiome< T >()
Definition
WorldGenConfiguration.cs:40
Terraria.WorldBuilding.WorldGenConfiguration
Definition
WorldGenConfiguration.cs:10
System.IO
Definition
ConsoleStream.cs:3
System.Reflection.MetadataTokenType.Name
@ Name
System.Reflection
Definition
ICustomTypeProvider.cs:1
Terraria.IO
Definition
FavoritesFile.cs:8
Terraria.WorldBuilding
Definition
Actions.cs:8
source
Terraria.WorldBuilding
WorldGenConfiguration.cs
Generated by
1.10.0