Jump to content

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


Recommended Posts

Posted (edited)

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
Posted
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"
  }
}

 

Posted
16 minutes ago, diesieben07 said:

Is your event handler called?

Is your color handler called?

The event handler is not being called... Which bus is it meant to be subscribed to? I think I tried all combinations for value and bus, but I might've missed one. 

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.