Tutorial - Adding the block to the world generation
In this part we're going to add our platinum ore to the world generation.
In order to add a block to the world generation, you have to create a file int the worldGeneration directory of your mod. Like the block file in the blocks directory, this file contains the attributes for the world generation.
Name the file platinumOre.js and add the following lines to it:
blockMeta = 0;
minHeight = 0;
maxHeight = 32;
generationsPerChunk = 10.5;
numberOfBlocks = 8;
World generation attributes don't have any [0], so if you want to add multiple metadata versions of a block to the world
generation, you have to create one file per metadata version. You can have multiple generations of the same block so you can, for example, have different vein sizes.
- The 'blockId' and 'blockMeta' attributes define the ID and metadata of the block that is created by this world generation.
- The 'minHeight' and 'maxHeight' attributes define at what height the block will be generated.
- The 'generationsPerChunk' attribute defines how may generations are made in the defined height per chunk. 10.5 means that there are ten generations and with a chance of 50% eleven generations.
- The 'numberOfBlocks' attribute defines the number of blocks that are created per generation (per vein). For example, coal has a higher value than diamonds or iron.
The last thing to do is to add our world generation in the mod.js file. Add the following line to it:
The first argument is the name of the world generation's file inside the worldGeneration directory.
The second argument is the world generation's type. We want to generate a ore, so we choose 'ore'.
Also make sure to add the line after config.addBlockIdProperty() and mod.addBlock() lines.
That's it. Notice that the block is only generated in new worlds or in parts of an existing world that haven't been generated, yet.
Continue with: Creation of an item