Jump to content

What am I supposed to name my texture files?


an_awsome_person

Recommended Posts

Normal item jsons should look like this.

"parent": "item/generated",

"textures": {
     "layer0": "modid:textureName"
},

#if you said "inventory" when registering your model with
#ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory") otherwise use "normal"
"inventory":{
     #dont need anything in here
}

So you're asking me to copy this into my jsons?

No this is how they should be structured normally.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

This is just an addition to what Draco said above

Any item with "inventory" model works fine out of the box if you are using the vanilla MC models as parent.

 

For ex this will work fine

 

{

    "parent": "item/generated",

    "textures": {

        "layer0": "technorcery:items/fennel"

    }

}

 

This is because the inventory is already set up in that item/generated.json model

 

In fact if you set a parent to a block that has parent a mc vanilla block it will also work when displaying block in inventory.

 

You need to define inventory, offhand, 3rd person etc only if you use a custom json that does not extend anything form vanilla mc as parent. Have a look at say item/generated model or block/cube_all to understand how to set up a json file from scratch to be displayed properly in the game/inventory/world.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

the way you're supposed to name your files is based on how you set up the model

 

generally i do it like this

 

ingot copper looks like this

 

definition:

public static final Item INGOT_COPPER = new Item().setUnlocalizedName("ingot_copper").setRegistryName("ingot_copper").setCreativeTab(ModData.CREATIVE_TAB); // ingots

 

 

model

ModelLoader.setCustomModelResourceLocation(INGOT_COPPER, 0, new ModelResourceLocation(INGOT_COPPER.getRegistryName(), "inventory"));

 

ModItems.INGOT_COPPER.getRegistryName() actually returns technorcery:ingot_copper (it adds modid automatically)

This tells forge to look in my local folder under src/main/resources/assets/  in a folder called technorcery then grab the item model which would be under it's proper folder the src/main/resources/assets/technorcery/models/item and the name of the json would be same as registry name in this case ingot_copper and add .json to it to get the file

 

so the model json is in

/src/main/resources/assets/technorcery/models/item/ingot_copper.json

/src/main/resources/assets/technorcery/textures/items/ingot_copper.png <this one is referenced from json file

 

 

notice how all my underlined bits and pieces match up. this makes my life easy. I understand not everyone wants this. ALSO notice how my registry name and unlocalized name is the same apparently this is NOT something everyone here supports so don't do that if you don't want to. I do it to make things easier for myself. 

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

While the advice trollworkout is mostly correct, I would make one small change:

 

Rather than

item.setUnlocalizedName("ingot_copper").setRegistryName("ingot_copper")

I would do:

 

