#Allow multiple different fluids in a recipe

1 messages · Page 1 of 1 (latest)

frank dragon
#
public static @NotNull ModifierFunction greenhouseOverclock(@NotNull MetaMachine machine,
                                                                @NotNull GTRecipe recipe) {
        if (!(machine instanceof GreenhouseMultiblockMachine greenhouseMachine)) {
            return RecipeModifier.nullWrongType(GreenhouseMultiblockMachine.class, machine);
        }
        int greenhouseSoilTier = greenhouseMachine.getSoilTier();
        int greenhouseVoltageTier = greenhouseMachine.getTier();

        if (!recipe.data.contains("min_soil_tier") || recipe.data.getInt("min_soil_tier") > greenhouseSoilTier) {
            return ModifierFunction.NULL;
        }

        if (RecipeHelper.getRecipeEUtTier(recipe) - MV > greenhouseSoilTier) {
            return ModifierFunction.NULL;
        }

        if (RecipeHelper.getRecipeEUtTier(recipe) > greenhouseVoltageTier) {
            return ModifierFunction.NULL;
        }

        int recipeTier = recipe.data.getInt("min_soil_tier");
        int tierDifference = greenhouseSoilTier - recipeTier;

        float eutModifier = (float) (Math.pow(4, tierDifference));
        double outputModifier = 4 * tierDifference;

        int amendedRecipeTier = greenhouseVoltageTier -
                GTUtil.getTierByVoltage((long) (RecipeHelper.getInputEUt(recipe) * eutModifier));

        eutModifier *= (float) Math.pow(4, amendedRecipeTier) *
                greenhouseMachine.getGlassType().getEnergyDiscount();

        double durationModifier = 1 / Math.pow(2, amendedRecipeTier);
        durationModifier = durationModifier / greenhouseMachine.getAverageSpeedBoost();


        return ModifierFunction.builder()
                .durationMultiplier(durationModifier)
                .outputModifier(ContentModifier.multiplier(outputModifier))
                .eutMultiplier(eutModifier)
                .build();
    }
#

This is my current recipe modifier for my greenhouse multiblock, the recipe currently has no fluid defined, I have an array of the fluids

public static Material[] GrowthMediums = new Material[] { Water, Tier1GrowthFluid, Tier2GrowthFluid,
            Tier3GrowthFluid, Tier4GrowthFluid, Tier5GrowthFluid };

I need the fluid

GrowthMediums[ greenhouseSoilTier ]

to be consumed when it runs? Is this possible inside of a recipe Modifier or do I need to go back yo dynamic recipe generation

frosty hare
#

Recipe condition is the intended qay

#

You have the recipe contain that tier of growth stuff and add a condition saying the recipe needs X soil tier