aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pers/gwyog/gtneioreplugin/util/SmallOre.java
blob: 75a691ad1cc6ecba4af77e9a66990257ffdc1ffa (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
package pers.gwyog.gtneioreplugin.util;

import static pers.gwyog.gtneioreplugin.util.DimensionHelper.DimNameDisplayed;

import java.util.Map;

@SuppressWarnings("unused")
public class SmallOre implements Comparable<SmallOre> {

    private String oreName;
    private int oreMeta;
    private int amount;
    private String height = "";
    private static final int sizeData = 4; // hors dims

    private Map<String, Boolean> dimensions;

    public void setDims(Map<String, Boolean> dims) {
        this.dimensions = dims;
    }

    public String getOreName() {
        return this.oreName;
    }

    public void setOreName(String s) {
        this.oreName = s;
    }

    public int getOreMeta() {
        return this.oreMeta;
    }

    public void setOreMeta(int meta) {
        this.oreMeta = meta;
    }

    public String getHeight() {
        return this.height;
    }

    public void setHeight(String s) {
        this.height = s;
    }

    public void setAmount(int i) {
        this.amount = i;
    }

    public int getAmount() {
        return this.amount;
    }

    public static String getCsvHeader() {
        String[] headers = new String[sizeData + DimNameDisplayed.length];
        headers[0] = "Ore Name";
        headers[1] = "Block Meta";
        headers[2] = "Height";
        headers[3] = "Amount Per Chunk";
        for (int i = 0; i < DimNameDisplayed.length; i++) {
            headers[sizeData + i] = DimensionHelper.getFullName(DimNameDisplayed[i]);
        }
        return String.join(",", headers);
    }

    public String getCsvEntry() {
        String[] values = new String[sizeData + DimNameDisplayed.length];
        values[0] = oreName;
        values[1] = Integer.toString(oreMeta);
        values[2] = getHeight();
        values[3] = Integer.toString(amount);
        for (int i = 0; i < DimNameDisplayed.length; i++) {
            values[sizeData + i] = Boolean.toString(dimensions.getOrDefault(DimNameDisplayed[i], false));
        }
        return String.join(",", values);
    }

    @Override
    public int compareTo(SmallOre other) {
        return oreName.compareTo(other.oreName);
    }
}