Posted January 7, 20214 yr 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 January 7, 20214 yr by DavidQF555
January 7, 20214 yr 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" } }
January 7, 20214 yr ColorHandlerEvent fires on the Mod bus, not the Forge bus. Also: "layer0": "modid:items/colored_weapon" is your mod id really.."modid"?? You may want to change that Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
January 7, 20214 yr 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.
January 7, 20214 yr 39 minutes ago, Beethoven92 said: ColorHandlerEvent fires on the Mod bus, not the Forge bus. Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
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.