Posted October 9, 201410 yr Hello everyone. I would like to know how I can change the rotation angle of my custom rendered item depending on the players rotationPitch (up / down angle) I would kind of like to do what the map does, but I can't find the code that allows the map to do this anywhere. So, my question really is; how do I get the players rotationPitch from the item renderer? there is no EntityPlayer parameter in any of the methods in IItemRenderer, and I can't find a way to get the player that is holding the current item from the ItemStack parameters. If I could do either of these two things, I would be fine from there to achieve the rest. Thanks. I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
October 9, 201410 yr Author Okay, I figured it out. I simply did the following: public Minecraft mc = Minecraft.getMinecraft(); //Get an instance of minecraft //Then in renderItem method //...Irrelevant code here... float pitch = this.mc.thePlayer.rotationPitch; GL11.glRotatef(rotationPitch, 1, 0, 0); //...Then just the rest of the rendering code here Now obviously there is more to this, like GL11.glPush/PopMatrix(); and model.renderAll() (if using obj) and whatever other rotation values there are, but this is the general idea that I had, get an instance of the player from Minecraft.getMinecraft(). I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
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.