Jump to content

[solved!][1.6.4] texture woes


thely

Recommended Posts

Edit: For a solution to this problem, look at TGG's post at the bottom of this thread.

 

I'm sure you all will figure out the problem in seconds, but I haven't been able to find a working solution yet. I'm just starting out and learning how to mod, and I'm working through the basic tutorials on the wiki. No matter what I do, I'm getting the "using missing texture: unable to load" error for my textures.

 

Folder hierarchy:

forge/mcp/src
assets
	generic
		textures
			blocks
				genericblock.png
				genericore.png
			items
				genericitem.png
				genericingot.png
tutorial
	generic
		Generic.java
		GenericBlock.java
		(etc)
	assets - figured I'd try it here for kicks
		generic
			textures
				(same as before)

 

Relevant lines in files. I'm leaving out a lot of lines for brevity, but I assure you that the full versions all compile. Most of this code is taken from the Icons and Textures tutorial, with some bits and pieces taken from other guides.

 

Generic.java:

@Mod(modid=Generic.modid, name="Generic", version="0.0.0")
public class Generic {
public static final String modid = "generic";
public static Item genericItem;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	genericItem = new GenericItem(500);
}
}

 

GenericItem.java:

public class GenericItem extends Item {
public GenericItem(int id) {
	super(id);
	setUnlocalizedName("genericitem");
	String s = Generic.modid + ":" + (this.getUnlocalizedName().substring(5));
	setTextureName(s);
}
}

 

I've tried the Wuppy way of going through the IconRegister, this way of using a ResourceLocation object, and setting setTextureName in the constructor (and in the main mod file) as I'm doing here. No dice! Help me, Obi Wan Kenobi, you're my only hope.

 

(Note: if in fact I solve this problem before anyone's able to reply, I'll post the problem/solution and hopefully anyone googling in the future will find it.)

Link to comment
Share on other sites

in your constructor put

setTextureName(generic:genericitem);

 

I already do. This line in the constructor evaluates to "generic:genericitem":

 

String s = Generic.modid + ":" + (this.getUnlocalizedName().substring(5));

 

I've done print statements to make sure.

Link to comment
Share on other sites

Didn't work, but I tried a couple other things and I'm at least getting errors now (if I wasn't before). I know this means that one of these ResourceManagers can't find my file, but I can't tell if that means I put the file in the wrong place, or if it means I shouldn't be dealing with ResourceManagers at all (google searches make it look like this is only used for custom GUIs?). Currently mucking through the classes listed in the first three "at file: line" statements, because I hate running ./recompile.bat over and over to see if something works. It's probably a total waste of time to rummage through all the code, but it's an enlightening total waste of time. Lines from GenericBlock that are causing these errors:

 

this.TEXTURE = new ResourceLocation(Generic.modid, "textures/blocks/genericblock.png");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

 

And the relevant bits of the stack trace:

[00:45:50] 2013-10-06 00:45:50 [WARNING] [Minecraft-Client] Failed to load texture: generic:textures/blocks/genericblock.png
[00:45:50] java.io.FileNotFoundException: generic:textures/blocks/genericblock.png
[00:45:50]      at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67)
[00:45:50]      at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:31)
[00:45:50]      at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:84)
[00:45:50]      at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:41)
[00:45:50]      at tutorial.generic.GenericBlock.<init>(GenericBlock.java:22)
[00:45:50]      at tutorial.generic.Generic.preInit(Generic.java:43)
[00:45:50]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:45:50]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[00:45:50]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[00:45:50]      at java.lang.reflect.Method.invoke(Method.java:601)
[00:45:50]      at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)
[00:45:50]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:45:50]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[00:45:50]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[00:45:50]      at java.lang.reflect.Method.invoke(Method.java:601)
[00:45:50]      at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
[00:45:50]      at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

Link to comment
Share on other sites

What dev environment are you using? If you're using the advanced environmnet (shown by Pahimar here:

), you will need to designate the directory above your assets folder as a source folder.

"Thinking that coding is the nerdy IT guy at work rebooting your computer is like thinking that music is what happens when the piano tuner comes round." - Ed Rex

Link to comment
Share on other sites

Try adding this method to your item class.

Still not working. Yours is the first compiling IconRegister example I've tried, though!

 

What dev environment are you using?

I'm doing everything from the command line (powershell, not cmd), and editing in Vim. The package hierarchy in the first post is how the folders are arranged under forge/mcp/src/minecraft.

Link to comment
Share on other sites

Huh. So I installed Eclipse just to see if it would catch things the compiler wasn't. It pointed me to a few packaging errors that I'd created because I decided to try the package structure mrkirby has. I hit run to start, Eclipse compiles everything, and lo and behold, there are my crappy textures!

 

"Well maybe that fixed it," says I, and for kicks, I try startclient.bat to see if the small changes stuck. The client loads, and not only are the block IDs different, making the world created in Eclipse unusable, the textures don't load either. So this means that either startclient.bat is missing something, Eclipse is running extra scripts in addition to startclient.bat that the internet hasn't told me about, or I'm missing some metadata in a folder that startclient.bat would be able to latch on to.

 

The block ID thing is a little worrisome also. It's the same code, so why does running it from another IDE alter the block IDs?

Link to comment
Share on other sites

Thank you so much! After doing a print statement, I saw that my basePath was pointing to mcp/bin/minecraft. That might be correct later, but it's certainly not now!

 

I'm a little confused on how I'm supposed to use this, though. Am I supposed to set my basePath? Doesn't that have bad implications later if I release the mod, since no one will have the same basePath as me?

 

Sorry for all the noob questions! I'm new to the modding business. :)

Link to comment
Share on other sites

Hi

 

The basepath is related to where your compiled code is located during debugging.  Forge determines it automatically.  For now, just put your textures into the appropriate folder under basePath. 

 

{base path}/assets/{mod name}/textures/items/{Icon name}.png

 

When you release your mod in zip format, the basePath will change to be the zip file and your texture folders should be found automatically in the zip file if you use the same structure.

 

You shouldn't change basePath, I predict that will break all sorts of other code, and it's not necessary.

 

Cheers

  TGG

Link to comment
Share on other sites

  • 4 months later...

The basepath is related to where your compiled code is located during debugging.  Forge determines it automatically.  For now, just put your textures into the appropriate folder under basePath. 

 

{base path}/assets/{mod name}/textures/items/{Icon name}.png

 

My textures are located in forge\mcp\src\minecraft\assets\{My Modname}\textures\items\

I am new to the modding scene, so I regrettably am a bit lost as to the solution, does basePath refer to my forge root folder, or is it a system path I have to set up or something to that effect?

 

Sorry for Necroing this post but this post is most relevant to my problem and has an answer, so I figure it's my best option for fixing my crappy first mod that does nothing ;D (hooray for humble beginnings!)

Link to comment
Share on other sites

My textures are located in forge\mcp\src\minecraft\assets\{My Modname}\textures\items\

I am new to the modding scene, so I regrettably am a bit lost as to the solution, does basePath refer to my forge root folder, or is it a system path I have to set up or something to that effect?

 

{basepath} there referrs to forge\mcp\src\minecraft\

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Hey.. I'm having the same issue and posted another thread before I saw this one.

 

http://www.minecraftforge.net/forum/index.php/topic,16932.0.html

 

I guess basePath is my issue too... but I can't work out how to output my current basePath so that I can put my textures there. Could you possibly point me in the right direction please?

 

Thanks

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.



×
×
  • Create New...

Important Information

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