Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author
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"
  }
}

 

  • Author
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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.