forked from minecraft-dotnet/Substrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (30 loc) · 1.04 KB
/
Program.cs
File metadata and controls
36 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using Substrate;
// MoveSpawn changes the location of the world spawn location
// (which is separate from individual player spawn locations)
namespace MoveSpawn
{
class Program
{
static void Main (string[] args)
{
if (args.Length != 4) {
Console.WriteLine("Usage: MoveSpawn <world> <x> <y> <z>");
return;
}
string dest = args[0];
int x = Convert.ToInt32(args[1]);
int y = Convert.ToInt32(args[2]);
int z = Convert.ToInt32(args[3]);
// Open our world
NbtWorld world = NbtWorld.Open(dest);
// Set the level's spawn
// Note: Players do not have separate spawns by default
// If you wanted to change a player's spawn, you must set all
// 3 coordinates for it to stick. It will not take the level's defaults.
world.Level.Spawn = new SpawnPoint(x, y, z);
// Save the changes
world.Save();
}
}
}