Jump to content

[1.7.10] Problems loading .obj file from custom resource location


Recommended Posts

Posted

Hey all.

 

I'm working on a mod which supports asset packs; third party content users can add without any editing to the code.

 

I've got the basic asset system working now - The mod will detect .txt files to create an item, and it can find static textures to use with that item and load them into the game. My issue comes when I try to use a custom model.

 

Here's the code I use to add my resource packs to the game:

@Override
public void reflectResourcePackMethods() {
	AdvancedArmoury.println("Reflecting in and loading resources");
	List<IResourcePack> assetPacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao");
	List<File> assets = getAssetPackList();

	for (File file : AdvancedArmoury.assetDir.listFiles()) {
		try {
			if (AdvancedArmoury.isZipFile(file)) {
				assetPacks.add(new FileResourcePack(file));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

 

- This works just fine for a normal texture like most items have. My only issue is with loading an .obj model, which throws this stack on loading the game:

 

[19/10/2015 11:56:52 AM] [Client thread/ERROR] [FML]: Caught exception from advancedarmoury
[19/10/2015 11:56:52 AM] net.minecraftforge.client.model.ModelFormatException: IO Exception reading model format
[19/10/2015 11:56:52 AM] 	at net.minecraftforge.client.model.obj.WavefrontObject.<init>(WavefrontObject.java:60) ~[WavefrontObject.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraftforge.client.model.obj.ObjModelLoader.loadInstance(ObjModelLoader.java:27) ~[ObjModelLoader.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraftforge.client.model.AdvancedModelLoader.loadModel(AdvancedModelLoader.java:65) ~[AdvancedModelLoader.class:?]
[19/10/2015 11:56:52 AM] 	at co.uk.silvania.advancedarmoury.client.PartRenderBase.<init>(PartRenderBase.java:23) ~[PartRenderBase.class:?]
[19/10/2015 11:56:52 AM] 	at co.uk.silvania.advancedarmoury.client.ClientProxy.registerRenderers(ClientProxy.java:27) ~[ClientProxy.class:?]
[19/10/2015 11:56:52 AM] 	at co.uk.silvania.advancedarmoury.AdvancedArmoury.postInit(AdvancedArmoury.java:108) ~[AdvancedArmoury.class:?]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[forge-1.7.10-10.13.3.1403-1.7.10-universal.jar:?]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[forge-1.7.10-10.13.3.1403-1.7.10-universal.jar:?]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[forge-1.7.10-10.13.3.1403-1.7.10-universal.jar:?]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.common.Loader.initializeMods(Loader.java:717) [Loader.class:?]
[19/10/2015 11:56:52 AM] 	at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:309) [FMLClientHandler.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:552) [bao.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878) [bao.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
[19/10/2015 11:56:52 AM] 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
[19/10/2015 11:56:52 AM] 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
[19/10/2015 11:56:52 AM] Caused by: java.io.FileNotFoundException: advancedarmoury:models/m4a1.obj
[19/10/2015 11:56:52 AM] 	at net.minecraft.client.resources.FallbackResourceManager.func_110536_a(SourceFile:51) ~[bqq.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:67) ~[brg.class:?]
[19/10/2015 11:56:52 AM] 	at net.minecraftforge.client.model.obj.WavefrontObject.<init>(WavefrontObject.java:55) ~[WavefrontObject.class:?]
[19/10/2015 11:56:52 AM] 	... 42 more

 

If I place the model in the normal resource location for the mod (IE, within the .jar) it works fine - so I know the actual rendering isn't an issue. Also, the asset file structure between .jar and asset pack is the same, and normal textures load in either of them, so I know it's not a typo in my path. Rendering happens after my asset packs are registered (in the post init- whereas asset packs are registered in init)

 

Asset pack's path, just for my own sanity so I know it's not a typo:

5624cfad049ac.png

 

I can't think of any reason this may be happening. One thing that may be worth noting is that when the game fully loads, I get this notice in the log:

 

[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: The following texture errors were found.
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:   DOMAIN advancedarmoury
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: --------------------------------------------------
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:   domain advancedarmoury is missing 2 textures
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:     domain advancedarmoury has 2 locations:
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:       mod advancedarmoury resources at C:\Users\**MINECRAFTUSERNAME**\Desktop\ATL\Instances\VanillaMinecraft\mods\modid-1.0.jar
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:       resource pack at path C:\Users\**MINECRAFTUSERNAME**\Desktop\ATL\Instances\VanillaMinecraft\Advanced Armoury\Custom Pack.zip
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:     The missing resources for domain advancedarmoury are:
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/items/scarHReceiver.png
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/items/m4Receiver.png
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]:     No other errors exist for domain advancedarmoury
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================
[19/10/2015 12:08:26 PM] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

 

despite the fact that the assets do in fact load and show up in game. Could that hold any clues? My only thought here is maybe as I'm using FileResourcePack instead of my own custom implementation of IResourcePack to add in assets; would that somehow cause it to ignore .obj files?

 

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

  • 2 weeks later...

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The game crashed whilst unexpected error Error: net.minecraftforge.fml.ModLoadingException: Advanced Mining Dimension (mining_dimension) encountered an error during the done event phase
    • Here is the end of the log. it was way too big to put in pastebin, but I started from when I was online and everything was fine. Error should be in here: https://pastebin.com/Sdhdq593
    • Update: I stand corrected as I was able to dig up a relevant log from my earlier testing which highlights the overall issue but does not explain how to solve it. See, Diagnostic Logs for pack.mcmeta not found: https://pastebin.com/LXS8Rtna
    • Which mod was this? What are all the mods that were in use? It will help if enough information to replicate the problem is available.
    • I have been attempting to create a supplementary resource pack with Patchouli in order to add back the guidebook for Better End but unfortunately in every prototype I have made pack.mcmeta and my resource pack are not recognized. I have tested both zipped and unzipped and either way curseforge does not recognize my resource pack as existing. For testing I stripped my pack down to just the pack.mcmeta file and two empty folders labelled data and assets and I know the data folder is not the problem as firstly my first attempts just had an assets folder following Patchouli instructions and data came later in my flailing attempts to make anything in my pack work. The mcmeta file is not recognized whether or not I use this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } "language": { "en_US": { "name": "English", "region": "United States" } } } ,or this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } } I have made sure to only use lowercase and the pack folder is named better-end-guide. Is this some magic nonsense from me doing this manually instead of using an IDE or similar tool? Could it be because my files are by default in UTF-8 even though ANSI gives the same results? Is there a specific community secret tool I am supposed to use for zipping or specific settings? I am pulling my hair in distress. Unfortunately as there are no errors involved I lack logs to offer, if that disqualifies this thread please do not be harsh and instead if you can then please direct me to a forum with different rules and sufficiently respectful but knowledgeable as to be of assistance. Most of my experience with the programming community has been poor and so naturally I find myself wary.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.