zh_cn:tutorial:blockentityrenderers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
zh_cn:tutorial:blockentityrenderers [2019/12/19 10:08] – lightcolour | zh_cn:tutorial:blockentityrenderers [2019/12/19 10:10] – lightcolour | ||
---|---|---|---|
Line 69: | Line 69: | ||
} | } | ||
</ | </ | ||
- | We then perform the movement of the jukebox (matrices.translate) and rotation (matrices.multiply). | + | 然后,我们执行自动点唱机的移动(matrices.translate)和旋转(matrices.multiply)。 |
- | There are two parts to the translation: | + | 转换分为两部分:将其转换为高于块中心的0.5、1.25和0.5。 |
- | The second part is the part that changes: the offset in the y value. The offset is the height of the item for any given frame. | + | 第二部分是更改的部分:y值的偏移量。 偏移量是任何给定框架的项目高度。 |
- | We recalculate this each time because we want it to be animating bouncing up and down. We calculate this by: | + | 每次我们都要重新计算,因为我们希望它可以动画上下跳跃。 我们通过以下方式计算: |
- | * Getting the current world time, which changes over time. | + | |
- | * Adding the partial ticks. (The partial ticks is a fractional value representing the amount of time that’s passed between the last full tick and now. We use this because otherwise the animation would be jittery because there are fewer ticks per second than frames per second.) | + | |
- | * Dividing that by 8 to slow the movement down. | + | |
- | * Taking the sine of that to produce a value that ranges between | + | |
- | * Dividing that by 4 to compress the sine wave vertically so the item doesn’t move up and down as much. | + | |
<code java> | <code java> | ||
public void render(DemoBlockEntity blockEntity, | public void render(DemoBlockEntity blockEntity, |
zh_cn/tutorial/blockentityrenderers.txt · Last modified: 2023/08/29 10:31 by wjz_p