• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/core/evaluate/operator/PositionedOperatorRecipeHandlerOutput.java
1
package org.cyclops.integrateddynamics.core.evaluate.operator;
2

3
import com.google.common.cache.Cache;
4
import com.google.common.cache.CacheBuilder;
5
import net.minecraft.core.Direction;
6
import org.apache.commons.lang3.tuple.Pair;
7
import org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeHandler;
8
import org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients;
9
import org.cyclops.cyclopscore.datastructure.DimPos;
10
import org.cyclops.integrateddynamics.api.evaluate.EvaluationException;
11
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
12
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
13
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueObjectTypeIngredients;
14
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypes;
15

16
import java.util.concurrent.ExecutionException;
17
import java.util.concurrent.TimeUnit;
18

19
/**
20
 * An operator that gets the output of a recipe based on an input.
21
 * @author rubensworks
22
 */
23
public class PositionedOperatorRecipeHandlerOutput<T extends IValueType<V>, V extends IValue> extends PositionedOperatorRecipeHandler<T, V> {
24

25
    private static final Cache<Pair<Pair<DimPos, Direction>, ValueObjectTypeIngredients.ValueIngredients>,
26
            ValueObjectTypeIngredients.ValueIngredients> CACHE = CacheBuilder.newBuilder()
×
27
            .expireAfterAccess(20, TimeUnit.SECONDS).build();
×
28

29
    public PositionedOperatorRecipeHandlerOutput(DimPos pos, Direction side) {
30
        super("recipeoutputbyinput", new Function(), pos, side);
×
31
    }
×
32

33
    public PositionedOperatorRecipeHandlerOutput() {
34
        this(null, null);
×
35
    }
×
36

37
    public static class Function extends PositionedOperatorRecipeHandler.Function {
×
38

39
        @Override
40
        public IValue evaluate(SafeVariablesGetter variables) throws EvaluationException {
41
            ValueObjectTypeIngredients.ValueIngredients ingredients = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
×
42
            IRecipeHandler recipeHandler = (IRecipeHandler) this.getOperator().getRecipeHandler().orElse(null);
×
43
            if (recipeHandler != null && ingredients.getRawValue().isPresent()) {
×
44
                Pair<Pair<DimPos, Direction>, ValueObjectTypeIngredients.ValueIngredients> key =
×
45
                        Pair.of(Pair.of(this.getOperator().getPos(), this.getOperator().getSide()), ingredients);
×
46
                try {
47
                    return CACHE.get(key, () -> {
×
48
                        IMixedIngredients output = recipeHandler.simulate(ingredients.getRawValue().get());
×
49
                        return ValueObjectTypeIngredients.ValueIngredients.of(output);
×
50
                    });
51
                } catch (ExecutionException e) {
×
52

53
                }
54
            }
55
            return ValueObjectTypeIngredients.ValueIngredients.of(null);
×
56
        }
57
    }
58

59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc