use of gregtech.api.recipes.RecipeBuilder in project GregTech by GregTechCE.
the class ProcessingDecomposition method registerOre.
// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
if (entry.material instanceof FluidMaterial) {
FluidMaterial material = (FluidMaterial) entry.material;
if (!material.materialComponents.isEmpty() && (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING) || material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_CENTRIFUGING))) {
// compute outputs
ArrayList<ItemStack> outputs = new ArrayList<>();
ArrayList<FluidStack> fluidOutputs = new ArrayList<>();
int totalInputAmount = 0;
for (MaterialStack component : material.materialComponents) {
totalInputAmount += component.amount;
if (component.material instanceof DustMaterial) {
outputs.add(OreDictUnifier.get(OrePrefix.dust, component.material, (int) component.amount));
} else if (component.material instanceof FluidMaterial) {
FluidMaterial componentMaterial = (FluidMaterial) component.material;
fluidOutputs.add(componentMaterial.getFluid((int) (GTValues.L * component.amount)));
}
}
// generate builder
RecipeBuilder builder;
if (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING)) {
builder = RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder().duration((int) material.getProtons() * totalInputAmount * 8).EUt(Math.min(4, material.materialComponents.size()) * 30);
} else {
builder = RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder().duration((int) material.getMass() * totalInputAmount * 2).EUt(30);
}
builder.outputs(outputs);
builder.fluidOutputs(fluidOutputs);
// finish builder
if (entry.orePrefix == OrePrefix.dust) {
builder.inputs(itemStack.asItemStack(totalInputAmount));
} else {
builder.fluidInputs(material.getFluid(GTValues.L * totalInputAmount));
}
// register recipe
builder.buildAndRegister();
}
}
}
use of gregtech.api.recipes.RecipeBuilder in project GregTech by GregTechCE.
the class ProcessingDirtyDust method registerOre.
// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
if (entry.material instanceof DustMaterial) {
DustMaterial material = (DustMaterial) entry.material;
ItemStack stack = itemStack.asItemStack();
ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
if (entry.orePrefix == OrePrefix.dustPure && material.separatedOnto != null) {
ItemStack separatedStack = OreDictUnifier.get(OrePrefix.dustSmall, material.separatedOnto);
RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).chancedOutput(separatedStack, 4000).duration((int) material.separatedOnto.getMass()).EUt(24).buildAndRegister();
}
int byProductIndex;
if (entry.orePrefix == OrePrefix.dustRefined) {
byProductIndex = 2;
} else if (entry.orePrefix == OrePrefix.dustPure) {
byProductIndex = 1;
} else
byProductIndex = 0;
FluidMaterial byproduct = GTUtility.selectItemInList(byProductIndex, material, material.oreByProducts, FluidMaterial.class);
RecipeBuilder builder = RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).duration((int) (material.getMass() * 4)).EUt(24);
if (byproduct instanceof DustMaterial) {
builder.outputs(OreDictUnifier.get(OrePrefix.dustTiny, byproduct));
} else {
builder.fluidOutputs(byproduct.getFluid(GTValues.L / 9));
}
builder.buildAndRegister();
}
}
Aggregations