51 lines
1.3 KiB
Java
51 lines
1.3 KiB
Java
/*
|
|
* Copyright (c) 2018 univento.eu - All rights reserved
|
|
* You are not allowed to use, distribute or modify this code
|
|
*/
|
|
|
|
package eu.univento.teamvento.generator;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.World;
|
|
import org.bukkit.generator.BlockPopulator;
|
|
import org.bukkit.generator.ChunkGenerator;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class DevGenerator extends ChunkGenerator{
|
|
|
|
@Override
|
|
public List<BlockPopulator> getDefaultPopulators(World world) {
|
|
return Arrays.asList(new BlockPopulator[0]);
|
|
}
|
|
|
|
@Override
|
|
public boolean canSpawn(World world, int x, int z) {
|
|
return true;
|
|
}
|
|
|
|
private int xyzToByte(int x, int y, int z) {
|
|
return (x * 16 + z) * 128 + y;
|
|
}
|
|
|
|
@Override
|
|
public byte[] generate(World world, Random random, int chunkx, int chunkz) {
|
|
byte[] result = new byte[32768];
|
|
for(int x = 0; x < 16; x++) {
|
|
for(int z = 0; z < 16; z++) {
|
|
for(int y = 0; y < 256; y++) {
|
|
if(y > 0 && y < 100) result[xyzToByte(x, y, z)] = (byte) Material.SANDSTONE.getId();
|
|
if(y == 0) result[xyzToByte(x, y, z)] = (byte) Material.BEDROCK.getId();
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
} |