Jump to content

[1.7.10][Solved] Cannot load a .obj model: java.io.FileNotFoundException


Recommended Posts

Posted

I have been trying to load a WavefrontObject model (.obj) but despite my efforts I inevitably get a java.io.FileNotFoundException. I have tried to load the model with net.minecraftforge.client.model.AdvancedModelLoader and with CodeChicken's CCModel in CodeChickenCore, both throw the java.io.FileNotFoundException. I have tried putting redundant copies of the .obj in all levels of my assets folder; without success. I have absolutely no how to get this to work without copying the vertices directly into my code and using OpenGL to manually render them.

 

Here is the crash log from using the AdvancedModelLoader:

 

 

  Reveal hidden contents

 

 

Here is the rendering class:

public class RenderRuneStone extends Render {

private CCModel runeStoneModelCC;

private IModelCustom runeStoneModelFML;

public RenderRuneStone() {

	super();

	ResourceLocation location = new ResourceLocation("RunicMagic:models/runeStone.obj");

	//throws a java.io.FileNotFoundException
	runeStoneModelFML = AdvancedModelLoader.loadModel(location);

	//throws a java.io.FileNotFoundException
	Map<String, CCModel> models = CCModel.parseObjModels(location);

	runeStoneModelCC = models.get("RuneStone");

}

@Override
public void doRender(Entity entity, double x, double y, double z, float u, float v) {

	GL11.glPushMatrix(); {

		CCRenderState.changeTexture(new ResourceLocation("RunicMagic:models/runeStoneTexture.png"));

		runeStoneModelCC.render(x, y, z, u, v);

	} GL11.glPopMatrix();

}

@Override
protected ResourceLocation getEntityTexture(Entity entity) {

	return new ResourceLocation("RunicMagic:models/runeStoneTexture.png");

}

}

Posted

Actually the modid does not really have to be all lowercase, it works fine for loading my normal textures, and in the log it does not give back the string that I sent it, but a version where the modid is all lowercase. ;)

 

I am afraid that is not the problem... I still get the same java.io.FileNotFoundException with the modid all lowercase.

Posted

To make sure the SimpleReloadableResourceManager does not only have problems with .obj files, I tried to load one of my item icons, but it throws a java.io.FileNotFoundException...

Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("runicmagic:textures/items/blankRuneStone.png"))
//or
Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("runicmagic:textures/items/blankRuneStone"))

 

Yet the icon loads fine when I use:

runeStone = new RuneStone().setTextureName("runicmagic:blankRuneStone");

Posted

Ah-Ha! I think the constructor, which was called in my main mod class to initialize an ivar, was far too early to load any resource.

Moving the constructor call to the mod init method seems to fix the crash... but I cannot get one of the entities to render as of yet.

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.