Class FabricStructureBuilder<FC extends net.minecraft.world.gen.feature.FeatureConfig,S extends net.minecraft.world.gen.feature.StructureFeature<FC>>
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.
-
Method Summary
Modifier and TypeMethodDescriptionCauses 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>>
FabricStructureBuilder<FC,S>create(net.minecraft.util.Identifier id, S structure)
Creates a newFabricStructureBuilder
for registering a structure.defaultConfig(int spacing, int separation, int salt)
Sets the default StructureConfig for this structure.defaultConfig(net.minecraft.world.gen.chunk.StructureConfig config)
Sets the default StructureConfig for this structure.register()
Registers this structure and applies the other changes from the FabricStructureBuilder.step(net.minecraft.world.gen.GenerationStep.Feature step)
Sets the generation step of this structure.superflatFeature(FC config)
Sets the structure configuration which spawns in superflat worlds.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.
-
Method Details
-
create
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)Creates a newFabricStructureBuilder
for registering a structure.- Parameters:
id
- The structure ID.structure
- The StructureFeature you want to register.
-
step
Sets the generation step of this structure. The generation step specifies when the structure is generated, to ensure they are generated in the correct order to reduce the amount of floating blocks.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.
-
defaultConfig
public FabricStructureBuilder<FC,S> defaultConfig(net.minecraft.world.gen.chunk.StructureConfig config)Sets the default StructureConfig for this structure. See the alternative defaultConfig(int, int, int) for details.This is a required option.
-
defaultConfig
Sets the default StructureConfig for this structure. This sets the default configuration of where in the world to place structures.Note: the
spacing
andseparation
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.
- Parameters:
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 uniquesalt
in order to spawn in different places.- See Also:
defaultConfig(StructureConfig)
-
superflatFeature
public 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. If unset, this structure will not spawn in superflat worlds.- See Also:
superflatFeature(FeatureConfig)
-
superflatFeature
Sets the structure configuration which spawns in superflat worlds. If unset, this structure will not spawn in superflat worlds. -
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. -
register
Registers this structure and applies the other changes from the FabricStructureBuilder.
-