Minecraft API
Over the last few days I have been working on an API that lets you easily create, modify and save your own Minecraft levels.
It wraps around the existing Minecraft classes provided for the map files, and gives a very object-orientated API for creating levels.
This snippet of codes demonstrates the creation of the level with 1000 randomly distributed tiles:
logger.info("Creating level...");
Level level = Level.create(new Dimension(64, 64, 64));
level.clear();
for(int i = 0; i < 1000; i++) {
int x = new Random().nextInt(64);
int y = new Random().nextInt(64);
int z = new Random().nextInt(64);
int t = new Random().nextInt(42);
level.setTile(new Location(x, y, z), Block.forId(t));
}
level.setSpawnPosition(new Position(32, 32, 33, 0));
FileOutputStream os = new FileOutputStream("data/server_level.dat");
Level.save(os, level);
os.flush();
os.close();
logger.info("Finished.");
I've still got quite a lot of work left, but when it's done, I'll release it open source - probably under the MIT license.
Comments
Nobody has commented on this post yet.