mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 11:20:55 -04:00
Clarify nullability of ModelModifier.AfterBake
(#3212)
* Clarify nullability of AfterBake modifier * Fix documentation Null baked models are cached, but only in the inner cache, which is not accessible after all baking is finished. The term "cache" is also ambiguous, so its use has been removed. * Add breaks for v0 <0.4.0
This commit is contained in:
parent
95ae871652
commit
3a1ea2f107
3 changed files with 12 additions and 2 deletions
fabric-model-loading-api-v1/src/client
java/net/fabricmc/fabric
api/client/model/loading/v1
impl/client/model/loading
resources
|
@ -19,6 +19,7 @@ package net.fabricmc.fabric.api.client.model.loading.v1;
|
|||
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 final class ModelModifier {
|
|||
* This handler is invoked to allow modification of the baked model instance right after it is baked and before
|
||||
* it is cached.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>For further information, see the docs of {@link ModelLoadingPlugin.Context#modifyModelAfterBake()}.
|
||||
*
|
||||
* @param model the current baked model instance
|
||||
|
@ -175,7 +180,8 @@ public final class ModelModifier {
|
|||
* @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.
|
||||
|
|
|
@ -279,7 +279,8 @@ public class ModelLoadingEventDispatcher {
|
|||
return model;
|
||||
}
|
||||
|
||||
public BakedModel modifyModelAfterBake(BakedModel model, Identifier id, UnbakedModel sourceModel, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings settings, Baker baker) {
|
||||
@Nullable
|
||||
public BakedModel modifyModelAfterBake(@Nullable BakedModel model, Identifier id, UnbakedModel sourceModel, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings settings, Baker baker) {
|
||||
if (afterBakeModifierContextStack.isEmpty()) {
|
||||
afterBakeModifierContextStack.add(new AfterBakeModifierContext());
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
"fabricloader": ">=0.14.21",
|
||||
"fabric-api-base": "*"
|
||||
},
|
||||
"breaks": {
|
||||
"fabric-models-v0": "<0.4.0"
|
||||
},
|
||||
"description": "Provides hooks for model loading.",
|
||||
"mixins": [
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue