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 revision
Previous revision
Next revisionBoth sides next revision
zh_cn:tutorial:blockentityrenderers [2019/12/19 10:10] lightcolourzh_cn:tutorial:blockentityrenderers [2019/12/19 10:13] lightcolour
Line 90: Line 90:
     }     }
 </code> </code>
-Finally, we will get the Minecraft 'ItemRenderer' and render the jukebox item by using ''renderItem'' +最后,我们将获得Minecraft的''ItemRenderer'',并使用''renderItem''渲染自动点唱机项目。 
-We also pass ''ModelTransformation.Type.GROUND'' to ''renderItem'' because we want a similiar effect to  +我们还将''ModelTransformation.Type.GROUND''传递给''renderItem'',因为我们希望有类似的效果 
-an item lying on the ground. Try experimenting with this value and see what happens (it's an enum).  +躺在地上的物品。 尝试尝试使用此值,看看会发生什么(这是一个枚举)。 
-We also need to call ''matrices.pop();'' after these GL calls:+在这些GL调用之后,我们还需要调用''matrices.pop();''
 <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) {
Line 104: Line 104:
 </code> </code>
  
-You can try your newly created block entity renderer right now.  +您可以立即尝试新创建的块实体渲染器。 
-However, if you didn't make your block transparent, you will notice something is amiss the floating block, the jukebox, is pitch black!   +但是,如果您没有使块透明,您会发现有些不对劲-浮动块,点唱机是黑色的! 
-This is because by default, //whatever you render in the block entity, will receive light as if it's in the same position as the block entity//. +这是因为默认情况下,无论您在方块实体中进行渲染的任何内容,都将接收光线,就好像它与块实体//处于同一位置一样。 
-So the floating block receives light from //inside// our opaque block, which means it receives no light!  +因此,浮动块从不透明的块中接收inside的光,这意味着它没有接收到光! 
-To fix this, we will tell Minecraft to receive light from //one block above// the location of the block entity.  +为了解决这个问题,我们将告诉Minecraft从上方的一个方块方块实体的位置接收光。
  
-To get the light, we call ''WorldRenderer#getLightmapCoordinates()'' on the position above our block entity,  +要获取灯光,我们在块实体上方的位置调用''WorldRenderergetLightmapCoordinates();'' 
-and to use the light we use it in ''renderItem()'':+并使用灯光,我们在''renderItem();''中使用它:
 <code java> <code java>
     @Override     @Override
Line 124: Line 124:
 </code> </code>
  
-The jukebox should now have the proper lighting. +点唱机现在应具有适当的照明。
zh_cn/tutorial/blockentityrenderers.txt · Last modified: 2023/08/29 10:31 by wjz_p