Help with Geckolib Item

Started by hacker_303 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with Geckolib Item
Fri, 08/02/2024 - 06:47 (edited)

Hi! I'm looking for a way to make an item that shows the 3D model in the main hand, but displays the 16x16 texture in the inventory, like the trident. I'm using Geckolib. Thanks in advance.

Edited by hacker_303 on Fri, 08/02/2024 - 06:47
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually, if you do it at a…
Mon, 10/07/2024 - 15:06

Actually, if you do it at a full 90° angle, it will appear in 2D. But if you are looking for a different way, I can't help you, I'm new too.

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
{ "loader": "neoforge…
Tue, 10/08/2024 - 21:51
{
"loader": "neoforge:separate_transforms",
"gui_light": "front",
"base": {
"parent": "mod_id:custom/model",
"textures": {
"0": "mod_id:item/model_texture"
}
},
"perspectives": {
"gui": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
},
"gui_light": "front"
},
"ground": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
}
},
"fixed": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
}
}
}
}
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you Pandabeys31 for…
Wed, 11/27/2024 - 18:07

Thank you Pandabeys31 for the advice but even doing it as you say the animations are still visible :/

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
fr6_17, can you explain your…
Wed, 11/27/2024 - 18:09

fr6_17, can you explain your code to me: what are the parts to replace or change and with what?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Lock your item, open the…
Sat, 11/30/2024 - 19:18

Lock your item, open the item.json file and paste in the code above. Then replace the custom/...etc with the names of your textures and models. The custom/model will be the geckolib model, the item/model_texture will be the geckolib model texture for in hand. The item/item_texture will be the texture of the item in the inventory/gui. Also dont include .png at the end of these names, only the actual name is required. E.g. if your file is: [ sword_texture.png , then use item/sword_texture ], same for the model.

This works with any custom model and should work with a geckolib model, I have used it with geckolib and it has worked. Idk if theres been any changes since then, it would depend on your version of mcreator.

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey fr6_17 somehow its not…
Mon, 12/02/2024 - 14:56

Hey fr6_17 somehow its not working for me. 

 

{
  "loader": "neoforge:separate_transforms",
  "gui_light": "front",
  "base": {
    "parent": "roulette:custom/revolver10",
    "textures": {
      "0": "roulette:item/revolver5.0"
    }
  },
  "perspectives": {
    "gui": {
      "parent": "roulette:custom/revolver10",
      "textures": {
        "layer0": "roulette:item/revolver5.0"
      },
      "gui_light": "front"
    },
    "ground": {
      "parent": "roulette:custom/revolver10",
      "textures": {
        "layer0": "roulette:item/revolver5.0"
      }
    },
    "fixed": {
      "parent": "roulette:custom/revolver10",
      "textures": {
        "layer0": "roulette:item/revolver5.0"
      }
    }
  }
}
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well the last 3 "parent"s…
Mon, 12/02/2024 - 16:29

Well the last 3 "parent"s should be "parent": "item/generated". Like I put in the code above. Also you have the same texture for all of them, makes no sense. You should have 2 different textures, one being the 2d 16x16 in inventory texture. Which you put into the last 3 "layer0"s. The other texture is the geckolib model texture which you put in the first "layer0". All you have to do it copy paste the code above and replace mod_id with roulette etc:

{
  "loader": "neoforge:separate_transforms",
  "gui_light": "front",
  "base": {
    "parent": "roulette:custom/revolver10",
    "textures": {
      "0": "roulette:item/revolver5.0"
    }
  },
  "perspectives": {
    "gui": {
      "parent": "item/generated",
      "textures": {
        "layer0": "roulette:item/revolver_gui_texture"
      },
      "gui_light": "front"
    },
    "ground": {
      "parent": "item/generated",
      "textures": {
        "layer0": "roulette:item/revolver_gui_texture"
      }
    },
    "fixed": {
      "parent": "item/generated",
      "textures": {
        "layer0": "roulette:item/revolver_gui_texture"
      }
    }
  }
}

^Like this if your gui texture was called (revolved_gui_texture.png) for example.

Also if your using forge its obviously not gonna work, just replace neoforge with forge in the "loader".
 

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you help me with another…
Mon, 12/02/2024 - 16:55

Can you help me with another question?
I am trying to do an Item animation but if i am holding the item and having another one in my hotbar (or dropped or in itemframe etc..) every item will do the animation.

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The console says that the…
Mon, 12/02/2024 - 17:30

The console says that the model isnt working somehow i mean its a geckolib model but it should work either right?

 

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well idk what your doing,…
Tue, 12/03/2024 - 17:53

Well idk what your doing, your code above is wrong so if your using that then obviously its not gonna work. The code for my geckolib item is slightly different to the one i put a while ago.

It would be this for a generic item:

{
"loader": "neoforge:separate_transforms",
"gui_light": "front",
"base": {
"parent": "mod_id:displaysettings/model.item",
"textures": {
"layer0": "mod_id:item/model_texture"
}
},
"perspectives": {
"gui": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
},
"gui_light": "front"
},
"ground": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
}
},
"fixed": {
"parent": "item/generated",
"textures": {
"layer0": "mod_id:item/item_texture"
}
}
}
}
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also you may need to open…
Tue, 12/03/2024 - 17:56

Also you may need to open the model.java file and change or add some code. Mine looks like this:

package net.mcreator.mod_id.item.model;


import software.bernie.geckolib.model.GeoModel;

import net.minecraft.resources.ResourceLocation;

import net.mcreator.mod_id.item.custom_item;

public class custom_item_model extends GeoModel<custom_item> {
@Override
public ResourceLocation getAnimationResource(custom_item animatable) {
return ResourceLocation.parse("mod_id:animations/custom_item.animation.json");
}

@Override
public ResourceLocation getModelResource(custom_item animatable) {
return ResourceLocation.parse("mod_id:geo/custom_item.geo.json");
}

@Override
public ResourceLocation getTextureResource(custom_item animatable) {
return ResourceLocation.parse("mod_id:textures/item/custom_item_texture.png");
}
}
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I cant really remember how I…
Tue, 12/03/2024 - 17:57

I cant really remember how I made it work but it does work. If it still doesnt work after using the same code you can try crawling through the code and amending the textures for when in gui and inventory to be the specified version rather than always using the model texture by default.

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey fr6_17, your code works…
Thu, 12/05/2024 - 20:26

Hey fr6_17, your code works really well :) However, I replaced Neoforge because my mod is Forge. My next step is to make the texture of my item (when in the main hand) bright with Optifine. To do this I will open another forum because by searching with the AI ​​I understood that the "separate transforms" has some incompatibilities. Thanks for your help :)

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In reply to braserpl…
Thu, 12/05/2024 - 20:31

In reply to braserpl regarding the item animation that is seen for each item it is because Geckolib does not perform the animations on the individual item but on the ItemStack of that kind