-
net.minecraftforge.fml.common.IWorldGenerator
->net.minecraft.world.gen.feature.Feature
- No longer needed. I think it should be removed by forge, as it has been superseded by vanilla functionality. See below.
-
net.minecraft.world.gen.feature.WorldGenerator
->net.minecraft.world.gen.feature.Feature
- This would also be the most common replacement of Forge's
IWorldGenerator
. This should be the solution for anything smaller than a chunk. - Except the 8 blocks offset. This is not a thing anymore. Population now works just like any normal person would expect.
- Position of features is controlled by instances of
net.minecraft.world.gen.placement.BasePlacement
instead of by the feature itself.
- This would also be the most common replacement of Forge's
-
net.minecraft.world.gen.MapGenBase
->net.minecraft.world.gen.carver.IWorldCarver
- This is now finally exposed to mods in a useful way. As it was mostly hidden from modders before, not eveyone may know what it is, so it will be explained later. Generates caves and canyons.
-
net.minecraft.world.gen.structure.MapGenStructure
->net.minecraft.world.gen.feature.structure.Structure
Structure extends Feature
. Works in a way similar toIWorldCarver
, but diring population stage, and usually generates structures like villages and strongholds
-
net.minecraft.world.gen.feature.IFeatureConfig
:Each feature has it's own configuration object. Features are all registered to individual biomes, instead of globally, wrapped in a
net.minecraft.world.gen.feature.CompositeFeature
, which contains theBasePlacement
,IFeatureConfig
andIPlacementConfig
A custom
IChunkGenerator
may be able to access the feature directly and change the way it's used. Mojang's obfuscator probably stripped some useful getters from there, so I think it would be a good idea for forge to add them. -
net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder
:- Each biome has a
SurfaceBuilder
that generates this biome's specific surface blocks on top, usually by replacing some of the existing stone blocks. It gets a randomized, small (exact range probably around -1 to 4, to be determined, because Notch's noise generators are still impossible to understand) float value that usually determines the depth of the surface.
- Each biome has a
The idea of IChunkGenerator stays mostly the same in 1.13: Coordinate the action of all the other parts, and generate the terrain shape. One notable change is that it's now split into more clearly defined generation passes, and there is an abstract class that implements the core functionality that a generator is expected to do. Note: AbstractChunkGenerator
's methods that call individual features, carvers and structures may be a good place for forge to add events, if it wouldn't cause too big performance hit.
A basic implementation of AbstractChunkGenerator
has control over the terrain shape by being able to generate "noise density" values in generateNoiseRegion
. An IChunkGenerator
also always has a configuration object assigned to it.
In order to override how features, structures, and carvers are generated, mods can override the following methods:
public void makeBase(IChunk chunkIn)
- Fills the actual chunk with blocks to produce basic terrain shape. // TODO explain how this actually is done
public void carve(WorldGenRegion region, GenerationStage.Carving carvingStage)
- Runs all the chunk carvers. Due to the improved design, carvers can also be per-biome now.
protected void makeBedrock(IChunk chunkIn, Random random)
- Intended to be used from the implementation as necessary
public void decorate(WorldGenRegion region)
- Generates all the
Feature
s
- Generates all the
public void buildSurface(IChunk chunkIn, Biome[] biomesIn, SharedSeedRandom random, int seaLevel)
- Invokes biome-specific surface generation method. This is where blocks like dirt, grass, sand, sandstone and mesa clay blocks are placed. Currently there appears to be very little control over this from
IChunkGenerator
side.
- Invokes biome-specific surface generation method. This is where blocks like dirt, grass, sand, sandstone and mesa clay blocks are placed. Currently there appears to be very little control over this from
public abstract double[] generateNoiseRegion(int x, int z);
- Allows to control the properties of biome-specific surface, mostly dirt depth.
-
For a custom generator
Currently, I don't see any obvious way to do that.
A way that appears to fit the 1.13 system would be to register them normally for all biomes, with default configuration being "disabled", and change the configuration in your own generator. And for that, see #2
-
For normal worlds
In your
setup
(? needs to be verified), for all the biomes you are interested in do one of these:biome.addFeature(generationStage, Biome.createCompositeFeature(feature, defaultConfig, defaultPlacement, defaultPlacementConfig)); biome.addCarver(generationStage, Biome.createWorldCarverWrapper(carver, defaultConfig)); biome.addStructure(structure, defaultConfig);
Replacing or modifying the biome's surface builder is currently not possible.
-
As a world type:
This is mostly unchanged since MC 1.12.2.
As always, WorldTypes are "registered" automatically in constructor, so all you need to do is create a class that extends WorldType and make an instance of it in your mod's
setup
.To create a custom chunk generator, override the
createChunkGenerator
method to return your generator. This method also creates theBiomeProvider
, there is no separate method to create a biome provider anymore. If you don't want to override a dimension, you can call thecreateChunkGenerator
method fromDimension
which creates the dimension-specific world generator. -
As a dimension: Adding dimensions works basically the same way as in old MC versions. There is really different. You jsut don't use
EnumHelper
, and instead there is a runtime-patchedcreate
method inDimensionType
class.
How does one go about cancelling / removing features? i.e. replacing one ore generator for a different one (some of us don't like vanilla blobs)
How does one get notified that a feature has been generated (in order to make changes or perform some other task)? i.e. being able to do something like count how much ore is in a chunk post decoration or altering the trap at the bottom of a pyramid, etc