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 [2022/01/31 00:24] – outercloudstudio | tutorial:blockentityrenderers [2022/12/16 02:28] – solidblock | ||
---|---|---|---|
Line 11: | Line 11: | ||
The first thing we need to do is create our '' | The first thing we need to do is create our '' | ||
<code java> | <code java> | ||
- | public class DemoBlockEntityRenderer<T extends BlockEntity> | + | @Environment(EnvType.CLIENT) |
+ | public class DemoBlockEntityRenderer implements BlockEntityRenderer< | ||
// A jukebox itemstack | // A jukebox itemstack | ||
private static ItemStack stack = new ItemStack(Items.JUKEBOX, | private static ItemStack stack = new ItemStack(Items.JUKEBOX, | ||
Line 26: | Line 27: | ||
Create a new class next to your main class that implements '' | Create a new class next to your main class that implements '' | ||
<code java> | <code java> | ||
+ | @Environment(EnvType.CLIENT) | ||
public class ExampleModClient implements ClientModInitializer { | public class ExampleModClient implements ClientModInitializer { | ||
@Override | @Override | ||
Line 50: | Line 52: | ||
@Override | @Override | ||
public void onInitializeClient() { | public void onInitializeClient() { | ||
- | BlockEntityRendererRegistry.INSTANCE.register(DEMO_BLOCK_ENTITY, | + | BlockEntityRendererRegistry.register(DEMO_BLOCK_ENTITY, |
} | } | ||
</ | </ | ||
Line 106: | Line 108: | ||
The jukebox should now have the proper lighting. | The jukebox should now have the proper lighting. | ||
+ | |||
+ | ===== Rendering according to block entity data ===== | ||
+ | Sometimes you wants to render according to the block entity data (nbt), and you find they are all empty, even if you can access the data through ''/ |
tutorial/blockentityrenderers.txt · Last modified: 2023/02/09 13:14 by mschae23