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;
}
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;
}
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);
}
}
Aggregations