blob: 5e076e6e7046d31f17588d40fb282fba6bcebca1 (
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
85
86
87
88
89
90
91
92
93
94
|
package gtPlusPlus.core.material;
import gtPlusPlus.core.util.item.UtilsItems;
import net.minecraft.item.ItemStack;
public class MaterialStack {
final int vAmount;
final Material stackMaterial;
final double percentageToUse;
public MaterialStack(Material inputs, double percentage){
this.stackMaterial = inputs;
this.percentageToUse = percentage;
this.vAmount = getDustCount();
}
public ItemStack getDustStack(){
int caseStatus = 0;
int amount = 0;
if (percentageToUse >= 0 && percentageToUse <= 0.99){
caseStatus = 1;
amount = (int) (1/percentageToUse);
//amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(2));
}
else if (percentageToUse >= 1 && percentageToUse <= 9.99){
caseStatus = 2;
amount = (int) (percentageToUse);
//amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0));
}
else if (percentageToUse >= 10 && percentageToUse <= 99.99){
caseStatus = 3;
amount = (int) (percentageToUse/10);
//amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0));
}
else if (percentageToUse == 100){
caseStatus = 4;
amount = 10;
}
else {
amount = 0;
}
switch (caseStatus) {
case 1: {
return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+stackMaterial.unlocalizedName, amount);
}
case 2: {
return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+stackMaterial.unlocalizedName, amount);
}
case 3: {
return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+stackMaterial.unlocalizedName, amount);
}
case 4: {
return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+stackMaterial.unlocalizedName, amount);
}
default:
return null;
}
}
public int getDustCount(){
int amount = 0;
if (percentageToUse >= 0 && percentageToUse <= 0.99){
amount = (int) (1/percentageToUse);
}
else if (percentageToUse >= 1 && percentageToUse <= 9.99){
amount = (int) (percentageToUse);
}
else if (percentageToUse >= 10 && percentageToUse <= 99.99){
amount = (int) (percentageToUse/10);
}
else if (percentageToUse == 100){
amount = 10;
}
else {
amount = 0;
}
return amount;
}
public ItemStack[] getValidItemStacks(){
return UtilsItems.validItemsForOreDict(stackMaterial.unlocalizedName);
}
}
|