Skip to content

Instantly share code, notes, and snippets.

@avafloww
Last active December 11, 2015 16:38
Show Gist options
  • Select an option

  • Save avafloww/4629012 to your computer and use it in GitHub Desktop.

Select an option

Save avafloww/4629012 to your computer and use it in GitHub Desktop.

Revisions

  1. Devin Ryan revised this gist Jan 24, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion VoidGenerator.java
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    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;
    @@ -13,7 +14,7 @@ public Location getFixedSpawnLocation(World world, Random random) {

    @Override
    public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
    byte[][] result = null;
    byte[][] result = new byte[16][];

    if (x == 0 && z == 0) {
    setBlock(result, 0, 64, 0, (byte) 1);
  2. Devin Ryan created this gist Jan 24, 2013.
    31 changes: 31 additions & 0 deletions VoidGenerator.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    package com.forairan.mapstudio.world;

    import java.util.Random;
    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 = null;

    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;
    }
    }