Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.railsofwar.row.common;
- import com.google.common.collect.ImmutableMap;
- import net.minecraft.client.renderer.block.model.IBakedModel;
- import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.client.model.*;
- import net.minecraftforge.common.model.IModelState;
- import net.railsofwar.row.industry.client.ModelsIndustry;
- import javax.annotation.Nullable;
- public class UtilModels{
- @Nullable
- public static IModel loadModel(ResourceLocation modelLocation, String textureLocation){
- try{
- return ((IRetexturableModel) ((IModelCustomData) ModelLoaderRegistry.getModel(modelLocation))
- .process(ImmutableMap.of("flip-v", "true")))
- .retexture(ImmutableMap.of("#None", textureLocation));
- }catch(Exception e){
- e.printStackTrace();
- }
- return null;
- }
- public static IModel textureModel(IModel model, String material, String textureLocation){
- return ((IRetexturableModel) model).retexture(ImmutableMap.of(material, textureLocation));
- }
- public static IBakedModel bakeModel(IModel model, IModelState state){
- return model.bake(state, DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment