aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/material/MaterialStack.java
blob: f8b9b35bd8d84eb8b0134accc8a5aecdcbb142f0 (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
package gtPlusPlus.core.material;

import gtPlusPlus.core.util.item.UtilsItems;
import net.minecraft.item.ItemStack;

public class MaterialStack {
	
	final Material materialInput;
	final double percentageToUse;
	
	public MaterialStack(Material inputs, double percentage){

		this.materialInput = inputs;
		this.percentageToUse = percentage;
		
		
	}
	
	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"+materialInput.unlocalizedName, amount);
		}
		case 2: {
			return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+materialInput.unlocalizedName, amount);
		}
		case 3: {
			return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount);
		}
		case 4: {
			return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount);
		}
		default:
			return null;
		}
		
	}
	
	public ItemStack[] getValidItemStacks(){
		return UtilsItems.validItemsForOreDict(materialInput.unlocalizedName);
	}
	
	
	
	
	

}