2015-05-04 22:52:08 +02:00
|
|
|
package techreborn.items;
|
|
|
|
|
2016-02-26 14:03:30 +01:00
|
|
|
import java.security.InvalidParameterException;
|
|
|
|
import java.util.List;
|
|
|
|
|
2015-05-04 22:52:08 +02:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
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-05-04 22:52:08 +02:00
|
|
|
|
2015-11-25 09:28:28 +01:00
|
|
|
public class ItemPlates extends ItemTextureBase {
|
2015-08-09 12:05:32 +02:00
|
|
|
|
|
|
|
public static ItemStack getPlateByName(String name, int count) {
|
|
|
|
for (int i = 0; i < types.length; i++) {
|
|
|
|
if (types[i].equalsIgnoreCase(name)) {
|
|
|
|
return new ItemStack(ModItems.plate, count, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new InvalidParameterException("The plate " + name + " could not be found.");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ItemStack getPlateByName(String name) {
|
|
|
|
return getPlateByName(name, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final String[] types = new String[]
|
|
|
|
{"aluminum", "batteryAlloy", "brass", "bronze", "carbon",
|
|
|
|
"chrome", "coal", "copper", "diamond", "electrum", "emerald",
|
|
|
|
"gold", "invar", "iridium", "iron", "lapis", "lead",
|
|
|
|
"magnalium", "nickel", "obsidian", "osmium",
|
|
|
|
"peridot", "platinum", "redGarnet", "redstone",
|
|
|
|
"ruby", "sapphire", "silicon", "silver", "steel",
|
|
|
|
"teslatite", "tin", "titanium", "tungsten", "tungstensteel",
|
|
|
|
"yellowGarnet", "zinc"};
|
|
|
|
|
|
|
|
|
|
|
|
public ItemPlates() {
|
|
|
|
setUnlocalizedName("techreborn.plate");
|
|
|
|
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-05-04 22:52:08 +02:00
|
|
|
|
2015-11-24 23:58:18 +01:00
|
|
|
@Override
|
|
|
|
public String getTextureName(int damage) {
|
|
|
|
return ModInfo.MOD_ID + ":items/plate/" + types[damage] + "Plate";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMaxMeta() {
|
|
|
|
return types.length;
|
|
|
|
}
|
|
|
|
|
2015-05-04 22:52:08 +02:00
|
|
|
}
|