Make it get the colour properly for the dust
This commit is contained in:
parent
cce4db4a9c
commit
f078b765e6
1 changed files with 61 additions and 36 deletions
|
@ -4,6 +4,9 @@ import java.awt.Color;
|
|||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
|
@ -15,6 +18,7 @@ import javax.imageio.ImageIO;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -24,6 +28,7 @@ import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.core.base.ItemBase;
|
||||
import calclavia.lib.Calclavia;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -80,13 +85,28 @@ public class ItemDust extends ItemBase
|
|||
public static void computeColors()
|
||||
{
|
||||
for (String ingotName : ingotNames)
|
||||
{
|
||||
for (ItemStack ingotStack : OreDictionary.getOres("ingot" + ingotName.substring(0, 1).toUpperCase() + ingotName.substring(1)))
|
||||
{
|
||||
// Compute color
|
||||
int totalR = 0;
|
||||
int totalG = 0;
|
||||
int totalB = 0;
|
||||
|
||||
ResourceLocation textureLocation = new ResourceLocation("");
|
||||
Item theIngot = ingotStack.getItem();
|
||||
|
||||
Method o = ReflectionHelper.findMethod(Item.class, theIngot, new String[] {"getIconString", "func_" + "111208_A"});
|
||||
String iconString;
|
||||
try
|
||||
{
|
||||
iconString = (String) o.invoke(theIngot);
|
||||
}
|
||||
catch (ReflectiveOperationException e1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ResourceLocation textureLocation = new ResourceLocation(iconString);
|
||||
InputStream inputstream;
|
||||
try
|
||||
{
|
||||
|
@ -130,6 +150,11 @@ public class ItemDust extends ItemBase
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (!ingotColors.containsKey(ingotName))
|
||||
{
|
||||
ingotColors.put(ingotName, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getStackFromDust(String name)
|
||||
|
|
Loading…
Add table
Reference in a new issue