• 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

24.32
/src/main/java/org/cyclops/integrateddynamics/core/evaluate/variable/ValueObjectTypeIngredients.java
1
package org.cyclops.integrateddynamics.core.evaluate.variable;
2

3
import net.minecraft.network.chat.Component;
4
import net.minecraft.network.chat.MutableComponent;
5
import net.minecraft.world.level.storage.ValueInput;
6
import net.minecraft.world.level.storage.ValueOutput;
7
import org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients;
8
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
9
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeNamed;
10
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeNullable;
11
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentHandler;
12
import org.cyclops.integrateddynamics.core.ingredient.IngredientComponentHandlers;
13
import org.cyclops.integrateddynamics.core.logicprogrammer.ValueTypeIngredientsLPElement;
14
import org.cyclops.integrateddynamics.core.logicprogrammer.ValueTypeLPElementBase;
15

16
/**
17
 * Value type with values that are ingredients.
18
 * @author rubensworks
19
 */
20
public class ValueObjectTypeIngredients extends ValueObjectTypeBase<ValueObjectTypeIngredients.ValueIngredients> implements
21
        IValueTypeNamed<ValueObjectTypeIngredients.ValueIngredients>, IValueTypeNullable<ValueObjectTypeIngredients.ValueIngredients> {
22

23
    public ValueObjectTypeIngredients() {
24
        super("ingredients", ValueObjectTypeIngredients.ValueIngredients.class);
4✔
25
    }
1✔
26

27
    @Override
28
    public ValueIngredients getDefault() {
29
        return ValueIngredients.of(null);
×
30
    }
31

32
    public static MutableComponent ingredientsToTextComponent(IMixedIngredients ingredients) {
33
        MutableComponent sb = Component.literal("");
×
34

35
        for (IngredientComponent<?, ?> component : ingredients.getComponents()) {
×
36
            IIngredientComponentHandler handler = IngredientComponentHandlers.REGISTRY.getComponentHandler(component);
×
37
            for (Object instance : ingredients.getInstances(component)) {
×
38
                if (sb.getSiblings().size() > 0) {
×
39
                    sb.append(Component.literal(", "));
×
40
                }
41
                sb.append(handler.toCompactString(handler.toValue(instance)));
×
42
            }
×
43
        }
×
44

45
        return sb;
×
46
    }
47

48
    @Override
49
    public MutableComponent toCompactString(ValueIngredients value) {
50
        if (value.getRawValue().isPresent()) {
×
51
            return ingredientsToTextComponent(value.getRawValue().get());
×
52
        }
53
        return Component.literal("");
×
54
    }
55

56
    @Override
57
    public void serialize(ValueOutput valueOutput, ValueIngredients value) {
58
        value.getRawValue().ifPresent(v -> IMixedIngredients.serialize(valueOutput.child("v"), v));
11✔
59
    }
1✔
60

61
    @Override
62
    public ValueIngredients deserialize(ValueInput valueInput) {
63
        return ValueIngredients.of(valueInput.child("v").map(IMixedIngredients::deserialize).orElse(null));
10✔
64
    }
65

66
    @Override
67
    public String getName(ValueIngredients a) {
68
        return toCompactString(a).getString();
×
69
    }
70

71
    @Override
72
    public boolean isNull(ValueIngredients a) {
73
        return !a.getRawValue().isPresent();
×
74
    }
75

76
    @Override
77
    public ValueTypeLPElementBase createLogicProgrammerElement() {
78
        return new ValueTypeIngredientsLPElement();
×
79
    }
80

81
    public static class ValueIngredients extends ValueOptionalBase<IMixedIngredients> {
82

83
        private ValueIngredients(IMixedIngredients recipe) {
84
            super(ValueTypes.OBJECT_INGREDIENTS, recipe);
4✔
85
        }
1✔
86

87
        public static ValueIngredients of(IMixedIngredients recipe) {
88
            return new ValueIngredients(recipe);
5✔
89
        }
90

91
        @Override
92
        protected boolean isEqual(IMixedIngredients a, IMixedIngredients b) {
93
            return a.equals(b);
4✔
94
        }
95

96
        @Override
97
        public String toString() {
98
            return "ValueIngredients()";
×
99
        }
100
    }
101

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