Jump to content

Change block texture on right click with another block


DylanGore

Recommended Posts

I was hoping that someone might be able to help me, I would like to change the texture of my block on right-click, to the texture of the block that the player right-clicked with, and I have no idea how to do it. Any help is greatly appreciated!

 

PS. I do not want to change the block itself, just the texture!

Dylan Gore

Link to comment
Share on other sites

This should work in theory but you do do something like this. Then you could do the void setTexure() from another class.

 

public class ChangingBlock extends Block {

private string Texture = "mod:default";

public void setTexture(string str1) {
   Texture = str1;
}

public ChangingBlock(int id, Material material) {
	super(id, material);		
	setTextureName(Texture);
}
} 

Link to comment
Share on other sites

I don't think that is going to work, as the texture name is only being used at the initialization of the mod, when the IconRegister goes over all the registered blocks. Changing this String on the way doesn't have any effect.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

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.