diff --git a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/ModelModifier.java b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/ModelModifier.java index 8a6fb0894..58786621f 100644 --- a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/ModelModifier.java +++ b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/ModelModifier.java @@ -19,6 +19,7 @@ import java.util.function.Function; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.Baker; @@ -168,6 +169,10 @@ public interface AfterBake { * This handler is invoked to allow modification of the baked model instance right after it is baked and before * it is cached. * + *
Note that the passed baked model may be null and that this handler may return a null baked model, since + * {@link UnbakedModel#bake} and {@link Baker#bake} may also return null baked models. Null baked models are + * automatically mapped to the missing model during model retrieval. + * *
For further information, see the docs of {@link ModelLoadingPlugin.Context#modifyModelAfterBake()}.
*
* @param model the current baked model instance
@@ -175,7 +180,8 @@ public interface AfterBake {
* @return the model that should be used in this scenario. If no changes are needed, just return {@code model} as-is.
* @see ModelLoadingPlugin.Context#modifyModelAfterBake
*/
- BakedModel modifyModelAfterBake(BakedModel model, Context context);
+ @Nullable
+ BakedModel modifyModelAfterBake(@Nullable BakedModel model, Context context);
/**
* The context for an after bake model modification event.
diff --git a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingEventDispatcher.java b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingEventDispatcher.java
index fba9dc19a..c0a62ce67 100644
--- a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingEventDispatcher.java
+++ b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingEventDispatcher.java
@@ -279,7 +279,8 @@ public UnbakedModel modifyModelBeforeBake(UnbakedModel model, Identifier id, Fun
return model;
}
- public BakedModel modifyModelAfterBake(BakedModel model, Identifier id, UnbakedModel sourceModel, Function