2015-04-11 01:12:59 +02:00
|
|
|
package techreborn.items;
|
|
|
|
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2015-06-26 08:09:45 +02:00
|
|
|
import net.minecraft.init.Items;
|
2015-04-11 01:12:59 +02:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
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-11-24 23:58:18 +01:00
|
|
|
import techreborn.lib.ModInfo;
|
2015-04-15 17:23:12 +02:00
|
|
|
|
2015-07-02 20:51:24 +02:00
|
|
|
import java.security.InvalidParameterException;
|
|
|
|
import java.util.List;
|
|
|
|
|
2015-11-24 23:58:18 +01:00
|
|
|
public class ItemDusts extends ItemMetaBase {
|
2015-08-09 12:05:32 +02:00
|
|
|
public static ItemStack getDustByName(String name, int count) {
|
|
|
|
for (int i = 0; i < types.length; i++) {
|
|
|
|
if (types[i].equalsIgnoreCase(name)) {
|
|
|
|
return new ItemStack(ModItems.dusts, count, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name.equalsIgnoreCase("glowstone")) {
|
|
|
|
return new ItemStack(Items.glowstone_dust, count);
|
|
|
|
}
|
|
|
|
if (name.equalsIgnoreCase("redstone")) {
|
|
|
|
return new ItemStack(Items.redstone, count);
|
|
|
|
}
|
|
|
|
if (name.equalsIgnoreCase("gunpowder")) {
|
|
|
|
return new ItemStack(Items.gunpowder, count);
|
|
|
|
}
|
|
|
|
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ItemStack getDustByName(String name) {
|
|
|
|
return getDustByName(name, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final String[] types = new String[]
|
|
|
|
{"almandine", "aluminumBrass", "aluminum", "alumite", "andradite",
|
|
|
|
"antimony", "ardite", "ashes", "basalt", "bauxite", "biotite",
|
|
|
|
"brass", "bronze", "cadmium", "calcite", "charcoal", "chrome",
|
|
|
|
"cinnabar", "clay", "coal", "cobalt", "copper", "cupronickel",
|
|
|
|
"darkAshes", "darkIron", "diamond", "electrum", "emerald",
|
|
|
|
"enderEye", "enderPearl", "endstone", "flint", "galena", "gold", "graphite",
|
|
|
|
"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",
|
|
|
|
"sapphire", "sawDust", "silicon", "silver", "sodalite", "spessartine", "sphalerite",
|
|
|
|
"steel", "sulfur", "tellurium", "teslatite", "tetrahedrite", "tin",
|
|
|
|
"titanium", "tungsten", "uvarovite", "vinteum", "voidstone", "yellowGarnet",
|
|
|
|
"zinc", "greenSapphire"};
|
|
|
|
|
2015-11-23 21:03:07 +01:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
|
|
|
|
public ItemDusts() {
|
|
|
|
setUnlocalizedName("techreborn.dust");
|
|
|
|
setHasSubtypes(true);
|
|
|
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.getUnlocalizedName() + "." + types[meta];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
2015-11-24 23:58:18 +01:00
|
|
|
@Override
|
|
|
|
public String getTextureName(int damage) {
|
|
|
|
return ModInfo.MOD_ID + ":items/dust/" + types[damage] + "Dust";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMaxMeta() {
|
|
|
|
return types.length;
|
|
|
|
}
|
|
|
|
|
2015-04-11 01:12:59 +02:00
|
|
|
}
|