use of gregtech.api.unification.material.type.FluidMaterial 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.unification.material.type.FluidMaterial in project GregTech by GregTechCE.
the class ProcessingPlate method registerOre.
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
ItemStack stack = simpleStack.asItemStack();
boolean noSmashing = entry.material.hasFlag(NO_SMASHING);
long materialMass = entry.material.getMass();
switch(entry.orePrefix) {
case plate:
if (entry.material instanceof FluidMaterial) {
RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(MetaItems.SHAPE_MOLD_PLATE).fluidInputs(((FluidMaterial) entry.material).getFluid(L)).outputs(OreDictUnifier.get(OrePrefix.plate, entry.material)).duration(32).EUt(8).buildAndRegister();
}
RecipeMap.IMPLOSION_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(2, stack)).explosivesAmount(2).outputs(OreDictUnifier.get(OrePrefix.compressed, entry.material), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh)).buildAndRegister();
if (entry.material == Materials.Paper)
ModHandler.addShapedRecipe("papar_f_scane_" + entry.material, GTUtility.copyAmount(3, stack), "XXX", 'X', new ItemStack(Items.REEDS, 1, W));
if (!noSmashing) {
ModHandler.addShapedRecipe("ingot_t_plate_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "h", "X", "X", 'X', new UnificationEntry(OrePrefix.ingot, entry.material));
ModHandler.addShapedRecipe("ingot_t_plate_od_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', new UnificationEntry(OrePrefix.ingot, entry.material));
ModHandler.addShapedRecipe("gem_t_plate_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "h", "X", 'X', new UnificationEntry(OrePrefix.gem, entry.material));
ModHandler.addShapedRecipe("gem_t_plate_od_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', new UnificationEntry(OrePrefix.gem, entry.material));
}
if (entry.material.hasFlag(MORTAR_GRINDABLE))
ModHandler.addShapedRecipe("plate_t_dust_" + entry.material, OreDictUnifier.get(OrePrefix.dust, entry.material), "X", "m", 'X', new UnificationEntry(OrePrefix.plate, entry.material));
break;
case plateDense:
if (!noSmashing) {
RecipeMap.BENDER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.plate, entry.material, 9)).outputs(GTUtility.copyAmount(1, stack)).duration((int) Math.max(materialMass * 9L, 1L)).EUt(96).buildAndRegister();
}
break;
}
}
use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.
the class ArcFurnaceRecipeBuilder method buildAndRegister.
@Override
public void buildAndRegister() {
if (fluidInputs.isEmpty()) {
fluidInputs(Materials.Oxygen.getFluid(this.duration));
for (FluidMaterial material : new FluidMaterial[] { Materials.Argon, Materials.Nitrogen }) {
int plasmaAmount = (int) Math.max(1L, this.duration / (material.getAverageMass() * 16L));
SimpleRecipeBuilder builder = RecipeMaps.PLASMA_ARC_FURNACE_RECIPES.recipeBuilder().inputsIngredients(this.inputs).outputs(this.outputs).duration(Math.max(1, this.duration / 16)).EUt(this.EUt / 3).fluidInputs(material.getPlasma(plasmaAmount)).fluidOutputs(material.getFluid(plasmaAmount));
builder.buildAndRegister();
}
}
super.buildAndRegister();
}
use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.
the class DecompositionRecipeHandler method runRecipeGeneration.
public static void runRecipeGeneration() {
for (Material material : Material.MATERIAL_REGISTRY) {
if (material instanceof FluidMaterial) {
OrePrefix prefix = material instanceof DustMaterial ? OrePrefix.dust : null;
processDecomposition(prefix, (FluidMaterial) material);
}
}
}
use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.
the class WireRecipeHandler method generateWireRecipe.
public static void generateWireRecipe(OrePrefix wirePrefix, IngotMaterial material) {
int cableAmount = (int) (wirePrefix.materialAmount * 2 / M);
OrePrefix cablePrefix = OrePrefix.valueOf("cable" + wirePrefix.name().substring(4));
ItemStack cableStack = OreDictUnifier.get(cablePrefix, material);
if (material.cableProperties == null)
return;
if (isPaperInsulatedCable(material)) {
if (cableAmount <= 7) {
Object[] ingredients = new Object[2 + cableAmount];
ingredients[0] = new UnificationEntry(wirePrefix, material);
ingredients[ingredients.length - 1] = OreDictNames.string;
for (int i = 1; i < ingredients.length - 1; i++) {
ingredients[i] = new ItemStack(Blocks.CARPET, 1, EnumDyeColor.BLACK.getMetadata());
}
ModHandler.addShapelessRecipe(String.format("%s_cable_%d", material, cableAmount), cableStack, ingredients);
}
}
if (isPaperInsulatedCable(material)) {
ItemStack carpetStack = new ItemStack(Blocks.CARPET, cableAmount, EnumDyeColor.BLACK.getMetadata());
RecipeMaps.PACKER_RECIPES.recipeBuilder().input(wirePrefix, material).inputs(carpetStack).outputs(cableStack).duration(100).EUt(8).buildAndRegister();
}
for (FluidMaterial insulationMaterial : INSULATION_MATERIALS.keySet()) {
int cableTier = GTUtility.getTierByVoltage(material.cableProperties.voltage);
int materialAmount = getMaterialAmount(cableTier, INSULATION_MATERIALS.get(insulationMaterial));
if (materialAmount == -1)
continue;
if (wirePrefix != OrePrefix.wireGtSingle) {
RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(OrePrefix.wireGtSingle, material, cableAmount).circuitMeta(24 + ArrayUtils.indexOf(WIRE_DOUBLING_ORDER, wirePrefix)).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
}
RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(wirePrefix, material).circuitMeta(24).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
}
}
Aggregations