tutorial:custom_model
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:custom_model [2020/08/14 07:12] – [custom model] Add a note regarding more dynamic rendering technici4n | tutorial:custom_model [2020/09/09 15:57] – [custom model] Fix resource reloading "bug" technici4n | ||
---|---|---|---|
Line 197: | Line 197: | ||
==== Updating the model ==== | ==== Updating the model ==== | ||
- | We will re-use the same model class, with a few changes: | + | We will re-use the same model class, with just a small change: |
- | * We will register the same model instance under a different name, so we'll make sure the model is only baked once. | + | |
* We will need a '' | * We will need a '' | ||
Line 206: | Line 205: | ||
private static final Identifier DEFAULT_BLOCK_MODEL = new Identifier(" | private static final Identifier DEFAULT_BLOCK_MODEL = new Identifier(" | ||
- | private boolean isBaked = false; | ||
private ModelTransformation transformation; | private ModelTransformation transformation; | ||
| | ||
Line 217: | Line 215: | ||
@Override | @Override | ||
public BakedModel bake(ModelLoader loader, Function< | public BakedModel bake(ModelLoader loader, Function< | ||
- | // Don't bake twice | ||
- | if(isBaked) return this; | ||
- | isBaked = true; | ||
- | | ||
// Load the default block model | // Load the default block model | ||
JsonUnbakedModel defaultBlockModel = (JsonUnbakedModel) loader.getOrLoadModel(DEFAULT_BLOCK_MODEL); | JsonUnbakedModel defaultBlockModel = (JsonUnbakedModel) loader.getOrLoadModel(DEFAULT_BLOCK_MODEL); |
tutorial/custom_model.txt · Last modified: 2023/12/31 21:40 by gudenau