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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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