tutorial:features
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:features [2020/01/08 12:10] – lightcolour | tutorial:features [2020/01/08 12:18] – lightcolour | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== 在您的世界中生成Feature | + | ===== Generating Features in your World ===== |
- | 岩石,树木,矿石和池塘都是Feature的示例。 它们是对世界的简单补充,它们的生成取决于它们的配置方式。 在本教程中,我们将研究如何在我们的世界中随机生成一个简单的石螺旋Feature。 | + | Rocks, trees, ores, and ponds are all examples of Features. They are simple generation additions to the world which generate depending on how they are configured. In this tutorial, we'll look at generating a simple stone spiral feature in our world randomly. |
- | ==== 创建Feature类 ==== | + | |
- | 一个简单的Feature如下所示: | + | ==== Creating a Feature |
+ | A simple | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
public class StoneSpiralFeature extends Feature< | public class StoneSpiralFeature extends Feature< | ||
Line 25: | Line 26: | ||
</ | </ | ||
- | 构造函数采用'' | + | The constructor takes in a '' |
`generate` is called when the chunk decides to generate the feature. If the feature is configured to spawn every chunk, this would be called for each chunk being generated as well. In the case of the feature being configured to spawn at a certain rate per biome, `generate` would only be called in instances where the world wants to spawn the structure. | `generate` is called when the chunk decides to generate the feature. If the feature is configured to spawn every chunk, this would be called for each chunk being generated as well. In the case of the feature being configured to spawn at a certain rate per biome, `generate` would only be called in instances where the world wants to spawn the structure. | ||
Line 46: | Line 47: | ||
</ | </ | ||
- | ==== 注册一个Feature ==== | + | ==== Registering a Feature ==== |
- | 可以像注册游戏中的其他大多数内容一样注册Feature,而且您不必担心任何特殊的构建器或机制。 | + | Features can be registered like most other content in the game, and there aren't any special builders or mechanics you'll have to worry about. |
<code java> | <code java> | ||
private static final Feature< | private static final Feature< | ||
Line 56: | Line 57: | ||
</ | </ | ||
- | ==== 向生物群落添加Feature ==== | + | ==== Adding a Feature |
- | 生物群系有一种称为'' | + | Biome has a method called |
- | 我们可以遍历'' | + | We can iterate over '' |
<code java> | <code java> | ||
Registry.BIOME.forEach(biome -> biome.addFeature( | Registry.BIOME.forEach(biome -> biome.addFeature( | ||
Line 78: | Line 79: | ||
The Decorator represents how the world chooses to place your Feature. '' | The Decorator represents how the world chooses to place your Feature. '' | ||
- | === 结果 | + | === Results |
{{https:// | {{https:// |
tutorial/features.txt · Last modified: 2023/12/18 01:19 by solidblock