Jump to content

Creating new textures


bocaj1234567

Recommended Posts

The Forge way is one file for all the textures. One texture per file was the old modloader way, and it may be the correct way again in the future, but not now.

None of the tutorials seem to make it clear how to chose which part of the file is the texture for the block that you want to have that texture. Where do you chose the texture index for each block?

Link to comment
Share on other sites

They sort of do tell you, but I'll reiterate.

  1. On the client side, somewhere in your initialization logic, you need to call

    MinecraftForgeClient.preloadTexture("/your/texture/file.png");
    
    
  2. In you block file make sure that you have this override.


@Override

public String getTextureFile() {

    return "/your/texture/file.png";

}
Finally, when you instantiate your block (instantiate means to call the constructor), make sure to set the texture parameter to the index of the texture you want in your texture file, starting from 0.

If you want your block to have more complicated textures, instead of doing step 3, you will instead override the various getBlockTexture* methods to return the correct index in the file based on conditions like side and metadata.

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...