User Tools

Site Tools


zh_cn:tutorial:blockentityrenderers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
zh_cn:tutorial:blockentityrenderers [2019/12/19 10:08] lightcolourzh_cn:tutorial:blockentityrenderers [2019/12/19 10:10] lightcolour
Line 69: Line 69:
     }     }
 </code> </code>
-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: we translate it to 0.51.25, and 0.5 which is above the center of our block.  +转换分为两部分:将其转换为高于块中心的0.51.250.5 
-The second part is the part that changes: the offset in the 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 to slow the movement down. +   *8除以减慢运动速度。 
-  Taking the sine of that to produce a value that ranges between -1 and 1, like a [[https://www.electronicshub.org/wp-content/uploads/2015/07/11.jpg|sine wave]]. +   *以正弦值产生介于-11之间的值,例如a[[https://www.electronicshub.org/wp-content/uploads/2015/07/11.jpg|正弦波]]. 
-  Dividing that by to compress the sine wave vertically so the item doesn’t move up and down as much.+   将其除以4可垂直压缩正弦波,因此该项目不会上下移动太多。
 <code java> <code java>
     public void render(DemoBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {     public void render(DemoBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
zh_cn/tutorial/blockentityrenderers.txt · Last modified: 2023/08/29 10:31 by wjz_p