Search in sources :

Example 6 with IModel

use of net.minecraftforge.client.model.IModel in project ImmersiveEngineering by BluSunrize.

the class IEOBJLoader method loadModel.

@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
    ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath());
    if (!cache.containsKey(file)) {
        IModel model = OBJLoader.INSTANCE.loadModel(modelLocation);
        if (model instanceof OBJModel) {
            IEOBJModel ieobj = new IEOBJModel(((OBJModel) model).getMatLib(), file);
            cache.put(modelLocation, ieobj);
        }
    }
    IEOBJModel model = cache.get(file);
    if (model == null)
        return ModelLoaderRegistry.getMissingModel();
    return model;
}
Also used : IModel(net.minecraftforge.client.model.IModel) ResourceLocation(net.minecraft.util.ResourceLocation) OBJModel(net.minecraftforge.client.model.obj.OBJModel)

Example 7 with IModel

use of net.minecraftforge.client.model.IModel in project Railcraft by Railcraft.

the class OutfittedTrackModel method bakeModels.

@SuppressWarnings("Guava")
private Map<ModelResourceLocation, IBakedModel> bakeModels(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, Set<ModelResourceLocation> modelLocations) {
    Map<ModelResourceLocation, IBakedModel> models = new HashMap<>();
    for (ModelResourceLocation modelLocation : modelLocations) {
        IModel model = ModelManager.getModel(modelLocation);
        models.put(modelLocation, model.bake(model.getDefaultState(), format, bakedTextureGetter));
    }
    return models;
}
Also used : IModel(net.minecraftforge.client.model.IModel)

Example 8 with IModel

use of net.minecraftforge.client.model.IModel in project Railcraft by Railcraft.

the class JSONModelRenderer method bakeModels.

@SubscribeEvent
public void bakeModels(TextureStitchEvent.Post event) {
    final TextureMap map = event.getMap();
    for (Map.Entry<ResourceLocation, IModel> model : models.entrySet()) {
        IBakedModel bakedModel = model.getValue().bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, l -> l == null ? RenderTools.getMissingTexture() : map.getAtlasSprite(l.toString()));
        bakedModels.put(model.getKey(), bakedModel);
    }
}
Also used : IModel(net.minecraftforge.client.model.IModel) TextureMap(net.minecraft.client.renderer.texture.TextureMap) ResourceLocation(net.minecraft.util.ResourceLocation) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) TextureMap(net.minecraft.client.renderer.texture.TextureMap) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

IModel (net.minecraftforge.client.model.IModel)8 ResourceLocation (net.minecraft.util.ResourceLocation)4 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)3 TextureMap (net.minecraft.client.renderer.texture.TextureMap)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 Nullable (jline.internal.Nullable)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 IAnimatedModel (net.minecraftforge.client.model.animation.IAnimatedModel)1 OBJModel (net.minecraftforge.client.model.obj.OBJModel)1 VertexBufferConsumer (net.minecraftforge.client.model.pipeline.VertexBufferConsumer)1 IModelState (net.minecraftforge.common.model.IModelState)1 IAnimationStateMachine (net.minecraftforge.common.model.animation.IAnimationStateMachine)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1