User Tools

Site Tools


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
tutorial:blockentityrenderers [2019/12/14 00:02] – 1.15 juuztutorial:blockentityrenderers [2020/03/29 15:44] – Updated based on newer mappings jamieswhiteshirt
Line 1: Line 1:
 ====== Rendering blocks and items dynamically using block entity renderers ====== ====== Rendering blocks and items dynamically using block entity renderers ======
 +
 +//This is the 1.15 version of this tutorial. For the 1.14 version, see [[tutorial:1.14:blockentityrenderers|Rendering blocks and items dynamically using block entity renderers (1.14)]].//
  
 Make sure you [[tutorial:blockentity|added a block entity]] before reading this tutorial!  Make sure you [[tutorial:blockentity|added a block entity]] before reading this tutorial! 
Line 58: Line 60:
 @Override @Override
 public void onInitializeClient() { public void onInitializeClient() {
-    BlockEntityRendererRegistry.INSTANCE.register(DemoBlockEntity.class, MyBlockEntityRenderer::new);+    BlockEntityRendererRegistry.INSTANCE.register(DEMO_BLOCK_ENTITY, MyBlockEntityRenderer::new);
 } }
 </code> </code>
Line 96: Line 98:
     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) {
         [...]         [...]
-        MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Type.GROUND, light, overlay, matrices, vertexConsumers);+        MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.GROUND, light, overlay, matrices, vertexConsumers);
  
         // Mandatory call after GL calls         // Mandatory call after GL calls
Line 117: Line 119:
                  
         int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());         int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
-        MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Type.GROUND, lightAbove, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers);+        MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.GROUND, lightAbove, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers);
                  
         [...]         [...]
tutorial/blockentityrenderers.txt · Last modified: 2023/02/09 13:14 by mschae23