I just tried always returning 255 and registering the vanilla leather armor and it doesn't work for the actual model. Does this mean I have to do my own leather armor like I thought?
@Override public int getColorFromItemstack(ItemStack stack, int tintIndex) { return 255; }
Armour models don't use IItemColor, they use ItemArmor#getColor. You can use ItemArmor#setColor to set the colour of a Leather Armour ItemStack.
What exactly are you trying to do?
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Completely override it since mc 1.2.5 and newer versions use separate colors. As well as make them configurable
So you want it to always be a single colour, determined by a config file?
You'll need to create your own class that extends ItemArmor and overrides ItemArmor#getColor to return this colour, overrides ItemArmor#hasColor to return false, and overrides ItemArmor#setColor/removeColor to do nothing.
To override the vanilla leather amour in 1.10.2 you can try using substitution aliases, but I'm not sure if they ever worked properly. You can also just register your items normally and replace the recipes for the vanilla armour with recipes for your own armour.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So you want it to always be a single colour, determined by a config file?
You'll need to create your own class that extends ItemArmor and overrides ItemArmor#getColor to return this colour, overrides ItemArmor#hasColor to return false, and overrides ItemArmor#setColor/removeColor to do nothing.
To override the vanilla leather amour in 1.10.2 you can try using substitution aliases, but I'm not sure if they ever worked properly. You can also just register your items normally and replace the recipes for the vanilla armour with recipes for your own armour.
How do I know what layer the render index is? I need a different color for it rendering based on the layer so the pads are a different color
What is going on with 1.12 it won't let me register anything and it wants me to fire an event. I want to be able to register things in init/post init as my mod is a core utility mod that will be able to remove items/blocks with override ones.
How do I know what layer the render index is on a different color for it rendering based on the index. I want pads to be a different color as well.
Only a single layer of the armour model is coloured by ItemArmor#getColor, the other layer uses the default colour (defined in LayerArmorBase).
If you want to change the default colour for your armour, you'd need to replace the LayerBipedArmor instances for the vanilla Render instances with your own implementation. You'd also need to replace the vanilla overlay textures with greyscale ones for the colouring to work properly.
What is going on with 1.12 it won't let me register anything and it wants me to fire an event. I want to be able to register things in init/post init as my mod is a core utility mod that will be able to remove items/blocks with override ones.
Are you talking about registry events? You don't fire them, you subscribe to them.
You can control the order your handlers are called in using the @SubscribeEvent#priority property.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Can it work in post init since My mods do alot of stuff there and will have to do stuff in post init.
If you want to change the default colour for your armour, you'd need to replace the LayerBipedArmor instances for the vanilla Render instances with your own implementation. You'd also need to replace the vanilla overlay textures with grey scale ones for the colouring to work properly.
Can you describe this in further details? I am trying to just physically make my own armor items and make vanilla's unaccessible would I still need to do this even though it's my own armor? Describe where this is called at if I still need to do this. 1.7.10 had it rendering based on the item armor class getcolor stack and get color
Can it work in post init since My mods do alot of stuff there and will have to do stuff in post init.
It's strongly recommended to use the registry events, but it should still be possible to register things in postInit since the registries are frozen after that. This may or may not be true in future versions.
Can you not move the things currently done in postInit to be done earlier?
Can you describe this in further details? I am trying to just physically make my own armor items and make vanilla's unaccessible would I still need to do this? Describe where this is called at if I still need to do this. 1.7.10 had it rendering based on the item armor class getcolor stack and get color
All armour rendering (even armour with custom models) is handled by LayerArmorBase and its subclasses.
You need to create a class that extends LayerArmorBase and delegates to another LayerArmorBase instance.
Override LayerArmorBase#doRenderLayer to call a copy of LayerArmorBase#renderArmorLayer for each slot. In your copy of LayerArmorBase#renderArmorLayer, use a custom colour for the second layer (the block with the // Non-colored comment in the vanilla code) instead of the default colour when the item being rendered is one of your armour items.
Override all other public/protected methods to call the corresponding methods on the other LayerArmorBase instance.
In init, find the RenderLivingBase instances you want to replace the LayerArmorBase instances of, iterate through RenderLivingBase#layerRenderers until you find the LayerArmorBase instance, create a new instance of your class using it and then replace the original instance with the new one.
You can either perform this replacement for individual vanilla RenderLivingBase instances and leave mods to opt-in to the replacement manually or perform the replacement for every RenderLivingBase in RenderManager#entityRenderMap and RenderManager#skinMap (which you'll need to access via reflection as the getter method returns a read-only view).
The former preserves any custom armour rendering for other mods' entities but may render your armour without the extra colour, the latter guarantees that your armour will be rendered with the extra colour but may break any custom armour rendering.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
it should still be possible to register things in postInit since the registries are frozen after that. This may or may not be true in future versions.
I am confused you are saying it's impossible or are you saying it's fine to do it in post init? What method?
Can you not move the things currently done in postInit to be done earlier?
I could but, if a mod loads stuff after me and they do init it won't work with it. Even you wanted me doing the stuff in init meaning I wouldn't override anything since my mod loads as one of the first things since it name is [mcversion]EvilNotchCore-##.#
I will be looking into the leather armor thing ......
I am confused you are saying it's impossible or are you saying it's fine to do it in post init? What method?
It's possible to register things in postInit, but you should avoid it if possible.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Using the register method which is asking for something or the event thing?
You register things with IForgeRegistry#register or IForgeRegistry#registerAll regardless of when you register them.
If you're using the registry events, use RegistryEvent.Register#getRegistry to get the IForgeRegistry. If you're not, get the IForgeRegistry from the ForgeRegistries class.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You register things with IForgeRegistry#register or IForgeRegistry#registerAll regardless of when you register them.
If you're using the registry events, use RegistryEvent.Register#getRegistry to get the IForgeRegistry. If you're not, get the IForgeRegistry from the ForgeRegistries class.
IForgeRegistry#register Only wants an item no localized name and I need the object not the class so confused right now.
IForgeRegistry#register Only wants an item no localized name and I need the object not the class so confused right now.
Create an instance of your Item class, set its registry name with IForgeRegistryEntry#setRegistryName and then register it.
The localised name has nothing to do with the registration.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
If you're using the registry events, use RegistryEvent.Register#getRegistry to get the IForgeRegistry. If you're not, get the IForgeRegistry from the ForgeRegistries class.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
IForgeRegistry#register is an instance method, you need to call it on an instance of IForgeRegistry.
I explained how to get the IForgeRegistry instance in my previous post:
What happened to registering blocks with custom itemblocks?
Adding Crafting Recipes in code? This no longer works
ForgeRegistries.RECIPES.register(new ItemStack(oldMap), new Object[]{"xxx","xyx","xxx",'x',Items.PAPER,'y',Items.COMPASS});//Adds My map to the registry
What happened to registering blocks with custom itemblocks?
Block and Item both implement IForgeRegistryEntry, you register them both in the same way. This includes ItemBlocks.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
How does it know where the item block is suppose to be attached to the block resource location stuff unlocalized names?
When you register an ItemBlock, Forge adds the ItemBlock and the Block it returns from ItemBlock#getBlock to the Map used by Item.getItemFromBlock.
The Block and ItemBlock should have the same registry name as each other, but this isn't strictly required.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I just tried always returning 255 and registering the vanilla leather armor and it doesn't work for the actual model. Does this mean I have to do my own leather armor like I thought?
@Override public int getColorFromItemstack(ItemStack stack, int tintIndex) { return 255; }
Armour models don't use IItemColor, they use ItemArmor#getColor. You can use ItemArmor#setColor to set the colour of a Leather Armour ItemStack.
What exactly are you trying to do?
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Completely override it since mc 1.2.5 and newer versions use separate colors. As well as make them configurable
So you want it to always be a single colour, determined by a config file?
You'll need to create your own class that extends ItemArmor and overrides ItemArmor#getColor to return this colour, overrides ItemArmor#hasColor to return false, and overrides ItemArmor#setColor/removeColor to do nothing.
To override the vanilla leather amour in 1.10.2 you can try using substitution aliases, but I'm not sure if they ever worked properly. You can also just register your items normally and replace the recipes for the vanilla armour with recipes for your own armour.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
How do I know what layer the render index is? I need a different color for it rendering based on the layer so the pads are a different color
What is going on with 1.12 it won't let me register anything and it wants me to fire an event. I want to be able to register things in init/post init as my mod is a core utility mod that will be able to remove items/blocks with override ones.
Only a single layer of the armour model is coloured by ItemArmor#getColor, the other layer uses the default colour (defined in LayerArmorBase).
If you want to change the default colour for your armour, you'd need to replace the LayerBipedArmor instances for the vanilla Render instances with your own implementation. You'd also need to replace the vanilla overlay textures with greyscale ones for the colouring to work properly.
Are you talking about registry events? You don't fire them, you subscribe to them.
You can control the order your handlers are called in using the @SubscribeEvent#priority property.
See my mod's init classes for examples of how to use registry events.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Can it work in post init since My mods do alot of stuff there and will have to do stuff in post init.
Can you describe this in further details? I am trying to just physically make my own armor items and make vanilla's unaccessible would I still need to do this even though it's my own armor? Describe where this is called at if I still need to do this. 1.7.10 had it rendering based on the item armor class getcolor stack and get color
It's strongly recommended to use the registry events, but it should still be possible to register things in postInit since the registries are frozen after that. This may or may not be true in future versions.
Can you not move the things currently done in postInit to be done earlier?
All armour rendering (even armour with custom models) is handled by LayerArmorBase and its subclasses.
You need to create a class that extends LayerArmorBase and delegates to another LayerArmorBase instance.
Override LayerArmorBase#doRenderLayer to call a copy of LayerArmorBase#renderArmorLayer for each slot. In your copy of LayerArmorBase#renderArmorLayer, use a custom colour for the second layer (the block with the // Non-colored comment in the vanilla code) instead of the default colour when the item being rendered is one of your armour items.
Override all other public/protected methods to call the corresponding methods on the other LayerArmorBase instance.
In init, find the RenderLivingBase instances you want to replace the LayerArmorBase instances of, iterate through RenderLivingBase#layerRenderers until you find the LayerArmorBase instance, create a new instance of your class using it and then replace the original instance with the new one.
You can either perform this replacement for individual vanilla RenderLivingBase instances and leave mods to opt-in to the replacement manually or perform the replacement for every RenderLivingBase in RenderManager#entityRenderMap and RenderManager#skinMap (which you'll need to access via reflection as the getter method returns a read-only view).
The former preserves any custom armour rendering for other mods' entities but may render your armour without the extra colour, the latter guarantees that your armour will be rendered with the extra colour but may break any custom armour rendering.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I am confused you are saying it's impossible or are you saying it's fine to do it in post init? What method?
I could but, if a mod loads stuff after me and they do init it won't work with it. Even you wanted me doing the stuff in init meaning I wouldn't override anything since my mod loads as one of the first things since it name is [mcversion]EvilNotchCore-##.#
I will be looking into the leather armor thing ......
It's possible to register things in postInit, but you should avoid it if possible.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Using the register method which is asking for something or the event thing?
You register things with IForgeRegistry#register or IForgeRegistry#registerAll regardless of when you register them.
If you're using the registry events, use RegistryEvent.Register#getRegistry to get the IForgeRegistry. If you're not, get the IForgeRegistry from the ForgeRegistries class.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
IForgeRegistry#register Only wants an item no localized name and I need the object not the class so confused right now.
Create an instance of your Item class, set its registry name with IForgeRegistryEntry#setRegistryName and then register it.
The localised name has nothing to do with the registration.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
"Cannot make a static reference to the non-static method register(IForgeRegistryEntry) from the type IForgeRegistry"
IForgeRegistry.register(helmet);
that's the interface where is the object for iforge registry?
IForgeRegistry#register is an instance method, you need to call it on an instance of IForgeRegistry.
I explained how to get the IForgeRegistry instance in my previous post:
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
What happened to registering blocks with custom itemblocks?
Adding Crafting Recipes in code? This no longer works
ForgeRegistries.RECIPES.register(new ItemStack(oldMap), new Object[]{"xxx","xyx","xxx",'x',Items.PAPER,'y',Items.COMPASS});//Adds My map to the registry
Block and Item both implement IForgeRegistryEntry, you register them both in the same way. This includes ItemBlocks.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
How does it know where the item block is suppose to be attached to the block resource location stuff unlocalized names?
When you register an ItemBlock, Forge adds the ItemBlock and the Block it returns from ItemBlock#getBlock to the Map used by Item.getItemFromBlock.
The Block and ItemBlock should have the same registry name as each other, but this isn't strictly required.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.