Search in sources :

Example 1 with Multipart

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

the class ProxyArboricultureClient method retexturBlockModel.

private void retexturBlockModel(IRegistry<ModelResourceLocation, IBakedModel> registry, ImmutableMap<String, String> textures, IWoodType woodType, WoodBlockKind woodKind, IBlockState blockState, IWoodStateMapper woodMapper) {
    ModelResourceLocation defaultModelResourceLocation = woodMapper.getDefaultModelResourceLocation(blockState);
    IModel basicModel = ModelLoaderRegistry.getModelOrMissing(defaultModelResourceLocation);
    if (basicModel instanceof MultipartModel) {
        MultipartModel multipartModel = (MultipartModel) basicModel;
        Multipart multipart = multipartModel.getMultipart();
        multipart.setStateContainer(blockState.getBlock().getBlockState());
    }
    ModelResourceLocation basicLocation = woodMapper.getModelLocation(blockState);
    IModel retextureModel = woodKind.retextureModel(basicModel, woodType, textures);
    registry.putObject(basicLocation, new SimpleRetexturedModel(retextureModel));
}
Also used : IModel(net.minecraftforge.client.model.IModel) Multipart(net.minecraft.client.renderer.block.model.multipart.Multipart) SimpleRetexturedModel(forestry.core.models.SimpleRetexturedModel) MultipartModel(forestry.arboriculture.models.MultipartModel) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

MultipartModel (forestry.arboriculture.models.MultipartModel)1 SimpleRetexturedModel (forestry.core.models.SimpleRetexturedModel)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 Multipart (net.minecraft.client.renderer.block.model.multipart.Multipart)1 IModel (net.minecraftforge.client.model.IModel)1