public final class FabricStructureBuilder<FC extends net.minecraft.world.gen.feature.FeatureConfig,S extends net.minecraft.world.gen.feature.StructureFeature<FC>> extends Object
Example usage:
StructureFeature structure = new MyStructure(DefaultFeatureConfig.CODEC);
ConfiguredStructureFeature<DefaultFeatureConfig, ? extends StructureFeature<DefaultFeatureConfig>> configuredStructure
= structure.configure(new DefaultFeatureConfig());
FabricStructureBuilder.create(new Identifier("mymod:mystructure"), structure)
.step(GenerationStep.Feature.SURFACE_STRUCTURES) // required
.defaultConfig(32, 8, 12345) // required
.superflatFeature(configuredStructure)
.register();
This class does not add structures to biomes for you, you have to do that yourself. You may also need to register custom structure pieces yourself.
Modifier and Type | Method and Description |
---|---|
FabricStructureBuilder<FC,S> |
adjustsSurface()
Causes structure pieces of this structure to adjust the surface of the world to fit them, so that they don't
stick out of or into the ground.
|
static <FC extends net.minecraft.world.gen.feature.FeatureConfig,S extends net.minecraft.world.gen.feature.StructureFeature<FC>> |
create(net.minecraft.util.Identifier id,
S structure)
Creates a new
FabricStructureBuilder for registering a structure. |
FabricStructureBuilder<FC,S> |
defaultConfig(int spacing,
int separation,
int salt)
Sets the default StructureConfig for this structure.
|
FabricStructureBuilder<FC,S> |
defaultConfig(net.minecraft.world.gen.chunk.StructureConfig config)
Sets the default StructureConfig for this structure.
|
S |
register()
Registers this structure and applies the other changes from the FabricStructureBuilder.
|
FabricStructureBuilder<FC,S> |
step(net.minecraft.world.gen.GenerationStep.Feature step)
Sets the generation step of this structure.
|
FabricStructureBuilder<FC,S> |
superflatFeature(net.minecraft.world.gen.feature.ConfiguredStructureFeature<FC,? extends net.minecraft.world.gen.feature.StructureFeature<FC>> superflatFeature)
Sets the structure configuration which spawns in superflat worlds.
|
FabricStructureBuilder<FC,S> |
superflatFeature(FC config)
Sets the structure configuration which spawns in superflat worlds.
|
public static <FC extends net.minecraft.world.gen.feature.FeatureConfig,S extends net.minecraft.world.gen.feature.StructureFeature<FC>> FabricStructureBuilder<FC,S> create(net.minecraft.util.Identifier id, S structure)
FabricStructureBuilder
for registering a structure.id
- The structure ID.structure
- The StructureFeature you want to register.public FabricStructureBuilder<FC,S> step(net.minecraft.world.gen.GenerationStep.Feature step)
The most commonly used values for structures are GenerationStep.Feature#SURFACE_STRUCTURES and GenerationStep.Feature#UNDERGROUND_STRUCTURES, however technically any value in the GenerationStep.Feature enum may be used.
This is a required option.
public FabricStructureBuilder<FC,S> defaultConfig(net.minecraft.world.gen.chunk.StructureConfig config)
This is a required option.
public FabricStructureBuilder<FC,S> defaultConfig(int spacing, int separation, int salt)
Note: the spacing
and separation
options are subject to other checks for whether the structure
can spawn, such as biome. If these checks always pass and the structure can spawn in every biome, then the
description of these values below would be exactly correct.
This is a required option. Vanilla needs it to function.
spacing
- The average distance between 2 structures of this type along the X and Z axes.separation
- The minimum distance between 2 structures of this type.salt
- The random salt of the structure. This does not affect how common the structure is, but every
structure must have an unique salt
in order to spawn in different places.defaultConfig(StructureConfig)
public FabricStructureBuilder<FC,S> superflatFeature(net.minecraft.world.gen.feature.ConfiguredStructureFeature<FC,? extends net.minecraft.world.gen.feature.StructureFeature<FC>> superflatFeature)
superflatFeature(FeatureConfig)
public FabricStructureBuilder<FC,S> superflatFeature(FC config)
public FabricStructureBuilder<FC,S> adjustsSurface()
public S register()