use of binnie.botany.api.gardening.EnumFertiliserType in project Binnie by ForestryMC.
the class ModuleGardening method addFertiliserRecipes.
private void addFertiliserRecipes(RecipeUtil recipeUtil) {
IGardeningManager gardening = BotanyCore.getGardening();
for (EnumMoisture moisture : EnumMoisture.values()) {
for (EnumAcidity acidity : EnumAcidity.values()) {
int pH = acidity.ordinal();
for (EnumSoilType type : EnumSoilType.values()) {
Map<EnumFertiliserType, Map<ItemStack, Integer>> fertilisers = gardening.getFertilisers();
for (EnumFertiliserType fertiliserType : EnumFertiliserType.values()) {
for (Map.Entry<ItemStack, Integer> entry : fertilisers.get(fertiliserType).entrySet()) {
ItemStack stack = entry.getKey();
int strengthMax = entry.getValue();
for (boolean weedkiller : new boolean[] { false, true }) {
int numOfBlocks = strengthMax * strengthMax;
for (int strength = 1; strength < strengthMax; ++strength) {
int endPh;
if (fertiliserType == EnumFertiliserType.ACID) {
endPh = pH - strength;
} else if (fertiliserType == EnumFertiliserType.ALKALINE) {
endPh = pH + strength;
} else {
endPh = type.ordinal() + strength;
}
if (endPh < 0 || endPh > 2 || pH == endPh) {
continue;
}
ItemStack start = getStack(type, acidity, moisture, weedkiller);
ItemStack end = getStack(type, EnumAcidity.values()[endPh], moisture, weedkiller);
if (!start.isEmpty() && !end.isEmpty()) {
end.setCount(numOfBlocks);
Object[] stacks = new Object[numOfBlocks + 1];
for (int i = 0; i < numOfBlocks; ++i) {
stacks[i] = start;
}
stacks[numOfBlocks] = stack.copy();
String recipeName = fertiliserType.name().toLowerCase(Locale.ENGLISH) + "_fertiliser_moisture" + moisture + "_ph" + pH + "_type" + type + "_strength" + strength;
recipeUtil.addShapelessRecipe(recipeName, end, stacks);
}
numOfBlocks /= 2;
}
}
}
}
ItemStack start = getStack(type, acidity, moisture, false);
ItemStack end = getStack(type, acidity, moisture, true);
String recipeName = "weedkiller_moisture" + moisture + "_ph" + pH + "_type" + type;
recipeUtil.addShapelessRecipe(recipeName, end, start, start, start, start, "weedkiller");
}
}
}
}
Aggregations