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

CyclopsMC / IntegratedDynamics / 22186773560

19 Feb 2026 02:52PM UTC coverage: 52.603% (+0.2%) from 52.363%
22186773560

push

github

web-flow
Remove Lombok dependency (#1604)

2911 of 8664 branches covered (33.6%)

Branch coverage included in aggregate %.

17683 of 30486 relevant lines covered (58.0%)

3.01 hits per line

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

16.07
/src/main/java/org/cyclops/integrateddynamics/core/evaluate/variable/ValueObjectTypeRecipe.java
1
package org.cyclops.integrateddynamics.core.evaluate.variable;
2

3
import com.google.common.collect.Iterables;
4
import com.google.gson.JsonParseException;
5
import net.minecraft.network.chat.Component;
6
import net.minecraft.network.chat.MutableComponent;
7
import net.minecraft.world.level.storage.ValueInput;
8
import net.minecraft.world.level.storage.ValueOutput;
9
import org.cyclops.commoncapabilities.api.capability.recipehandler.IPrototypedIngredientAlternatives;
10
import org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition;
11
import org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient;
12
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
13
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
14
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeNamed;
15
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeNullable;
16
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentHandler;
17
import org.cyclops.integrateddynamics.core.ingredient.IngredientComponentHandlers;
18
import org.cyclops.integrateddynamics.core.logicprogrammer.ValueTypeLPElementBase;
19
import org.cyclops.integrateddynamics.core.logicprogrammer.ValueTypeRecipeLPElement;
20

21
/**
22
 * Value type with values that are recipes.
23
 * @author rubensworks
24
 */
25
public class ValueObjectTypeRecipe extends ValueObjectTypeBase<ValueObjectTypeRecipe.ValueRecipe> implements
26
        IValueTypeNamed<ValueObjectTypeRecipe.ValueRecipe>, IValueTypeNullable<ValueObjectTypeRecipe.ValueRecipe> {
27

28
    public ValueObjectTypeRecipe() {
29
        super("recipe", ValueObjectTypeRecipe.ValueRecipe.class);
4✔
30
    }
1✔
31

32
    @Override
33
    protected ValueObjectTypeRecipeClient constructClient() {
34
        return new ValueObjectTypeRecipeClient(this);
×
35
    }
36

37
    @Override
38
    public ValueRecipe getDefault() {
39
        return ValueRecipe.of(null);
×
40
    }
41

42
    @Override
43
    public MutableComponent toCompactString(ValueRecipe value) {
44
        if (value.getRawValue().isPresent()) {
×
45
            IRecipeDefinition recipe = value.getRawValue().get();
×
46
            MutableComponent sb = Component.literal("");
×
47

48
            sb.append(ValueObjectTypeIngredients.ingredientsToTextComponent(recipe.getOutput()));
×
49
            sb.append(Component.literal(" <- "));
×
50
            boolean first = true;
×
51

52
            for (IngredientComponent<?, ?> component : recipe.getInputComponents()) {
×
53
                IIngredientComponentHandler handler = IngredientComponentHandlers.REGISTRY.getComponentHandler(component);
×
54
                int i = 0;
×
55
                for (IPrototypedIngredientAlternatives<?, ?> instances : recipe.getInputs(component)) {
×
56
                    IPrototypedIngredient<?, ?> prototypedIngredient = Iterables.getFirst(instances.getAlternatives(), null);
×
57
                    IValue v;
58
                    if (prototypedIngredient == null) {
×
59
                        v  = handler.getValueType().getDefault();
×
60
                    } else {
61
                        v = handler.toValue(prototypedIngredient.getPrototype());
×
62
                    }
63
                    if (!first) {
×
64
                        sb.append(Component.literal(", "));
×
65
                    } else {
66
                        first = false;
×
67
                    }
68
                    sb.append(handler.toCompactString(v));
×
69
                    if (recipe.isInputReusable(component, i)) {
×
70
                        sb.append("*");
×
71
                    }
72
                    i++;
×
73
                }
×
74
            }
×
75
            return sb;
×
76
        }
77
        return Component.literal("");
×
78
    }
79

80
    @Override
81
    public void serialize(ValueOutput valueOutput, ValueRecipe value) {
82
        value.getRawValue().ifPresent(v -> IRecipeDefinition.serialize(valueOutput.child("v"), v));
11✔
83
    }
1✔
84

85
    @Override
86
    public ValueRecipe deserialize(ValueInput valueInput) {
87
        try {
88
            return ValueRecipe.of(valueInput.child("v").map(IRecipeDefinition::deserialize).orElse(null));
10✔
89
        } catch (IllegalArgumentException | JsonParseException e) {
×
90
            return ValueRecipe.of(null);
×
91
        }
92
    }
93

94
    @Override
95
    public String getName(ValueRecipe a) {
96
        return toCompactString(a).getString();
×
97
    }
98

99
    @Override
100
    public boolean isNull(ValueRecipe a) {
101
        return !a.getRawValue().isPresent();
×
102
    }
103

104
    @Override
105
    public ValueTypeLPElementBase createLogicProgrammerElement() {
106
        return new ValueTypeRecipeLPElement();
×
107
    }
108

109
    public static class ValueRecipe extends ValueOptionalBase<IRecipeDefinition> {
110

111
        private ValueRecipe(IRecipeDefinition recipe) {
112
            super(ValueTypes.OBJECT_RECIPE, recipe);
4✔
113
        }
1✔
114

115
        public static ValueRecipe of(IRecipeDefinition recipe) {
116
            return new ValueRecipe(recipe);
5✔
117
        }
118

119
        @Override
120
        protected boolean isEqual(IRecipeDefinition a, IRecipeDefinition b) {
121
            return a.equals(b);
4✔
122
        }
123

124
        @Override
125
        public String toString() {
126
            return "ValueRecipe()";
×
127
        }
128
    }
129

130
}
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