Posted February 9, 201411 yr So i'm making a 3D printer block, so as you can imagine ill be needing to render the item i'm printing on the printing bed of the machine. I've experimented calling an ItemRenderer with bad results. Whats the best way to render an item like this in world? Would it be best to use an ItemEntity and somehow stop the rotation and make it un-pickupable? Or is there some way i can piggyback the ItemRenderer for an item as render it in my TileEntitySpecialRenderer?
February 9, 201411 yr Make an EntityItem of the item you want to display and then render it. I put this in my model class, because of rendering order, but you can put it in the render class as well. if(es.itemEnt != null) { GL11.glPushMatrix(); double angle = Math.toRadians(es.rotation); float sin = (float)(Math.sin(angle)); float cos = (float)(Math.cos(angle)); sin = Math.round(sin*100)/100; cos = Math.round(cos*100)/100; GL11.glTranslatef((float)x + 0.5F + (float)(sin*0.25), (float)y + 0.76F, (float)z + 0.5F - (float)(cos*0.25)); GL11.glRotatef(-1*es.rotation, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); RenderManager.instance.renderEntityWithPosYaw(es.itemEnt, 0, 0, 0, 0, 0); GL11.glPopMatrix(); } The rotation math was because the (2D) item was laying flat on the top of the TE. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 9, 201411 yr Author Ah awesome thanks. Would you mind explaining where you are getting 'es.rotation' from, as i cannot seem to find a reference to it anywhere, and passing an arbitrary value in its place just seems to make the item spin uncontrollably.
February 9, 201411 yr Would you mind explaining where you are getting 'es.rotation' from, as i cannot seem to find a reference to it anywhere, and passing an arbitrary value in its place just seems to make the item spin uncontrollably. That was the rotation of the block itself. It's based on metadata. Also, you will need to set the entity's age to 0 every frame or it will self-rotate like any other dropped item. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 9, 201411 yr Author Awesome it works Thanks! The only thing i'm having issues with now is that it seems to be randomly rotated each time the game starts again. I'm setting the age to 0 every time so i'm not to sure what its about.
February 9, 201411 yr itemEnt.rotationYaw = 0; That value is randomized when item entities are instanciated. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.