aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/items/nuclear/IsotopeMaterial.java
blob: fe32af17d9d073a1ad7bd2e199f458356e2f90d5 (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
package goodgenerator.items.nuclear;

import goodgenerator.loader.Loaders;
import net.minecraft.item.ItemStack;

import java.util.HashMap;
import java.util.HashSet;

public class IsotopeMaterial {

    public static final HashSet<IsotopeMaterial> mIsotopeMaterial = new HashSet<>();
    public static final HashMap<Integer, IsotopeMaterial> mIDMap = new HashMap<>();
    public static final HashMap<String, IsotopeMaterial> mNameMap = new HashMap<>();

    public final int mID;
    public final int mNeutron;
    public final String mName;
    public final String mLocalizedName;
    public final String mMaterialName;
    public final short[] mRGB;
    public final short[] mRGBO;
    public final NuclearTextures mTexture;

    public IsotopeMaterial(int aID, String aName, String aMaterialName, String aLocalizedName, NuclearTextures aTexture, int aR, int aG, int aB, int aNeutron) {
        if (mIDMap.get(aID) != null)
            throw new UnsupportedOperationException("ID:" + aID + " is already used!");
        this.mID = aID;
        this.mNeutron = aNeutron;
        this.mName = aName;
        this.mMaterialName = aMaterialName;
        this.mLocalizedName = aLocalizedName;
        this.mRGB = new short[] {(short) (aR * 0.6), (short) (aG * 0.6), (short) (aB * 0.6), 0};
        this.mRGBO = new short[] {(short) aR, (short) aG, (short) aB, 0};
        this.mTexture = aTexture;
        mIsotopeMaterial.add(this);
        mIDMap.put(this.mID, this);
        mNameMap.put(this.mName, this);
    }

    public ItemStack getFull(int aAmount) {
        if (aAmount > 64) aAmount = 64;
        return new ItemStack(Loaders.Isotope, aAmount, mID + 1000);
    }

    public ItemStack getTiny(int aAmount) {
        if (aAmount > 64) aAmount = 64;
        return new ItemStack(Loaders.Isotope, aAmount, mID + 2000);
    }

    public ItemStack getFullOxide(int aAmount) {
        if (aAmount > 64) aAmount = 64;
        return new ItemStack(Loaders.Isotope, aAmount, mID + 3000);
    }

    public ItemStack getTinyOxide(int aAmount) {
        if (aAmount > 64) aAmount = 64;
        return new ItemStack(Loaders.Isotope, aAmount, mID + 4000);
    }
}