item.setRegistryName("ingot_copper");
item.setUnlocalizedName(getRegistryName();

 

This puts your modID in your unlocalized name string, which avoids conflicts, should another mod use the same unlocalized name (which for an item like "ingot_copper" is non-zero).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

While the advice trollworkout is mostly correct, I would make one small change:

 

Rather than

item.setUnlocalizedName("ingot_copper").setRegistryName("ingot_copper")

I would do:

 

item.setRegistryName("ingot_copper");
item.setUnlocalizedName(getRegistryName();

 

This puts your modID in your unlocalized name string, which avoids conflicts, should another mod use the same unlocalized name (which for an item like "ingot_copper" is non-zero).

 

Thank you that is a good point.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

  • 2 weeks later...

the way you're supposed to name your files is based on how you set up the model

 

generally i do it like this

 

ingot copper looks like this

 

definition:

public static final Item INGOT_COPPER = new Item().setUnlocalizedName("ingot_copper").setRegistryName("ingot_copper").setCreativeTab(ModData.CREATIVE_TAB); // ingots

 

 

model

ModelLoader.setCustomModelResourceLocation(INGOT_COPPER, 0, new ModelResourceLocation(INGOT_COPPER.getRegistryName(), "inventory"));

 

Can you show my your entire class? I'm having a hard time following this.

If people call you garbage, don't let them stop you from doing great things. It's called a garbage can, not a garbage can't.

Link to comment
Share on other sites

  • 2 weeks later...

response to your PM (your inbox is full)

 

Yeah sure. All my code is online knock yourself out https://github.com/trollworkout/technorcery

 

Also that specific piece of code is found in common

https://github.com/trollworkout/technorcery/tree/master/src/main/java/com/technorcery/common

 

mod blocks = defining and registering blocks (is always done first before items)

mod items  = defining and registering items

 

also if you wish to chat find me on my technorcery discord page . just google technorcery mod minecraft and find my discord

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

This is just an addition to what Draco said above

Any item with "inventory" model works fine out of the box if you are using the vanilla MC models as parent.

 

For ex this will work fine

 

{

    "parent": "item/generated",

    "textures": {

        "layer0": "technorcery:items/fennel"

    }

}

 

I tried this, and it didn't work. (I replaced technorcery:items/fennel with renewabilitymod:items/chain_mail, of course)

If people call you garbage, don't let them stop you from doing great things. It's called a garbage can, not a garbage can't.

Link to comment
Share on other sites

response to your PM (your inbox is full)

 

Yeah sure. All my code is online knock yourself out https://github.com/trollworkout/technorcery

 

Also that specific piece of code is found in common

https://github.com/trollworkout/technorcery/tree/master/src/main/java/com/technorcery/common

 

mod blocks = defining and registering blocks (is always done first before items)

mod items  = defining and registering items

 

also if you wish to chat find me on my technorcery discord page . just google technorcery mod minecraft and find my discord

Can you give the specific files in which I can find each of these lines of code? I'm not good at searching stuff on Github.

If people call you garbage, don't let them stop you from doing great things. It's called a garbage can, not a garbage can't.

Link to comment
Share on other sites

  • 1 month later...

This is what I changed since the last post. The game doesn't run any different. (textures of added items don't show up)

java\com\renewability\renewabilitymod\RenewabilityMod.java

Spoiler

package com.renewability.renewabilitymod;

import client.ItemsModelsHandler;
import items.ItemChainMail;
import main.ModItems;
import main.ModRecipes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = RenewabilityMod.MODID, version = RenewabilityMod.VERSION)
public class RenewabilityMod
{
    public static final String MODID = "renewabilitymod";
    public static final String VERSION = "1.10";
    
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        ModItems.items();
        ModRecipes.recipes();
        
        if(event.getSide() == Side.CLIENT){
            RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
            renderItem.getItemModelMesher().register(ModItems.chain_mail, 0, 
            new ModelResourceLocation(RenewabilityMod.MODID + ":" + ((ItemChainMail) 
            ModItems.chain_mail).getName(), "inventory"));
            
            ItemsModelsHandler.preInit();
        }
    }
}

java\main\ModItems.java

Spoiler

package main;

import items.ItemChainMail;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {
    
    public static final Item chain_mail = new ItemChainMail();
       
    @EventHandler
    public static void items(){
        GameRegistry.register(chain_mail.setRegistryName("chain_mail"));
        ModelResourceLocation chainMailLocation = new ModelResourceLocation
        (chain_mail.getRegistryName(), "inventory");
        ModelLoader.setCustomModelResourceLocation(chain_mail, 0, chainMailLocation);
    }
}

java\client\ItemsModelsHandler.java

Spoiler

package client;

import main.ModItems;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ItemsModelsHandler {
    
    public static void  preInit(){
        loadModel(ModItems.chain_mail);
    }
    
    private static void loadModel(Item item) {
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation
        (item.getRegistryName(), "inventory"));
    }
}

I didn't change any of the below files. They're copied here for reference.

java\items\ItemChainMail.java

Spoiler

package items;

import com.renewability.renewabilitymod.RenewabilityMod;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;

public class ItemChainMail extends Item{
    
    private final String name = "chain_mail";
    
    
    public ItemChainMail(){
        //GameRegistry.registerItem(this, "chain_mail");
        setUnlocalizedName(RenewabilityMod.MODID + "_" + name);
        setCreativeTab(CreativeTabs.MATERIALS);
        
    }
    
    public String getName(){
        return(name);
    }
}

resources\assets\renewabilitymod\models\item\chain_mail.json

Spoiler

{
   "parent": "item/generated",
   "textures": {
      "layer0": "renewabilitymod:items/chain_mail"
   }
}

What am I doing wrong?

If people call you garbage, don't let them stop you from doing great things. It's called a garbage can, not a garbage can't.

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.