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 [2019/11/02 01:59] – draylar | tutorial:features [2020/01/08 12:17] – lightcolour | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Generating Features in your World ===== | + | ===== 在您的世界中生成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。 |
- | + | ==== 创建Feature类 ==== | |
- | ==== Creating a Feature | + | 一个简单的Feature如下所示: |
- | A simple | + | |
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
public class StoneSpiralFeature extends Feature< | public class StoneSpiralFeature extends Feature< | ||
Line 26: | Line 25: | ||
</ | </ | ||
- | The constructor takes in a '' | + | 构造函数采用'' |
- | `generate` is called when the chunk decides to generate | + | 当块决定生成Feature时,将调用``generate``。 如果将功能配置为产生每个块,则也会为正在生成的每个块调用此功能。 在将功能配置为以每个生物群落以一定速率生成的情况下,仅在世界想要生成结构的情况下才调用``generate``。 |
- | In our implementation, | + | 在我们的实现中,我们将从世界的最高位置开始构建一个简单的16块高的石头螺旋: |
<code java> | <code java> | ||
Line 47: | Line 46: | ||
</ | </ | ||
- | ==== 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. | + | 可以像注册游戏中的其他大多数内容一样注册Feature,而且您不必担心任何特殊的构建器或机制。 |
<code java> | <code java> | ||
private static final Feature< | private static final Feature< | ||
Line 57: | Line 56: | ||
</ | </ | ||
- | ==== Adding a Feature | + | ==== 向生物群落添加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 73: | Line 72: | ||
</ | </ | ||
- | The first argument of '' | + | '' |
- | The second argument of '' | + | '' |
- | 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