Jump to content

[Solved][1.16.1] Changing the color of all instances of an item


DavidQF555

Recommended Posts

I'm trying to make an item that has different colors that I specified in the itemstack's tags. However, items don't seem to use a renderer. Instead, everywhere that renders an item traces to ItemRenderer.renderItem(), but I can't figure out a way that I can make a specific item be rendered with a different color. Does anyone know how I could do this?

Edited by DavidQF555
Link to comment
Share on other sites

1 hour ago, diesieben07 said:

You need an implementation of IItemColor that returns the color you want based on the ItemStack. Register it using ColorHandlerEvent.Item.

Then in your item model you need to specify the layer0 texture, it will be colored in (check the leather_boots model for an example of a model that has a colored and a non-colored layer).

I made the color and I registered it using the forge bus by 

@SubscribeEvent
    public static void onHandleColors(ColorHandlerEvent.Item event){
        event.getItemColors().register(new CustomItemColor(), RegistryHandler.COLORED_WEAPON::get);
    }

I'm not really sure what to do with the model though because I only have 1 layer with my item but it still does not get colored. This is the model: 

{
  "parent": "item/handheld",
  "textures": {
    "layer0": "modid:items/colored_weapon"
  }
}

 

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.

Announcements



×
×
  • Create New...

Important Information

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