Search in sources :

Example 1 with Selector

use of net.minecraft.client.renderer.block.model.multipart.Selector in project ForestryMC by ForestryMC.

the class MultipartModel method bake.

@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    MultipartBakedModel.Builder builder = new MultipartBakedModel.Builder();
    for (Selector selector : multipart.getSelectors()) {
        IModel model = partModels.get(selector);
        IBakedModel bakedModel = model.bake(model.getDefaultState(), format, bakedTextureGetter);
        builder.putModel(selector.getPredicate(multipart.getStateContainer()), bakedModel);
    }
    return builder.makeMultipartModel();
}
Also used : IModel(net.minecraftforge.client.model.IModel) MultipartBakedModel(net.minecraft.client.renderer.block.model.MultipartBakedModel) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) Selector(net.minecraft.client.renderer.block.model.multipart.Selector)

Example 2 with Selector

use of net.minecraft.client.renderer.block.model.multipart.Selector in project ForestryMC by ForestryMC.

the class MultipartModel method retexture.

@Override
public IModel retexture(ImmutableMap<String, String> textures) {
    try {
        ImmutableMap.Builder<Selector, IModel> builder = ImmutableMap.builder();
        for (Selector selector : multipart.getSelectors()) {
            IModel model = new SimpleModel(location, selector.getVariantList());
            model = model.retexture(textures);
            builder.put(selector, model);
        }
        return new MultipartModel(location, multipart, builder.build());
    } catch (Exception e) {
        return this;
    }
}
Also used : IModel(net.minecraftforge.client.model.IModel) ImmutableMap(com.google.common.collect.ImmutableMap) Selector(net.minecraft.client.renderer.block.model.multipart.Selector)

Aggregations

Selector (net.minecraft.client.renderer.block.model.multipart.Selector)2 IModel (net.minecraftforge.client.model.IModel)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 MultipartBakedModel (net.minecraft.client.renderer.block.model.MultipartBakedModel)1