Fix Templates blocking other custom models.

Currently `TemplateModelVariantProvider.loadModelVariant` will throw `a ModelProviderException` if it doesn't have a model already in the map - however this stops any other mods from providing custom models that are later in their chain.

While this behaviour isn't documented (fabric's `ModelVariantProvider` interface doesn't even *mention* `ModelProviderException`) it does say that it should `@return The loaded UnbakedModel, or null if this ModelVariantProvider doesn't handle a specific Identifier`
This commit is contained in:
AlexIIL 2019-06-22 17:27:29 +01:00 committed by GitHub
parent 0063532e03
commit 26a07e23c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,7 @@ public class TemplateModelVariantProvider implements ModelVariantProvider {
@Override @Override
public UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException { public UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException {
UnbakedModel variant = variants.get(modelId); return variants.get(modelId);
if (variant == null) throw new ModelProviderException("Couldn't find model for ID " + modelId);
return variant;
} }
public void registerTemplateModels(Block block, BlockState itemState, Function<BlockState, AbstractModel> model) { public void registerTemplateModels(Block block, BlockState itemState, Function<BlockState, AbstractModel> model) {