Jump to content

[SOLVED][1.7.10] .setBlockTextureName method cannot be defined


Recommended Posts

As I follow tutorials on how to set mods up, there is this generic method people use to texture blocks. I'm sure all of you modders out there have heard of it, it is the .setBlockTextureName method that is supposed to be defined by the net.minecraft.block.Block package.


My problem is this:

Upon importing the net.minecraft.block.Block package everything seems to run smoothly until I want to texture the block.

If I do type in .setBlockTextureName method I get an error.

If I look for something to resolve this error via the left click is says "The method setBlockTextureName(String) from the type Block is not visible"

I have tried many things to fix this error, but to no avail. I call to you, fellow modders, for I require a solution to this error as it is very stressing to see.




Link to comment
Share on other sites

import com.xenopack.lib.RefStrings;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import cpw.mods.fml.common.registry.GameRegistry;

public class TestingBlock {

public static void mainRegistry(){

public static Block tBlock;

public static void initializeBlock(){
	tBlock = new tBlock(Material.ground).setBlockName("tBlock").setCreativeTab(CreativeTabs.tabBlock);


public static void registerBlock(){
	GameRegistry.registerBlock(tBlock, tBlock.getUnlocalizedName());



This is the direct code that I am using from the package.


Link to comment
Share on other sites

And where is your 'tBlock' class? Is that even a class? Each word in a class name should begin with an uppercase letter, so 'TBlock' is a proper class name, but 'tBlock' is not. This is important for readability and to avoid ambiguity: does 'tBlock' refer to the class or the Block instance you created earlier (that's rhetorical)?

Link to comment
Share on other sites

The tBlock class just extends the Block class, and has an empty constructor, but this has nothing to do with the texturing of the "Testing block".

Well it has everything to do with it if you claim it has an empty constructor, but look at your own code:

tBlock = new tBlock(Material.ground) // <-- that is NOT empty!

I can tell you with 100% certainty that 'someBlock = new Block(Material.ground).setBlockTextureName("whatever")' works just fine. It is a public method, so whatever you are doing elsewhere in your code, it is wrong.

Link to comment
Share on other sites

This is off topic but,


The registerBlockIcons method gives you the IIconRegister for minecraft, you can call "registerIcon", the string is your modid+texture name (same as basic one). This method returns an IIcon, which is stored on a Client side only Variable like so:

public static IIcon yourIcon;

The registerBlockIcons would look something like this:

public void registerBlockIcons(IIconRegister register){
yourIcon = register.registerIcon("modid:texturename");

In the getIcon method, it's fairly self explanatory, it's args are the side (0-bottom,1-top etc) and the block's metadata.

If you just want to make the block entirely one texture, just return that IIcon:

public IIcon getIcon(int side, int metadata){
return yourIcon;

The proud(ish) developer of Ancients

Link to comment
Share on other sites

There is nothing else in my code that has anything to do with the Block class.

Can you at least post your block class, then? You are clearly doing something wrong, which you can prove to yourself by trying this simple test:

// in your main mod class, add these lines of code:
public static Block test;

public void preInit(FMLPreInitializationEvent event) {
// I would have used Block(Material), but it is protected
test = new BlockObsidian().setBlockName("test").setBlockTextureName("stone").setCreativeTab(CreativeTabs.tabBlock);
GameRegistry.registerBlock(test, test.getUnlocalizedName());

You will now have a 'tile.test.name' block in your creative tab that is textured like vanilla smooth stone. Ergo, the problem is somewhere specifically in your code and has nothing to do with lack of access to setBlockTextureName.

Link to comment
Share on other sites

I can't imagine that they changed the method from public to protected, but perhaps they did. Try using the recommended build 1230 (it's what I used for my test example). If that works, then the problem is Forge changed the method visibility, and you'll have to put it inside your block class.

public class YourBlock extends Block {
public YourBlock() {


If it still doesn't work using the recommended build, then the problem is somehow with your workspace, in which case you should re-run 'gradlew --refresh-dependencies setupDecompWorkspace'.

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.

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.