tutorial:structures
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:structures [2020/09/11 07:07] – Improve readability siglong | tutorial:structures [2021/03/19 00:43] – [Adding Structure Features [1.16.3]] telepathicgrunt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Adding Structure Features ====== | + | ====== Adding Structure Features |
We’re going to look at registering and placing structures in your world. | We’re going to look at registering and placing structures in your world. | ||
- | To view examples of vanilla structures in action, '' | + | To view examples of vanilla structures in action, '' |
You are going to need a feature and generator for the most basic structure. | You are going to need a feature and generator for the most basic structure. | ||
The feature handles the process of registering the structure and loading it in when the world is generating. | The feature handles the process of registering the structure and loading it in when the world is generating. | ||
The generator handles the placement of blocks or loading in a structure file if you choose to do so. | The generator handles the placement of blocks or loading in a structure file if you choose to do so. | ||
+ | |||
+ | Note that this tutorial depends on [[https:// | ||
+ | If the API doesn' | ||
===== Creating a Feature ===== | ===== Creating a Feature ===== | ||
Line 123: | Line 126: | ||
</ | </ | ||
| | ||
- | '' | + | '' |
- | In vanilla structures, data blocks are placed above chests so they can be filled with loot in this method. | + | This can be good for dynamic stuff such as placing certain mobs based on what mod is on and so on. |
+ | |||
+ | In vanilla structures, data blocks are placed above chests so they can be filled with loot in this method. | ||
+ | HOWEVER, you do not need to use datablocks to place chests with loot. Instead, use this command to set a north facing chest with a loottable. | ||
+ | Save this chest into your structure' | ||
+ | < | ||
We set the '' | We set the '' | ||
Line 139: | Line 147: | ||
public static final StructurePieceType MY_PIECE = MyGenerator.MyPiece:: | public static final StructurePieceType MY_PIECE = MyGenerator.MyPiece:: | ||
private static final StructureFeature< | private static final StructureFeature< | ||
- | | + | |
@Override | @Override | ||
Line 150: | Line 158: | ||
.register(); | .register(); | ||
- | | + | |
- | MY_CONFIGURED); | + | |
+ | | ||
} | } | ||
} | } | ||
</ | </ | ||
- | ===== Adding a configured feature to a biome ===== | + | ===== Adding a configured feature to biomes |
- | Vanilla features generated in the plain biomes are listed in '' | + | In this tutorial, we add our structure to all biomes. |
- | We modify | + | |
<code java> | <code java> | ||
- | @Mixin(DefaultBiomeFeatures.class) | + | public class ExampleMod implements ModInitializer |
- | public class DefaultBiomeFeaturesMixin | + | [...] |
- | @Inject(method = " | + | |
- | | + | @Override |
- | | + | |
+ | | ||
+ | |||
+ | BiomeModifications.addStructure(BiomeSelectors.all(), myConfigured); | ||
} | } | ||
} | } | ||
- | |||
</ | </ | ||
===== Result ===== | ===== Result ===== | ||
- | You should be met with igloos | + | You should be met with igloos. |
You can use below command to find your structure in the world. | You can use below command to find your structure in the world. | ||
tutorial/structures.txt · Last modified: 2022/11/05 12:06 by jab125