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.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • REM Forge requires a configured set of both JVM and program arguments. REM Add custom JVM arguments to the user_jvm_args.txt REM Add custom program arguments {such as nogui} to this file in the next line before the %* or REM  pass them to this script directly "C:\Program Files\Java\jdk-17\bin\Java.exe" @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.18.2-40.1.80/win_args.txt -Xmx8G -Xms8G %* pause     so I used it.
    • I created an SOUL_JAR Item that has been registered for each mob like - mod:soul_jar_minecraft_cow etc.. but it all has different registry names, i have a model file name soul_jar.json and i want to know how to bind each of those items to this class (When mod iterates through all of vanilla mobs and registering items for them).   I didn't found any info about it because all of info is outdated, and forge docs is complicated asf (i wish there would be more examples) i also used AI but it showing me only outdated info, but theres some code where i registering my item and trying to bind it to model ->   public static void register(IEventBus eventBus){ ITEMS.register(eventBus); Set<ResourceLocation> entityKeyList = ForgeRegistries.ENTITY_TYPES.getKeys(); for (ResourceLocation k : entityKeyList) { EntityType<?> entityType = ForgeRegistries.ENTITY_TYPES.getValue(k); if (!entityType.getCategory().equals(MobCategory.MISC)) { RegistryObject<Item> SOUL_JAR = ITEMS.register("soul_jar" + '_' + k.toString().replace(':', '_').replace('.', '_'), () -> new JarItem(new Item.Properties().rarity(Rarity.RARE).tab(ModTabs.MAGICAL_OBSESSION_JARS), entityType)); if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT) { ItemModelShaper itemModelShaper = Minecraft.getInstance().getItemRenderer().getItemModelShaper(); itemModelShaper.register(SOUL_JAR.get().asItem(), new ModelResourceLocation("item.soul_jar", "inventory")); } } } } I also have more questions like how to iterate through all other mods mobs also, or render mob inside of a jar in inventory, but i will try to figure it out.
    • I looked into OctoEconomyAPI and saw that it was a JAR api for fabric. This means you have a fabric mod in your mods folder. I downloaded your mod folder and wasted 2 solid hours creating a Python script to try to find the faulty mod, and eventually just gave up. I suggest you create two installations with half or the mods in each, find which one doesn't launch, cut that one in half, and repeat until you find the fabric mod. Investigué OctoEconomyAPI y vi que era una API JAR para fabric. Esto significa que tienes un mod de Fabric en tu carpeta de mods. Descargué su carpeta de mods y desperdicié 2 horas completas creando un script de Python para tratar de encontrar el mod defectuoso, y finalmente me di por vencido. Le sugiero que cree dos instalaciones con la mitad o las modificaciones en cada una, encuentre cuál no se inicia, córtela por la mitad y repita hasta que encuentre la modificación Fabric.   (The Python script I made is here): (El script de Python que hice está aquí):  
    • I've got it to work now. Instead of using the texture manager I used the Render System:   RenderSystem.setShaderTexture(0, new ResourceLocation("mcaquests", "textures/item/questbook.png"));  
  • Topics

  • Create New...

Important Information

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