aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kekztech/Items.java
blob: 800f69c77e4132dce318428e3fe7a7495403d042 (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
package kekztech;

import java.util.Arrays;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

import kekztech.common.items.MetaItemCraftingComponent;
import kekztech.util.Util;

public enum Items {

    // Ceramics
    YSZCeramicDust(9, 1),
    GDCCeramicDust(10, 1),
    YttriaDust(11, 1),
    ZirconiaDust(12, 1),
    CeriaDust(13, 1),
    YSZCeramicPlate(14, 1),
    GDCCeramicPlate(15, 1),
    // Error Item
    Error(0, 1);

    static {
        YttriaDust.setOreDictName("dustYttriumOxide");
        ZirconiaDust.setOreDictName("dustCubicZirconia");
    }

    private final int metaID;
    private final int identifier;

    Items(int metaID, int identifier) {
        this.metaID = metaID;
        this.identifier = identifier;
    }

    public int getMetaID() {
        return metaID;
    }

    String OreDictName;

    private void registerOreDict() {
        OreDictionary.registerOre(getOreDictName(), getNonOreDictedItemStack(1));
    }

    public static void registerOreDictNames() {
        Arrays.stream(Items.values())
            .filter(e -> e.getOreDictName() != null)
            .forEach(Items::registerOreDict);
    }

    public ItemStack getNonOreDictedItemStack(int amount) {
        return new ItemStack(MetaItemCraftingComponent.getInstance(), amount, this.getMetaID());
    }

    public ItemStack getOreDictedItemStack(int amount) {
        return this.getOreDictName() != null ? Util.getStackofAmountFromOreDict(this.getOreDictName(), amount)
            : new ItemStack(MetaItemCraftingComponent.getInstance(), amount, this.getMetaID());
    }

    public String getOreDictName() {
        return OreDictName;
    }

    public void setOreDictName(String oreDictName) {
        OreDictName = oreDictName;
    }
}