Jump to content

[1.7.10] [Solved] Textures not working.


Recommended Posts

Posted

I made some blocks, most of which will be used to generate a structure. I added them to the lang file, added textures for them, and added them to my Creative Tab. I then ran it to build the structure (I like laying out generated structures before adding the code) and opened up the Creative Tab. No textures:

 

8UOdQOv.png

 

The blocks not working are BlockThatch, BlockSmoothSandstone, BlockTurnedPlanksBirch, BlockTurnedPlanksOak, and BlockGranite.

 

But I clearly have the files in there:

 

UhghB6m.png

 

Here is the code:

 

  Reveal hidden contents

 

Posted

well, that allowed the localizations to work. The textures still aren't working.

Posted

actually i don't think the problem is the ulocalised name its actually this:

UhghB6m.png

 

you have the images in

assets/sa/blocks

where as java/minecraft is looking for them at

assets/sa/textures/blocks

 

well actually there is a small thing with the unlocalised name your missing .substring(5)

 

PS. i noramally add

public static final String DIR = "sa";

just below the

final String MODID

and change it to

this.setBlockTextureName(SignificantAdvancements.DIR + ":" + this.getUnlocalizedName().substring(5));

that way my file structure is independant of my ModID

Posted

If you go to your src folder, wherever it may be, you should be able to click main, resources, assets, YOURMODID, textures, blocks. I feel like you might of named "assets" "assets.sa". xD

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

diesieben07 is right, you should register them like:

 

setBlockTexture(ModResources.MODID + ":" + "TextureName");

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

Make a Blocks texture Folder and a lang file like this. your directory in you Mod folder should say this. yourmod>bin>assets>yourmod\textures\blocks put your png photo in this folder. remember it has to be a png. also you must have a .setBlockTextureName("Set the block name here") and use that name for the block texture in your folder. so if you have a texture in your block textures folder it has to be the exact same word as your set texture name. the language folder is only for your names for stuff.

Im serious don't look at it!!

Posted

Ya, thanks for reminding me. I forgot that getUnlocalizedName returned "tile.someblock.name" instead of "someblock" I guess. And I also didn't do my directory right apparently. :D I'll fix it and test it tomorrow. For now this is solved. Thanks for all the help guys. :)

Posted

If you want to use "getUnlocalizedName" do this:

 

this.setBlockName(MODID + ":" + this.getUnlocalizedName().substring(5));

 

This removes the first five characters of the unlocalized name so you get "someblock". Java won't read past characters like "." and ":" unless you use splitString() I believe.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

Oh, that's a cool feature. I guess my intentions with using getUnlocalizedName were to avoid hard coding stuff as much as I could. I don't know why.

Posted
  On 4/2/2015 at 4:09 AM, HappyKiller1O1 said:
Java won't read past characters like "." and ":" unless you use splitString() I believe.

 

wut? False, you can store ANY valid character in a string. After all, a String is just an array of characters with some helper methods.

You can't use ":" in a resource string twice, since it tells the ResourceLocation the String before the : is the resource domain and the the part after is the path. But this is specific to the way ResourceLocations work.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 4/2/2015 at 12:54 PM, diesieben07 said:

  Quote

If you want to use "getUnlocalizedName" do this:

 

[snip]

Please no.

 

What? What's wrong with getSubString(5)?

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.