Skip to content

Creating New Dungeons

Krishna Chaitanya Aluru edited this page Feb 18, 2016 · 5 revisions
  • You can use any name for your dungeon. For the purpose of convenience within this guide, we are going to call it 'Bedrock'. Create a new class named 'DungeonBedrock' within the dungeongenerator package. Copy over code from one of the other dungeon generators and fix the errors by renaming the class and the constructor.
  • The generate method creates the dungeon within Minecraft by setting a block at each (x, y, z) coordinate. We will modify this later.
  • Open the HandlerDungeonGeneration within the handler package. Create a pose for your dungeon within doCreateDungeons.
  • Register your dungeon by calling BurlapCraft.registerDungeon and passing it a new DungeonBedrock instance that uses the pose you created above.

To actually build the dungeon, you need to modify the generate method in the DungeonBedrock class. If the dungeon you have in mind is very simple then you can just replace the code within generate with for-loops that set each block as you desire (by calling world.setBlock). However you can also create the dungeon in Minecraft itself, and then automatically generate the Java code to create it within the mod.

Generation Using MCEdit

  • For this section, you will need to download MCEdit from here and a Schematic Converter from here.

  • Once you have MCEdit, you have two options:

    • Create the structure in MCEdit itself (generally good for large landscapes).
    • Create the stucture in a Minecraft world and then export the schematic for it using MCEdit (generally good for smaller 'dungeon-sized' structures).
  • Let us go ahead with option 2. Run Minecraft from Eclipse, create a new world in creative mode (name the world something you can identify easily) and create your structure manually.

  • After creating your structure, you can close Minecraft. Go back to MCEdit and press the 'Load World' option. We are looking for the level.dat file of the world you just created. You should be able to find it in the eclipse/saves/(your world's name) subdirectory within the forge folder.

  • Once you load the world, you need to select the dungeon structure you created from end to end and export it. Use the 'w-a-s-d' and 'i-j-k-l' keys in conjunction to navigate around the model of the world you are looking at. Press and hold the left mouse button and drag to select multiple blocks.

  • After selecting your structure, press export and save the schematic file to any location (I have a schematics folder within my forge folder where I like to store all my exported files).

  • Place the Schematic Converter jar file you downloaded into the same folder where you are saving your schematics. Fire up your terminal/command window and run the Schematic Converter using 'java -jar SchematicConverter.jar'.

  • Choose 'New', then 'Open File' and point it to the schematic file you just created. Do not check the 'Ignore Air' option. Press 'Convert File'. It should say 'successfully converted file'. Press 'OK' and then press 'Save Code'. We will use this code within the generate method.

  • Replace every line of code within the generate method (in the DungeonGeneratorBedrock class) except the return statement with the lines within the spawn method of your saved code.

  • If you run Minecraft from your IDE, you should be able to find the dungeon you created when you create a new world and join it. Remember to use coordinates close to the player for the dungeon so that you can find the dungeon easily.