summaryrefslogtreecommitdiff
path: root/src/main/java/ihl/processing/metallurgy/ElectricEngineItem.java
blob: c1e000316e8ccd30101d41c840e2e0db4b121c22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package ihl.processing.metallurgy;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ihl.IHLCreativeTab;
import ihl.IHLModInfo;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;

public class ElectricEngineItem extends Item{
	
	public Type type;
	public static List<ElectricEngineItem> instances = new ArrayList<ElectricEngineItem> ();
	private static Map<Type, IIcon> iconMap = new HashMap<Type, IIcon>();


	public ElectricEngineItem(Type type1) 
	{
		super();
		this.type=type1;
		this.setCreativeTab(IHLCreativeTab.tab);
		this.setUnlocalizedName(type.unLocalizedName);
		this.setMaxStackSize(1);
		instances.add(this);
	}
	
	public static void init()
	{
		Type[] var1 = Type.values();
		for(int i=0;i<var1.length;i++)
		{
			new ElectricEngineItem(var1[i]);
		}
		Iterator<ElectricEngineItem> ii = instances.iterator();
		while(ii.hasNext())
		{
			ElectricEngineItem instance = ii.next();
			GameRegistry.registerItem(instance,instance.type.unLocalizedName);
		}
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void registerIcons(IIconRegister register) 
	{
		iconMap.put(this.type, register.registerIcon(IHLModInfo.MODID + ":"+this.type.unLocalizedName));
	}

	@Override
	@SideOnly(Side.CLIENT)
	public IIcon getIconFromDamage(int i) 
	{
		return iconMap.get(type);
	}
	
	
	public enum Type
	{
		LVLEElectricEngine("electricMotorLVLEDC", 600,400,0.2F,1500);
		Type(String unlocalizedName1, int maxVoltage1, int generatedVoltage1, float efficiency1,int rpm1)
		{
			unLocalizedName=unlocalizedName1;
			maxVoltage=maxVoltage1;
			generatedVoltage=generatedVoltage1;
			efficiency=efficiency1;
			rpm=rpm1;
		}

		public String unLocalizedName;
		public int maxVoltage=600;
		public int generatedVoltage=400;
		public float efficiency = 0.2F;
		public int rpm=1500;//at max voltage
	}

}