• 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

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

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

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

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

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

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

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

46
        return sb;
×
47
    }
48

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

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

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

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

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

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

82
    @ToString
×
83
    public static class ValueIngredients extends ValueOptionalBase<IMixedIngredients> {
84

85
        private ValueIngredients(IMixedIngredients recipe) {
86
            super(ValueTypes.OBJECT_INGREDIENTS, recipe);
×
87
        }
×
88

89
        public static ValueIngredients of(IMixedIngredients recipe) {
90
            return new ValueIngredients(recipe);
×
91
        }
92

93
        @Override
94
        protected boolean isEqual(IMixedIngredients a, IMixedIngredients b) {
95
            return a.equals(b);
×
96
        }
97
    }
98

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