Last active
December 11, 2015 16:38
-
-
Save avafloww/4629012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.forairan.mapstudio.world; | |
import java.util.Random; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Location; | |
import org.bukkit.World; | |
import org.bukkit.generator.ChunkGenerator; | |
public class VoidGenerator extends ChunkGenerator { | |
@Override | |
public Location getFixedSpawnLocation(World world, Random random) { | |
return new Location(world, 0, 65, 0); | |
} | |
@Override | |
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) { | |
byte[][] result = new byte[16][]; | |
if (x == 0 && z == 0) { | |
setBlock(result, 0, 64, 0, (byte) 1); | |
} | |
return result; | |
} | |
public void setBlock(byte[][] result, int x, int y, int z, byte blkid) { | |
if (result[y >> 4] == null) { | |
result[y >> 4] = new byte[4096]; | |
} | |
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment