tutorial:blockentityrenderers
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:blockentityrenderers [2019/12/14 10:43] – fix typo juuz | tutorial:blockentityrenderers [2021/05/18 05:20] – [Introduction] solidblock | ||
---|---|---|---|
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: | + | //This is the 1.15 & 1.16 version of this tutorial. For the 1.14 version, see [[tutorial: |
Make sure you [[tutorial: | Make sure you [[tutorial: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | Blocks by themselves aren't that interesting, | + | Blocks by themselves aren't that interesting, |
- | they just stay static at a certain location and a certain size until broken. | + | |
- | We can use block entity renderers to render items and blocks associated with a block entity far more dynamically - render multiple different items, | + | |
- | at differing locations and sizes, and more. | + | |
===== Example ===== | ===== Example ===== | ||
In this tutorial we'll build off the block entity we created by adding a '' | In this tutorial we'll build off the block entity we created by adding a '' | ||
Line 60: | Line 57: | ||
@Override | @Override | ||
public void onInitializeClient() { | public void onInitializeClient() { | ||
- | BlockEntityRendererRegistry.INSTANCE.register(DemoBlockEntity.class, MyBlockEntityRenderer:: | + | BlockEntityRendererRegistry.INSTANCE.register(DEMO_BLOCK_ENTITY, MyBlockEntityRenderer:: |
} | } | ||
</ | </ | ||
Line 98: | Line 95: | ||
public void render(DemoBlockEntity blockEntity, | public void render(DemoBlockEntity blockEntity, | ||
[...] | [...] | ||
- | MinecraftClient.getInstance().getItemRenderer().renderItem(stack, | + | MinecraftClient.getInstance().getItemRenderer().renderItem(stack, |
// Mandatory call after GL calls | // Mandatory call after GL calls | ||
Line 119: | Line 116: | ||
| | ||
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), | int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), | ||
- | MinecraftClient.getInstance().getItemRenderer().renderItem(stack, | + | MinecraftClient.getInstance().getItemRenderer().renderItem(stack, |
| | ||
[...] | [...] |
tutorial/blockentityrenderers.txt · Last modified: 2023/02/09 13:14 by mschae23