Advertisement
Guest User

Untitled

a guest
Feb 26th, 2016
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. @SubscribeEvent
  2.     public void onModelBakeEvent(ModelBakeEvent event){
  3.         try {
  4.             TextureAtlasSprite atlas = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fancyItemLocation.toString());
  5.             IModel model = OBJLoader.instance.loadModel(fancyItemLocation);
  6.            
  7.             TRSRTransformation transformation = new TRSRTransformation(
  8.                     new Vector3f(0, -1, 0),
  9.                     new Quat4f(0, 0, 0, 0),
  10.                     new Vector3f(1, 1, 1),
  11.                     new Quat4f(0, 0, 0, 0));
  12.            
  13.             event.modelRegistry.putObject(fancyItemLocation,
  14.                     model.bake(
  15.                             new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true, transformation),
  16.                             new VertexFormat(),
  17.                             loc -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fancyItemLocation.toString())
  18.                     )
  19.             );
  20.         } catch (IOException e) {
  21.             // TODO Auto-generated catch block
  22.             e.printStackTrace();
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement