Naitenne

Untitled

Jan 7th, 2017
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. package net.railsofwar.row.common;
  2.  
  3. import com.google.common.collect.ImmutableMap;
  4. import net.minecraft.client.renderer.block.model.IBakedModel;
  5. import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
  6. import net.minecraft.util.ResourceLocation;
  7. import net.minecraftforge.client.model.*;
  8. import net.minecraftforge.common.model.IModelState;
  9. import net.railsofwar.row.industry.client.ModelsIndustry;
  10.  
  11. import javax.annotation.Nullable;
  12.  
  13. public class UtilModels{
  14.  
  15.     @Nullable
  16.     public static IModel loadModel(ResourceLocation modelLocation, String textureLocation){
  17.         try{
  18.             return ((IRetexturableModel) ((IModelCustomData) ModelLoaderRegistry.getModel(modelLocation))
  19.                     .process(ImmutableMap.of("flip-v", "true")))
  20.                     .retexture(ImmutableMap.of("#None", textureLocation));
  21.         }catch(Exception e){
  22.             e.printStackTrace();
  23.         }
  24.         return null;
  25.     }
  26.  
  27.     public static IModel textureModel(IModel model, String material, String textureLocation){
  28.         return ((IRetexturableModel) model).retexture(ImmutableMap.of(material, textureLocation));
  29.     }
  30.  
  31.     public static IBakedModel bakeModel(IModel model, IModelState state){
  32.         return model.bake(state, DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment