-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorldGenerator.cs
49 lines (47 loc) · 1.52 KB
/
WorldGenerator.cs
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
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* uBuilder - A lightweight custom Minecraft Classic server written in C#
* Copyright 2010 Calvin "calzoneman" Montgomery
*
* Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License
* (see http://creativecommons.org/licenses/by-sa/3.0/, or LICENSE.txt for a full license
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace uBuilder
{
public class WorldGenerator
{
public static byte[] GenerateFlatgrass(short width, short height, short depth)
{
byte[] map = new byte[width * height * depth];
for (short x = 0; x < width; x++)
{
for (short z = 0; z < depth; z++)
{
for (short y = 0; y < height; y++)
{
int index = (y * depth + z) * width + x;
if (y < height / 2 - 9)
{
map[index] = (byte)1;
}
else if (y < height / 2 - 1)
{
map[index] = (byte)3;
}
else if (y == height / 2 - 1)
{
map[index] = (byte)2;
}
else
{
map[index] = (byte)0;
}
}
}
}
return map;
}
}
}