Add a use for bauxite and continue the great refactor of 2017

This commit is contained in:
Prospector 2017-01-01 19:32:53 -08:00
parent 6a70424252
commit 007c6ca38a
4 changed files with 76 additions and 15 deletions

View file

@ -27,10 +27,13 @@ import techreborn.api.reactor.FusionReactorRecipeHelper;
import techreborn.api.recipe.RecyclerRecipe;
import techreborn.api.recipe.ScrapboxRecipe;
import techreborn.api.recipe.machines.*;
import techreborn.blocks.*;
import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockOre2;
import techreborn.compat.CompatManager;
import techreborn.config.ConfigTechReborn;
import techreborn.init.recipes.CraftingTableRecipes;
import techreborn.init.recipes.IndustrialElectrolyzerRecipes;
import techreborn.init.recipes.IndustrialGrinderRecipes;
import techreborn.items.*;
import techreborn.parts.powerCables.ItemStandaloneCables;
@ -61,6 +64,7 @@ public class ModRecipes {
CraftingTableRecipes.init();
IndustrialGrinderRecipes.init();
IndustrialElectrolyzerRecipes.init();
addGeneralShapedRecipes();
addMachineRecipes();

View file

@ -0,0 +1,58 @@
package techreborn.init.recipes;
import net.minecraft.item.ItemStack;
import reborncore.api.recipe.RecipeHandler;
import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe;
import techreborn.items.DynamicCell;
import java.security.InvalidParameterException;
/**
* Created by Prospector
*/
public class IndustrialElectrolyzerRecipes extends RecipeMethods {
public static void init() {
register(getOre("dustBauxite", 12), 100, 128, getMaterial("aluminum", 8, Type.DUST), getMaterial("titanium", 2, Type.SMALL_DUST), getMaterial("hydrogen", 5, Type.CELL));
}
static void register(ItemStack input, int ticks, int euPerTick, ItemStack... outputs) {
ItemStack output1;
ItemStack output2 = null;
ItemStack output3 = null;
ItemStack output4 = null;
if (outputs.length == 3) {
output1 = outputs[0];
output2 = outputs[1];
output3 = outputs[2];
} else if (outputs.length == 2) {
output1 = outputs[0];
output2 = outputs[1];
} else if (outputs.length == 1) {
output1 = outputs[0];
} else if (outputs.length == 4) {
output1 = outputs[0];
output2 = outputs[1];
output3 = outputs[2];
output4 = outputs[3];
} else {
throw new InvalidParameterException("Invalid industrial electrolyzer outputs: " + outputs);
}
int cellCount = 0;
for (ItemStack stack : outputs) {
if (stack.getItem() instanceof DynamicCell) {
cellCount += stack.getCount();
}
}
ItemStack cells = null;
if (cellCount > 0) {
if (cellCount > 64) {
throw new InvalidParameterException("Invalid industrial electrolyzer outputs: " + outputs + "(Recipe requires > 64 cells)");
}
cells = DynamicCell.getEmptyCell(cellCount);
}
RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick));
}
}

View file

@ -5,13 +5,13 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.apache.logging.log4j.Level;
import reborncore.api.recipe.RecipeHandler;
import techreborn.Core;
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
import techreborn.blocks.BlockOre;
import techreborn.init.ModFluids;
import java.security.InvalidParameterException;
/**
* Created by Prospector
*/
@ -171,7 +171,7 @@ public class IndustrialGrinderRecipes extends RecipeMethods {
RecipeHandler.addRecipe(new IndustrialGrinderRecipe(output,
fluid, inputs[0], inputs[1], inputs[2], inputs[3], ticks, euPerTick));
} else {
Core.logHelper.log(Level.ERROR, "Invalid industrial grinder recipe. Too many or too few inputs.");
throw new InvalidParameterException("Invalid industrial grinder inputs: " + inputs);
}
}
}

View file

@ -12,21 +12,20 @@ public abstract class RecipeMethods {
static ItemStack getMaterial(String name, int count, Type type) {
if (type == Type.DUST) {
return ItemDusts.getDustByName(name, count);
}
if (type == Type.SMALL_DUST) {
} else if (type == Type.SMALL_DUST) {
return ItemDustsSmall.getSmallDustByName(name, count);
}
if (type == Type.INGOT) {
} else if (type == Type.INGOT) {
return ItemIngots.getIngotByName(name, count);
}
if (type == Type.GEM) {
} else if (type == Type.GEM) {
return ItemGems.getGemByName(name, count);
}
if (type == Type.PLATE) {
} else if (type == Type.PLATE) {
return ItemPlates.getPlateByName(name, count);
}
if (type == Type.NUGGET) {
} else if (type == Type.NUGGET) {
return ItemNuggets.getNuggetByName(name, count);
} else if (type == Type.CELL) {
return ItemCells.getCellByName(name, count);
} else {
}
return ItemStack.EMPTY;
}
@ -53,6 +52,6 @@ public abstract class RecipeMethods {
}
enum Type {
DUST, SMALL_DUST, INGOT, NUGGET, PLATE, GEM
DUST, SMALL_DUST, INGOT, NUGGET, PLATE, GEM, CELL
}
}