Definitions: Dimension, World, Chunk, Biome
Each of the "Overworld", the "Nether", and the "End" are called "dimensions".
Key Point: In terms of modding, each dimension is run in a separate instance of the World class. This is important as it means that you may have to think carefully if you need certain data across all the dimensions.
Due to the huge size of a world (a 256 by 256 area of the world has 17 million block positions!), the code manages data about the world in "chunks", saving them and loading them as needed. This is the reason for Minecraft's recognizable way that the world in the distance is often missing parts until you get closer. A chunk is 16 x 256 x 16 in size. "Chunk coordinates" are used in various places in the code and refer to x, y, z within the chunk.
Tip: To get chunk coordinates from world coordinates, you can use the modulo operator: chunkX = worldX%16.
When a chunk is loaded for the first time it is generated. This is done with a "chunk provider" that is called from the "world provider". There is a certain degree of randomness used by the code to make things interesting, but there are still "themes" for the area of the world which are called "biomes". These are things like "taiga" and "plains". The biome is used to determine the types of blocks, types of trees, and types of entities to generate.
Biomes consist of a number of chunks, but the shape and size can vary randomly.
Getting A List Of All Biomes
Prior to 1.10.2 the built-in biomeList contains null entries and so it was useful to clean up that list.
Thanks to diesieben07 for this tip. You can get a proper list of all biomes with:
How To Delete A Biome
In earlier versions of Forge there was a GameRegistry.removeBiome() method which no longer exists. Now you can work directly with the List in the BiomeManager, using normal List methods to remove (or add).
Detecting What Biome Is At A Given Location
If you ever want your code to do something special based on being in a biome, like maybe if you want it to play different background sounds in your custom biome, you can check using the following: worldObj.getChunkFromBlockCoords(blockpos).getBiome(blockpos, worldObj.getWorldChunkManager()).biomeName
Making Sure Random Generation Is Tied To The World Seed
In Minecraft worlds are generated randomly for each new game and each new area explored. However, in computer programming, it is possible to repeat the "random" sequence by starting with the same "seed" value. This is very useful in debugging code but is also fun in Minecraft because if you find a cool world gets generated you can share the seed with your friends and they can generate the exact same world.
Therefore, if you're going to add randomness to any of your custom generation code, you should tie it to the world's seed so they your custom stuff will also be able to be generated the same way each time someone uses the same seed.
To do this, when you need randomness in your custom generation code you should use the public World.rand field and get your random numbers using the appropriate methods for Random class.
Creating Your Own Dimension
See Jimmy04Creeper's Custom Dimensions Tutorial.
Creating An Empty Dimension
You can do this by simply following the steps to make a custom dimension, but in your custom ChunkProvider class @Override the ChunkProvider#provideChunk() method to return an empty chunk.
Changing How Fast The Day Progresses
You cannot (easily) change the pace of the day in the vanilla because the duration of a day is a fixed value in the WorldProvider#calculateCelestialAngle() method, but you can easily do this in your own dimension. In other words make a custom WorldProvider.
Custom Tree Generation
Preventing And Changing Generation Of Decorations (Trees, Cactus, Etc.)
You can handle the DecorateBiomeEvent.decorate event and check for the EventType. If you don't understand how to handle an event, check out Jabelar's Event Handling Tutorial.
Based on the EventType you can do your own thing and use the event.setResult(Result.DENY) to prevent the standard decoration.
Possible EventTypes you can intercept are:
- CUSTOM -- it seems this is to allow you to post custom event that can then be handled.
Changing The Contents Of Generated Chests
The ChestGenHooks class has categories BONUS_CHEST and VILLAGE_BLACKSMITH. Register your loot there.