Jump to content

Changing Item Render Rotation Based on player rotationPitch [UNSOLVED] [1.7.10]


TheEpicTekkit

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.