Add textureGetter parameter to onBakedModelLoad
This commit is contained in:
parent
a100622a03
commit
55cb94f1d1
|
|
@ -1,11 +1,11 @@
|
||||||
package org.embeddedt.modernfix.api.entrypoint;
|
package org.embeddedt.modernfix.api.entrypoint;
|
||||||
|
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.resources.model.ModelBakery;
|
import net.minecraft.client.resources.model.*;
|
||||||
import net.minecraft.client.resources.model.ModelState;
|
|
||||||
import net.minecraft.client.resources.model.UnbakedModel;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface in a mod class and add it to "modernfix:integration_v1" in your mod metadata file
|
* Implement this interface in a mod class and add it to "modernfix:integration_v1" in your mod metadata file
|
||||||
|
|
@ -56,7 +56,22 @@ public interface ModernFixClientIntegration {
|
||||||
* with dynamic resources on
|
* with dynamic resources on
|
||||||
* @return the model which should actually be loaded for this resource location
|
* @return the model which should actually be loaded for this resource location
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
default BakedModel onBakedModelLoad(ResourceLocation location, UnbakedModel baseModel, BakedModel originalModel, ModelState state, ModelBakery bakery) {
|
default BakedModel onBakedModelLoad(ResourceLocation location, UnbakedModel baseModel, BakedModel originalModel, ModelState state, ModelBakery bakery) {
|
||||||
return originalModel;
|
return originalModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to allow mods to observe the loading of a baked model and either make changes to it or wrap it with their
|
||||||
|
* own instance.
|
||||||
|
* @param location the ResourceLocation of the model (this may be a ModelResourceLocation)
|
||||||
|
* @param originalModel the original model
|
||||||
|
* @param bakery the model bakery - do not touch internal fields as they probably don't behave the way you expect
|
||||||
|
* with dynamic resources on
|
||||||
|
* @param textureGetter function to retrieve textures for this model
|
||||||
|
* @return the model which should actually be loaded for this resource location
|
||||||
|
*/
|
||||||
|
default BakedModel onBakedModelLoad(ResourceLocation location, UnbakedModel baseModel, BakedModel originalModel, ModelState state, ModelBakery bakery, Function<Material, TextureAtlasSprite> textureGetter) {
|
||||||
|
return onBakedModelLoad(location, baseModel, originalModel, state, bakery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public abstract class ModelBakerImplMixin implements IExtendedModelBaker {
|
||||||
BakedModel model = operation.call(unbakedModel, baker, spriteGetter, state, location);
|
BakedModel model = operation.call(unbakedModel, baker, spriteGetter, state, location);
|
||||||
|
|
||||||
for(ModernFixClientIntegration integration : ModernFixClient.CLIENT_INTEGRATIONS) {
|
for(ModernFixClientIntegration integration : ModernFixClient.CLIENT_INTEGRATIONS) {
|
||||||
model = integration.onBakedModelLoad(location, unbakedModel, model, state, this.field_40571);
|
model = integration.onBakedModelLoad(location, unbakedModel, model, state, this.field_40571, spriteGetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ public abstract class ModelBakerImplMixin implements IModelBakerImpl, IExtendedM
|
||||||
BakedModel model = operation.call(unbakedModel, baker, spriteGetter, state, location);
|
BakedModel model = operation.call(unbakedModel, baker, spriteGetter, state, location);
|
||||||
|
|
||||||
for(ModernFixClientIntegration integration : ModernFixClient.CLIENT_INTEGRATIONS) {
|
for(ModernFixClientIntegration integration : ModernFixClient.CLIENT_INTEGRATIONS) {
|
||||||
model = integration.onBakedModelLoad(location, unbakedModel, model, state, this.field_40571);
|
model = integration.onBakedModelLoad(location, unbakedModel, model, state, this.field_40571, spriteGetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user