Created
August 27, 2014 22:28
-
-
Save Deamon5550/cf8f6fe7eabc03be280e to your computer and use it in GitHub Desktop.
Custom worlg generator bukkit
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
The plugin needs to have 'load: STARTUP' set in its plugin.yml |
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
import java.util.Random; | |
import org.bukkit.World; | |
import org.bukkit.generator.ChunkGenerator; | |
public class CustomGenerator extends ChunkGenerator | |
{ | |
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) | |
{ | |
byte[][] result = new byte[16][]; //this is where you would fetch from the other thread | |
return result; | |
} | |
} |
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
import org.bukkit.event.world.ChunkPopulateEvent; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.EventPriority; | |
import org.bukkit.event.Listener; | |
import org.bukkit.Chunk; | |
public class EventHandler implements Listener | |
{ | |
@EventHandler(priority = EventPriority.HIGHEST) | |
public void onChunkPopulate(ChunkPopulateEvent event) | |
{ | |
Chunk chunk = event.getChunk(); | |
//grab metadata from other thread here and apply to the chunk | |
} | |
} |
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
import org.bukkit.generator.ChunkGenerator; | |
import org.bukkit.plugin.java.JavaPlugin; | |
class PluginMain extends JavaPlugin | |
{ | |
@Override | |
public void onEnable() | |
{ | |
this.getServer().getPluginManager().registerEvents(new EventHandler(), this); | |
} | |
@Override | |
public void onDisable() | |
{ | |
} | |
public ChunkGenerator getDefaultWorldGenerator(String w, String id) | |
{ | |
return new EmptyGenerator(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment