Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.