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

Hello, I am trying to make colored armor but I cant get it working, even though it renders the color in the item, it does not when you wear it.

 

 

 

 

package org.zaet.api.armor;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

import org.zaet.api.ZaetRegistry;

public class ColoredArmor extends ItemArmor
{
public static final int helm = 0, chest = 1, legs = 2, boots = 3;

public String folder;
public String armorName;
public int color;

public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab)
{
	super(material, render, type);
	this.color = color;
	this.folder = folder;
	this.armorName = armorName;
	setTextureName(folder + ":" + armorName + "_" + type);
	setUnlocalizedName(folder + "_" + armorName + "_" + type + color);
	setCreativeTab(tab);
}

@Override
public void registerIcons(IIconRegister r)
{
	this.itemIcon = r.registerIcon(folder + ":" + armorName + "_" + armorType);
}

 @Override
 public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
 {
	switch(this.armorType)
	{
	case helm: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	case chest: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	case legs: return folder + ":" + "textures/armor/" + armorName + "_2" + ".png";
	case boots: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	default: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	}
}

 @Override
 public boolean hasColor(ItemStack item)
 {
	 return true;
 }

 @Override
 public int getColor(ItemStack item)
 {
	 return ZaetRegistry.getColorHexCode(color);
 }

 @Override
 public int getColorFromItemStack(ItemStack item, int unUsed)
 {
	 return getColor(null);
 }
}


 

 

 

 

Xm5yuaJ.png

 

Does anyone have any ideas?

Hmm.

 

Looks like what you have is right....

 

I managed to get it working.  Not sure what I have that you don't.

 

https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/item/ItemArtifactArmor.java

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

That only affects the Item icon, not the armor texture. I haven't done the Item Textures.

  • Author

Updated the OP with an image and updated code

 

 

 

 

package org.zaet.api.armor;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

import org.zaet.api.ZaetRegistry;

public class ColoredArmor extends ItemArmor
{
public static final int helm = 0, chest = 1, legs = 2, boots = 3;

public String folder;
public String armorName;
public int color;

public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab)
{
	super(material, render, type);
	this.color = color;
	this.folder = folder;
	this.armorName = armorName;
	setTextureName(folder + ":" + armorName + "_" + type);
	setUnlocalizedName(folder + "_" + armorName + "_" + type + color);
	setCreativeTab(tab);
}

@Override
public void registerIcons(IIconRegister r)
{
	this.itemIcon = r.registerIcon(folder + ":" + armorName + "_" + armorType);
}

 @Override
 public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
 {
	switch(this.armorType)
	{
	case helm: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	case chest: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	case legs: return folder + ":" + "textures/armor/" + armorName + "_2" + ".png";
	case boots: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	default: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png";
	}
}

 @Override
 public boolean hasColor(ItemStack item)
 {
	 return true;
 }

 @Override
 public int getColor(ItemStack item)
 {
	 return ZaetRegistry.getColorHexCode(color);
 }

 @Override
 public int getColorFromItemStack(ItemStack item, int unUsed)
 {
	 return getColor(null);
 }
}


 

 

 

 

Xm5yuaJ.png

public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab)
{
	super(material, render, type);

Only leather armor use color, how did you initialize your armor ?

  • Author

ZaetRegistry.registerColoredArmor("zaet", "dyeArmor", ArmorMaterial.CLOTH, tabZaetMech);

 

public static void registerColoredArmor(String folder, String name, ArmorMaterial material, CreativeTabs creativeTabs)
{
	for(int i = 0; i < 16; i++)
	{
		for(int x = 0; x < 4; x++)
		{
			Item armor = new ColoredArmor(i, folder, name, material, 0, x, creativeTabs);
			GameRegistry.registerItem(armor, armor.getUnlocalizedName());
		}
	}

  • Author

ZaetRegistry.registerColoredArmor("zaet", "dyeArmor", ArmorMaterial.CLOTH, tabZaetMech);

 

public static void registerColoredArmor(String folder, String name, ArmorMaterial material, CreativeTabs creativeTabs)
{
	for(int i = 0; i < 16; i++)
	{
		for(int x = 0; x < 4; x++)
		{
			Item armor = new ColoredArmor(i, folder, name, material, 0, x, creativeTabs);
			GameRegistry.registerItem(armor, armor.getUnlocalizedName());
		}
	}

 

I assume CLOTH is leather

I assume CLOTH is leather

 

It is.  Minecraft is weird like that sometimes.  Like diamond picks using ToolMaterial.EMERALD.

 

Anyway, I have no idea....

 

 

Actually wait.

 

I do.

 

Your PNGs.  Do you have a regular and an overlay texture?  I assume so.

 

The regular is the one that gets colorized.  The overlay is then rendered after with no color adjustment.  I think that might be your problem.

 

And yes, it's a total nuisance.  But that's how the armor renderer was written.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Yes.

 

But my point is that the "overlay" layer needs to be transparent.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Not easily.  You'd probably have to write your own renderer.  Just swap your pngs and it'll work.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.