Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public byte[] NewChunk(int Height) {
- byte[] Blocks = new byte[SizeX * SizeY * SizeZ];
- boolean on = true;
- for (int X = 0; X < SizeX; X++) {
- for (int Z = 0; Z < SizeZ; Z++) {
- for (int Y = 0; Y < SizeY; Y++) {
- if (Y < Height) {
- if (Y == 0) {
- Blocks[GetIndex(X, Y, Z)] = 7;
- } else if (Y < Height) {
- Blocks[GetIndex(X, Y, Z)] = 2;
- } else if (Y <= Height) {
- Blocks[GetIndex(X, Y, Z)] = 3;
- } else {
- Blocks[GetIndex(X, Y, Z)] = 0;
- }
- if(X==0||Z==0){
- //Blocks[GetIndex(X, Y, Z)] = 0;
- }
- }
- }
- }
- }
- return Blocks;
- }
- public byte[] AddOtherStuff(byte[] blocks) throws IOException {
- byte[] metadata = new byte[SizeX * SizeY * SizeZ / 2];
- byte[] light = new byte[SizeX * SizeY * SizeZ / 2];
- byte[] skylight = new byte[SizeX * SizeY * SizeZ / 2];
- for (int i = 0; i < (SizeX * SizeY * SizeZ) / 2; i++) {
- byte nibblea = (byte) 0x00;
- byte nibbleb = (byte) 0x00;
- byte Both = (byte) ((nibblea << 4) | (nibbleb & 0x0F));
- metadata[i] = Both;
- light[i] = Both;
- nibblea = (byte) 0xf;
- nibbleb = (byte) 0xf;
- Both = (byte) ((nibblea << 4) | (nibbleb & 0x0F));
- skylight[i] = Both;
- }
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- stream.write(blocks);
- stream.write(metadata);
- stream.write(light);
- stream.write(skylight);
- return stream.toByteArray();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement