2015-04-11 01:12:59 +02:00
|
|
|
package techreborn.items;
|
|
|
|
|
2015-06-26 00:41:29 +02:00
|
|
|
import java.security.InvalidParameterException;
|
2015-04-18 12:47:09 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2015-04-11 01:12:59 +02:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.IIcon;
|
2015-04-18 12:47:09 +02:00
|
|
|
import techreborn.client.TechRebornCreativeTabMisc;
|
2015-06-07 06:36:37 +02:00
|
|
|
import techreborn.init.ModItems;
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-05-04 06:27:02 +02:00
|
|
|
public class ItemDusts extends ItemTR {
|
2015-06-07 06:36:37 +02:00
|
|
|
public static ItemStack getDustByName(String name, int count)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < types.length; i++) {
|
2015-06-26 01:16:26 +02:00
|
|
|
if (types[i].equalsIgnoreCase(name)) {
|
2015-06-26 00:41:29 +02:00
|
|
|
return new ItemStack(ModItems.dusts, count, i);
|
2015-06-07 06:36:37 +02:00
|
|
|
}
|
|
|
|
}
|
2015-06-26 00:41:29 +02:00
|
|
|
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
2015-06-07 06:36:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static ItemStack getDustByName(String name)
|
|
|
|
{
|
|
|
|
return getDustByName(name, 1);
|
|
|
|
}
|
|
|
|
|
2015-05-04 06:27:02 +02:00
|
|
|
public static final String[] types = new String[]
|
2015-05-10 01:42:11 +02:00
|
|
|
{ "almandine", "aluminumBrass", "aluminum", "alumite", "andradite",
|
2015-05-04 09:02:01 +02:00
|
|
|
"antimony", "ardite", "ashes", "basalt", "bauxite", "biotite",
|
Added missing dusts and fixed capitalization
Added dusts for antimony, biotite, cadmium, cupronickel, dark iron, graphite, indium, kanthal, lapis, limestone, lodestone, magnetite, manganese, mithril, nichrome, peridot, phosphorous, potassium feldspar, silicon, sodalite, tellurium, teslatite, tetrahedrite, vinteum, and voidstone.
2015-05-04 06:17:09 +02:00
|
|
|
"brass", "bronze", "cadmium", "calcite", "charcoal", "chrome",
|
|
|
|
"cinnabar", "clay", "coal", "cobalt", "copper", "cupronickel",
|
|
|
|
"darkAshes", "darkIron", "diamond", "electrum", "emerald",
|
2015-06-13 01:49:32 +02:00
|
|
|
"enderEye", "enderPearl", "endstone", "flint", "galena", "gold", "graphite",
|
Added missing dusts and fixed capitalization
Added dusts for antimony, biotite, cadmium, cupronickel, dark iron, graphite, indium, kanthal, lapis, limestone, lodestone, magnetite, manganese, mithril, nichrome, peridot, phosphorous, potassium feldspar, silicon, sodalite, tellurium, teslatite, tetrahedrite, vinteum, and voidstone.
2015-05-04 06:17:09 +02:00
|
|
|
"grossular", "indium", "invar", "iridium", "iron", "kanthal", "lapis", "lazurite",
|
|
|
|
"lead", "limestone", "lodestone", "magnesium", "magnetite", "manganese",
|
|
|
|
"manyullyn", "marble", "mithril", "netherrack", "nichrome", "nickel",
|
|
|
|
"obsidian", "osmium", "peridot", "phosphorous", "platinum", "potassiumFeldspar",
|
|
|
|
"pyrite", "pyrope", "redGarnet", "redrock", "ruby", "saltpeter",
|
2015-06-13 01:49:32 +02:00
|
|
|
"sapphire", "sawDust", "silicon", "silver", "sodalite", "spessartine", "sphalerite",
|
Added missing dusts and fixed capitalization
Added dusts for antimony, biotite, cadmium, cupronickel, dark iron, graphite, indium, kanthal, lapis, limestone, lodestone, magnetite, manganese, mithril, nichrome, peridot, phosphorous, potassium feldspar, silicon, sodalite, tellurium, teslatite, tetrahedrite, vinteum, and voidstone.
2015-05-04 06:17:09 +02:00
|
|
|
"steel", "sulfur", "tellurium", "teslatite", "tetrahedrite", "tin",
|
|
|
|
"titanium", "tungsten", "uvarovite", "vinteum", "voidstone", "yellowGarnet",
|
2015-06-13 01:49:32 +02:00
|
|
|
"zinc" };
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
private IIcon[] textures;
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
public ItemDusts()
|
|
|
|
{
|
|
|
|
setUnlocalizedName("techreborn.dust");
|
|
|
|
setHasSubtypes(true);
|
|
|
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
|
|
|
}
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@Override
|
|
|
|
// Registers Textures For All Dusts
|
|
|
|
public void registerIcons(IIconRegister iconRegister)
|
|
|
|
{
|
|
|
|
textures = new IIcon[types.length];
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
for (int i = 0; i < types.length; ++i)
|
|
|
|
{
|
|
|
|
textures[i] = iconRegister.registerIcon("techreborn:" + "dust/"
|
|
|
|
+ types[i] + "Dust");
|
|
|
|
}
|
|
|
|
}
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@Override
|
|
|
|
// Adds Texture what match's meta data
|
|
|
|
public IIcon getIconFromDamage(int meta)
|
|
|
|
{
|
|
|
|
if (meta < 0 || meta >= textures.length)
|
|
|
|
{
|
|
|
|
meta = 0;
|
|
|
|
}
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
return textures[meta];
|
|
|
|
}
|
2015-04-11 01:12:59 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@Override
|
|
|
|
// gets Unlocalized Name depending on meta data
|
|
|
|
public String getUnlocalizedName(ItemStack itemStack)
|
|
|
|
{
|
|
|
|
int meta = itemStack.getItemDamage();
|
|
|
|
if (meta < 0 || meta >= types.length)
|
|
|
|
{
|
|
|
|
meta = 0;
|
|
|
|
}
|
2015-04-11 01:12:59 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
return super.getUnlocalizedName() + "." + types[meta];
|
|
|
|
}
|
2015-04-11 01:12:59 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
// Adds Dusts SubItems To Creative Tab
|
|
|
|
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
|
|
|
{
|
|
|
|
for (int meta = 0; meta < types.length; ++meta)
|
|
|
|
{
|
|
|
|
list.add(new ItemStack(item, 1, meta));
|
|
|
|
}
|
|
|
|
}
|
2015-04-11 01:12:59 +02:00
|
|
|
|
|
|
|
}
|