Jump to content

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


UFIOES

Recommended Posts

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:

 

 

 

---- Minecraft Crash Report ----

// Daisy, daisy...

 

Time: 7/27/14 11:30 AM

Description: Initializing game

 

java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:270)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:420)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:492)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:204)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)

at net.minecraft.client.Minecraft.run(Minecraft.java:941)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at GradleStart.bounce(GradleStart.java:108)

at GradleStart.startClient(GradleStart.java:101)

at GradleStart.main(GradleStart.java:56)

Caused by: net.minecraftforge.client.model.ModelFormatException: IO Exception reading model format

at net.minecraftforge.client.model.obj.WavefrontObject.<init>(WavefrontObject.java:60)

at net.minecraftforge.client.model.obj.ObjModelLoader.loadInstance(ObjModelLoader.java:27)

at net.minecraftforge.client.model.AdvancedModelLoader.loadModel(AdvancedModelLoader.java:65)

at com.UFIOES.runicMagic.rendering.RenderRuneStone.<init>(RenderRuneStone.java:36)

at com.UFIOES.runicMagic.RunicMagic.<clinit>(RunicMagic.java:46)

... 42 more

Caused by: java.io.FileNotFoundException: runicmagic:models/runeStone.obj

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:71)

at net.minecraftforge.client.model.obj.WavefrontObject.<init>(WavefrontObject.java:55)

... 46 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:270)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:420)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:492)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:204)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:941)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at GradleStart.bounce(GradleStart.java:108)

at GradleStart.startClient(GradleStart.java:101)

at GradleStart.main(GradleStart.java:56)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Mac OS X (x86_64) version 10.9.4

Java Version: 1.7.0_45, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 689328120 bytes (657 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.25.1188 Minecraft Forge 10.13.0.1188 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{7.10.25.1188} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1188.jar) Unloaded->Constructed

Forge{10.13.0.1188} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1188.jar) Unloaded->Constructed

runicmagic{0.1} [Runic Magic] (bin) Unloaded

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: NVIDIA GeForce GTX 660 Ti OpenGL Engine GL version 2.1 NVIDIA-8.26.26 310.40.45f01, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because ARB_framebuffer_object is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

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");

}

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");

Link to comment
Share on other sites

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.

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.