Jump to content

Recommended Posts

Posted

I cannot seem to get an item texture/model working.

Here are my classes/paths.

 

Item image path:

src/main/resources/assets/cfd/textures/items/testitem.png

Item model path:

src/main/resources/assets/cfd/models/item/testitem.json

 

Registry:

@Mod.EventBusSubscriber(modid = "cfd")
public class Registery {
	
	private static TestItem testItem = new TestItem();
	
	@SubscribeEvent
	public static void registerItems(RegistryEvent.Register<Item> event) {
		System.out.println("Registering Items!");
		event.getRegistry().register(testItem);
		System.out.println("Registered testItem!");
	}
	
	@SubscribeEvent
	public static void registerItemModels(ModelRegistryEvent event) {
		ModelLoader.setCustomModelResourceLocation(testItem, 1, new ModelResourceLocation("cfd:testitem#layer0", "inventory"));
	}
}

(I have changed the ModelResourceLocation a lot, idk what its supposed to be)

testitem.json:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "cfd:items/testitem"
    }
}

 

I don't know why the model texture won't work.

Posted (edited)
28 minutes ago, Big_Bad_E said:

"cfd:testitem#layer0"

Why is #layer0 here?

This is causing the game to look for a file named testitem#layer0.json which presumably doesn't exist.

Edited by Draco18s

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.

Posted

You can easily get around all this by just naming your models <item_name>.json and registering the models with 

 

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

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
On 5/27/2018 at 10:01 AM, Draco18s said:

Why is #layer0 here?

This is causing the game to look for a file named testitem#layer0.json which presumably doesn't exist.

I was trying to explain I was just trying everything, hoping it would look it layer0, but I tried it without that, with and without the modid, etc...

 

On 5/27/2018 at 11:36 AM, Cadiboo said:

You can easily get around all this by just naming your models <item_name>.json and registering the models with 

 

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

You were right! The problem was I had a 1 instead of a 0 as the second variable of setCustomModelResourceLocation().

Posted
11 minutes ago, Big_Bad_E said:

I was trying to explain I was just trying everything, hoping it would look it layer0, but I tried it without that, with and without the modid, etc...

"layer0" is the name of the texture reference used by the 3D model. It's not magic.

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.

Posted
5 hours ago, Big_Bad_E said:

I was trying to explain I was just trying everything, hoping it would look it layer0, but I tried it without that, with and without the modid, etc...

 

You were right! The problem was I had a 1 instead of a 0 as the second variable of setCustomModelResourceLocation().

That number is the metadata for the item

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.