Jump to content

getColorFromItemStack not working in ItemBlock


penguinsfan77

Recommended Posts

I am trying to make colored planks for my mod. I have the planks colored right when placed on the ground but when they are in the inventory they are all white.

Here is the ColoredPlanksItemBlock class:

public class ColoredPlanksItemBlock extends ItemBlock {

private Block block;

public ColoredPlanksItemBlock(Block block) {

	super(block);
	this.block = block;
	this.setUnlocalizedName(Names.Blocks.COLORED_PLANKS);
	this.setHasSubtypes(true);

}

@Override
public int getMetadata(int meta) {

	return meta;

}

@Override
public String getUnlocalizedName(ItemStack itemStack) {
    	
         	return String.format("item.%s%s.%s", Textures.PREFIX, Names.Blocks.COLORED_PLANKS, Names.Colors.COLOR[itemStack.getItemDamage()]);
   
    	}

@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int pass) {

	return Integer.parseInt(Colors.fromNumber[itemStack.getItemDamage()], 16);

}

}

I know that the getColorFromItemStack method is being called (I added a check for it) however the item is not getting colored.

I am very confused as to why this is not working as vanilla does it the same way with leaves.

 

Any help is greatly appreciated. Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

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.