Jump to content

[SOLVED] [1.8] Return Item Texture For Inventory, Models For First / Third


Recommended Posts


I would like to know how to return textures for items in inventory view, a specific model in first person, and a specific model in third person. I have the first and third person models rendered correctly according to the third / first person status. The only thing that is wrong with that is that in the survival inventory (where you can see the player looking at your cursor), the first person model is rendered when the third person should be (this is problem 1). Problem 2 is that I need to be able to return a texture in the inventory while still being able to see the models in first person and third. Basically, model1 first person (DONE), model2 third person (DONE), inventory - texture (NOT DONE), third person model when in survival inventory (again, when player is looking at your cursor) (NOT DONE). Any help is much so appreciated, thanks.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

the first person  model is rendered when the first person should be (this is problem 1)



inventory - texture (NOT DONE)


third person model when in survival inventory (again, when player is looking at your cursor)

What exactly is the context for these? By inventory texture do you mean like, the texture for an item..?

Are you replacing the vanilla player model in the second part of this quote?


I'm just not sure what you're trying to achieve...



As for drawing an entity on the screen as with the inventory, this code is from the GuiInventory class in vanilla minecraft:

     * Draws the entity to the screen. Args: xPos, yPos, scale, mouseX, mouseY, entityLiving
    public static void drawEntityOnScreen(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_)
        GlStateManager.translate((float)p_147046_0_, (float)p_147046_1_, 50.0F);
        GlStateManager.scale((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_);
        GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        float f2 = p_147046_5_.renderYawOffset;
        float f3 = p_147046_5_.rotationYaw;
        float f4 = p_147046_5_.rotationPitch;
        float f5 = p_147046_5_.prevRotationYawHead;
        float f6 = p_147046_5_.rotationYawHead;
        GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
        p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F;
        p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F;
        p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F;
        p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw;
        p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw;
        GlStateManager.translate(0.0F, 0.0F, 0.0F);
        RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
        rendermanager.renderEntityWithPosYaw(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
        p_147046_5_.renderYawOffset = f2;
        p_147046_5_.rotationYaw = f3;
        p_147046_5_.rotationPitch = f4;
        p_147046_5_.prevRotationYawHead = f5;
        p_147046_5_.rotationYawHead = f6;

No clue where the model is set, however, as I'm not familiar with the 1.8 rendering system. The fact that Entity.java and EntityLivingBase.java don't have anything to do with models leads me to believe it's handled in some minecraft.client.* file, but you'd have to do some exploration to figure that out.

Link to comment
Share on other sites

Thanks for the replies. I'm terribly sorry about the typos, I wrote that fast because I was busy. Anyway I was trying to render the MODEL1 for first person and MODEL2 for third person. I have successfully done this, its just that when looking in your inventory (when you can see the player and he follows your mouse), the first person model is rendered when I want the third person model to be rendered. Well, the .JSON model is giving me too many bugs and there really isn't any tutorials on IPerspectiveAwareModel (seems like nothing supports 1.8, :D), so I'm just going to close this topic and stick to rendering models for items in Java rather in .JSON. Thanks, topic closed and locked.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

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