use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class OreRecipeHandler method processDirtyDust.
public static void processDirtyDust(OrePrefix dustPrefix, Material material, OreProperty property) {
ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
Material byproduct = GTUtility.selectItemInList(0, material, property.getOreByProducts(), Material.class);
RecipeBuilder<?> builder = RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().input(dustPrefix, material).outputs(dustStack).duration((int) (material.getMass() * 4)).EUt(24);
if (byproduct.hasProperty(PropertyKey.DUST)) {
builder.outputs(OreDictUnifier.get(OrePrefix.dustTiny, byproduct));
} else {
builder.fluidOutputs(byproduct.getFluid(GTValues.L / 9));
}
builder.buildAndRegister();
RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(dustPrefix, material).notConsumable(new IntCircuitIngredient(2)).fluidInputs(Materials.Water.getFluid(100)).outputs(dustStack).duration(8).EUt(4).buildAndRegister();
// dust gains same amount of material as normal dust
processMetalSmelting(dustPrefix, material, property);
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class PolarizingRecipeHandler method processPolarizing.
public static void processPolarizing(OrePrefix polarizingPrefix, Material material, IngotProperty property) {
Material magneticMaterial = property.getMagneticMaterial();
if (magneticMaterial != null && polarizingPrefix.doGenerateItem(magneticMaterial)) {
ItemStack magneticStack = OreDictUnifier.get(polarizingPrefix, magneticMaterial);
// polarizing
RecipeMaps.POLARIZER_RECIPES.recipeBuilder().input(polarizingPrefix, material).outputs(magneticStack).duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / GTValues.M)).EUt(8 * getVoltageMultiplier(material)).buildAndRegister();
ModHandler.addSmeltingRecipe(new UnificationEntry(polarizingPrefix, magneticMaterial), // de-magnetizing
OreDictUnifier.get(polarizingPrefix, material));
}
}
use of gregtech.api.unification.material.Material in project gregicality-science by GregTechCEu.
the class BouleRecipeHandler method processCrystallizer.
public static void processCrystallizer(OrePrefix gem, @Nonnull Material material, GemProperty property) {
// Not crystallizable materials cannot be made into boules
if (!material.hasFlag(MaterialFlags.CRYSTALLIZABLE) || material.hasFlag(GCYSMaterialFlags.DISABLE_CRYSTALLIZATION))
return;
BlastRecipeBuilder builder = GCYSRecipeMaps.CRYSTALLIZER_RECIPES.recipeBuilder();
builder.input(GCYSOrePrefix.seedCrystal, material);
// -1 for the not consumable input
if (material.getMaterialComponents().size() > GCYSRecipeMaps.CRYSTALLIZER_RECIPES.getMaxInputs() - 1 + GCYSRecipeMaps.CRYSTALLIZER_RECIPES.getMaxFluidInputs())
return;
int componentAmount = 0;
int temperature = 0;
List<ItemStack> inputs = new ArrayList<>();
List<FluidStack> fluidInputs = new ArrayList<>();
for (MaterialStack materialStack : material.getMaterialComponents()) {
Material componentMaterial = materialStack.material;
int amount = (int) materialStack.amount;
if (componentMaterial.isSolid() || componentMaterial.hasProperty(PropertyKey.DUST)) {
componentAmount += amount;
temperature += componentMaterial.getBlastTemperature() * amount;
// if there are too many item inputs, do not make a recipe
if (inputs.size() > GCYSRecipeMaps.CRYSTALLIZER_RECIPES.getMaxInputs() - 1)
return;
inputs.add(OreDictUnifier.get(OrePrefix.dust, componentMaterial, amount));
} else if (componentMaterial.hasProperty(PropertyKey.FLUID)) {
componentAmount += amount;
if (fluidInputs.size() > GCYSRecipeMaps.CRYSTALLIZER_RECIPES.getMaxFluidInputs())
return;
fluidInputs.add(componentMaterial.getFluid(amount * 1000));
}
// materials with no blast temperature are treated as having 1200K
if (!componentMaterial.hasProperty(PropertyKey.BLAST)) {
temperature += 1200 * amount;
}
}
// just in case, prevent division by zero
if (componentAmount == 0)
return;
// Average Temperature for the recipe
temperature /= componentAmount;
builder.blastFurnaceTemp(temperature);
// use temperature to determine the EUt
builder.EUt(VA[temperature <= 2800 ? HV : GTValues.EV]);
boolean shouldMultiply = false;
if (componentAmount % 4 == 0) {
// since boules are equivalent to 4 items, output doesn't need multiplication
builder.output(GCYSOrePrefix.boule, material, componentAmount / 4);
} else {
// Multiplying the entire recipe by 4 for even amounts of boules
builder.output(GCYSOrePrefix.boule, material, componentAmount);
shouldMultiply = true;
}
if (shouldMultiply) {
for (ItemStack stack : inputs) {
stack.setCount(stack.getCount() * 4);
}
for (FluidStack stack : fluidInputs) {
stack.amount *= 4;
}
builder.duration((int) (material.getMass() * 4 * 4));
} else {
builder.duration((int) (material.getMass() * 4));
}
// Add the fluid and item inputs, then build the recipe
if (!inputs.isEmpty())
builder.inputs(inputs);
if (!fluidInputs.isEmpty())
builder.fluidInputs(fluidInputs);
builder.buildAndRegister();
// Cut boules into one exquisite gem
RecipeMaps.CUTTER_RECIPES.recipeBuilder().input(GCYSOrePrefix.boule, material).output(OrePrefix.gemExquisite, material).output(GCYSOrePrefix.seedCrystal, material).duration((int) (material.getMass() * 4)).EUt(16).buildAndRegister();
// Create Seed Crystals in an autoclave
RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder().input(OrePrefix.gemExquisite, material).fluidInputs(Materials.DistilledWater.getFluid(8000)).output(GCYSOrePrefix.seedCrystal, material).duration((int) (material.getMass() * 9)).EUt(VA[HV]).buildAndRegister();
}
use of gregtech.api.unification.material.Material in project GregTechFoodOption by bruberu.
the class GTFOMetaTool method registerRecipes.
public void registerRecipes() {
Material[] rollingPinMaterials = new Material[] { Materials.Wood, Materials.Rubber, Materials.Polyethylene, Materials.Polytetrafluoroethylene };
for (int i = 0; i < rollingPinMaterials.length; i++) {
Material solidMaterial = rollingPinMaterials[i];
ItemStack itemStack = GTFOMetaItem.ROLLING_PIN.getStackForm();
GTFOMetaItem.ROLLING_PIN.setToolData(itemStack, solidMaterial, 128 * (1 << i), 1, 1.0f, 1f);
if (i != 0)
ModHandler.addShapedRecipe(String.format("rolling_pin_%s", solidMaterial.toString()), itemStack, " R", " I ", "R f", 'I', new UnificationEntry(OrePrefix.ingot, solidMaterial), 'R', new UnificationEntry(OrePrefix.stick, Materials.Iron));
else
ModHandler.addShapedRecipe("rolling_pin_wood", itemStack, " R", " P ", "R f", 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood), 'R', new UnificationEntry(OrePrefix.stick, Materials.Iron));
}
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class RecyclingRecipes method registerExtractorRecycling.
private static void registerExtractorRecycling(ItemStack input, List<MaterialStack> materials, int multiplier, @Nullable OrePrefix prefix) {
// Handle simple materials separately
if (prefix != null && prefix.secondaryMaterials.isEmpty()) {
MaterialStack ms = OreDictUnifier.getMaterial(input);
if (ms == null || ms.material == null) {
return;
}
Material m = ms.material;
if (m.hasProperty(PropertyKey.INGOT) && m.getProperty(PropertyKey.INGOT).getMacerateInto() != m) {
m = m.getProperty(PropertyKey.INGOT).getMacerateInto();
}
if (!m.hasProperty(PropertyKey.FLUID) || (prefix == OrePrefix.dust && m.hasProperty(PropertyKey.BLAST))) {
return;
}
RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder().inputs(input.copy()).fluidOutputs(m.getFluid((int) (ms.amount * L / M))).duration((int) Math.max(1, ms.amount * ms.material.getMass() / M)).EUt(GTValues.VA[GTValues.LV] * multiplier).buildAndRegister();
return;
}
// Find the first Material which can create a Fluid.
// If no Material in the list can create a Fluid, return.
MaterialStack fluidMs = materials.stream().filter(ms -> ms.material.hasProperty(PropertyKey.FLUID)).findFirst().orElse(null);
if (fluidMs == null)
return;
// Find the next MaterialStack, which will be the Item output.
// This can sometimes be before the Fluid output in the list, so we have to
// assume it can be anywhere in the list.
MaterialStack itemMs = materials.stream().filter(ms -> !ms.material.equals(fluidMs.material)).findFirst().orElse(null);
// Calculate the duration based off of those two possible outputs.
// - Sum the two Material amounts together (if both exist)
// - Divide the sum by M
long duration = fluidMs.amount * fluidMs.material.getMass();
if (itemMs != null)
duration += (itemMs.amount * itemMs.material.getMass());
duration = Math.max(1L, duration / M);
// Build the final Recipe.
RecipeBuilder<?> extractorBuilder = RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder().inputs(input.copy()).fluidOutputs(fluidMs.material.getFluid((int) (fluidMs.amount * L / M))).duration((int) duration).EUt(GTValues.VA[GTValues.LV] * multiplier);
// - Try to output an Ingot, otherwise output a Dust.
if (itemMs != null) {
OrePrefix outputPrefix = itemMs.material.hasProperty(PropertyKey.INGOT) ? OrePrefix.ingot : OrePrefix.dust;
extractorBuilder.output(outputPrefix, itemMs.material, (int) (itemMs.amount / M));
}
extractorBuilder.buildAndRegister();
}
Aggregations