User Tools

Site Tools


tutorial:custom_model

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
tutorial:custom_model [2020/08/13 23:21] technici4ntutorial:custom_model [2020/08/14 07:12] – [custom model] Add a note regarding more dynamic rendering technici4n
Line 1: Line 1:
-====== Creating a custom block model ======+====== Rendering Blocks and Items Dynamically using a custom Model ======
 It is possible to add models to the game using block model JSON files, but it is also possible to render them through Java code. In this tutorial, we will add a four-sided furnace model to the game. It is possible to add models to the game using block model JSON files, but it is also possible to render them through Java code. In this tutorial, we will add a four-sided furnace model to the game.
  
Line 276: Line 276:
  
 Et voilà! Enjoy! Et voilà! Enjoy!
 +
 +===== More dynamic rendering =====
 +The ''renderContext'' parameter in ''emitBlockQuads'' and ''emitItemQuads'' contains a ''QuadEmitter'' which you can use to build a model on the fly.
 +<code java>
 +    @Override
 +    public void emitBlockQuads(BlockRenderView blockRenderView, BlockState blockState, BlockPos blockPos, Supplier<Random> supplier, RenderContext renderContext) {
 +        QuadEmitter emitter = renderContext.getEmitter();
 +        /* With this emitter, you can directly append the quads to the chunk model. */
 +    }
 +</code>
tutorial/custom_model.txt · Last modified: 2023/12/31 21:40 by gudenau