Jump to content

Recommended Posts

Posted

I have been working at this for hours now; following countless different tutorials but to no avail.
I am creating a new item like so:

public class Item_NewIngot extends Item
{
	public Item_NewIngot()
	{
		setUnlocalizedName("newingot");
		setRegistryName("newingot");
		
		setCreativeTab(Wire.tab);
	}
	public void registerModel()
	{
		ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation("wire:newingot", "inventory"));
	}
}

I register it in

public static void registerItems(RegistryEvent.Register<Item> event)

I call registerModel in

public static void registerItems(ModelRegistryEvent event) 

But this never actually works, I get an output like this when forge loads:

Quote

Caused by: java.io.FileNotFoundException: wire:models/item/newingot.json

So for some reason it doesn't find the json file.

I know it exists and I have it under that directory - attached an image

Here is the contents of that file:

{
	"parent": "item/generated",
	"textures": 
	{
		"layer0": "wire:items/newingot"
	}
}

And I also have the icon here - attached another image

Why isn't this working?

dir.png

dir2.png

Posted

Your modding workspace is set up in your roaming AppData folder? So that's where your project file is? It seems like you're putting your JSON in your regular minecraft location not your project asset location...

 

Can you show screenshot of Eclipse's package explorer tree showing the resource package location?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
Just now, jabelar said:

Your modding workspace is set up in your roaming AppData folder? So that's where your project file is? It seems like you're putting your JSON in your regular minecraft location not your project asset location...

 

Can you show screenshot of Eclipse's package explorer tree showing the resource package location?

Oh I know how weird it looks, I created a modding folder in the .minecraft folder just so I didn't have to have everything dumped on the desktop.

Here is a screenshot of all the directories and stuff

dir3.png

Posted

Quote from StackOverflow. " There are three cases where a FileNotFoundException may be thrown. The named file does not exist. The named file is actually a directory. The named file cannot be opened for reading for some reason. The first two cases are unlikely based on your description. I would test against the third case using file.canRead() . "

 

Posted

Also try running

attrib -R -H /D /S C:\Users\Reece\AppData\Roaming\.minecraft

This will remove both the hidden and read-only attributes from .minecraft and all of its subfolders and files.

Posted (edited)
11 minutes ago, hiotewdew said:

Quote from StackOverflow. " There are three cases where a FileNotFoundException may be thrown. The named file does not exist. The named file is actually a directory. The named file cannot be opened for reading for some reason. The first two cases are unlikely based on your description. I would test against the third case using file.canRead() . "

 

I was going to mention a similar thing -- I think AppData folder might have permissions issues in some cases.

 

The first two cases are still possible -- the smallest typo can cause a file to not be found. For example, I'm assuming your mod id is actually "wire" all lower cases and stuff. I usually try to avoid typos by only entering the text once -- for example, in your model registration instead of "wire:newingot.json" I would usually code it as ingotInstance.getRegistryName(). In my example of course you would replace  ingotInstance with the injected instance from your item registration.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Ok so if I do a full build through the commands line then launch the game it works!

Then if I do the same thing through the IDE then it doesn't...

 

I assume it must be to do with the permissions now then

 

2 minutes ago, hiotewdew said:

Also try running


attrib -R -H /D /S C:\Users\Reece\AppData\Roaming\.minecraft

This will remove both the hidden and read-only attributes from .minecraft and all of its subfolders and files.

I ran this but nothing changed unfortunately.

Posted

I would make a new project in a little better of a folder. Hidden appdata folders are not a good place to have configuration heavy IDE projects.

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.