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

CyclopsMC / IntegratedDynamics / 18042102834

26 Sep 2025 03:25PM UTC coverage: 44.791% (-0.1%) from 44.905%
18042102834

push

github

rubensworks
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21-lts

2572 of 8540 branches covered (30.12%)

Branch coverage included in aggregate %.

11761 of 23460 relevant lines covered (50.13%)

2.38 hits per line

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

27.59
/src/main/java/org/cyclops/integrateddynamics/infobook/OnTheDynamicsOfIntegrationBook.java
1
package org.cyclops.integrateddynamics.infobook;
2

3
import com.google.common.base.Function;
4
import com.google.common.collect.Lists;
5
import net.minecraft.resources.ResourceLocation;
6
import org.cyclops.cyclopscore.infobook.IInfoBook;
7
import org.cyclops.cyclopscore.infobook.InfoBook;
8
import org.cyclops.cyclopscore.infobook.InfoBookParser;
9
import org.cyclops.cyclopscore.infobook.pageelement.SectionAppendix;
10
import org.cyclops.integrateddynamics.IntegratedDynamics;
11
import org.cyclops.integrateddynamics.Reference;
12
import org.cyclops.integrateddynamics.RegistryEntries;
13
import org.cyclops.integrateddynamics.api.evaluate.operator.IOperator;
14
import org.cyclops.integrateddynamics.api.part.IPartType;
15
import org.cyclops.integrateddynamics.api.part.aspect.IAspect;
16
import org.cyclops.integrateddynamics.core.evaluate.operator.Operators;
17
import org.cyclops.integrateddynamics.core.part.PartTypes;
18
import org.cyclops.integrateddynamics.infobook.pageelement.*;
19
import org.cyclops.integrateddynamics.part.aspect.Aspects;
20
import org.w3c.dom.Element;
21

22
import javax.annotation.Nullable;
23
import java.util.List;
24

25
/**
26
 * Infobook class for the On the Dynamics of Integration.
27
 * @author rubensworks
28
 */
29
public class OnTheDynamicsOfIntegrationBook extends InfoBook {
30

31
    private static OnTheDynamicsOfIntegrationBook _instance = null;
2✔
32

33
    static {
34
        InfoBookParser.registerAppendixRecipeFactories(RegistryEntries.RECIPETYPE_SQUEEZER.get(), SqueezerRecipeAppendix::new);
5✔
35
        InfoBookParser.registerAppendixRecipeFactories(RegistryEntries.RECIPETYPE_MECHANICAL_SQUEEZER.get(), MechanicalSqueezerRecipeAppendix::new);
5✔
36
        InfoBookParser.registerAppendixRecipeFactories(RegistryEntries.RECIPETYPE_DRYING_BASIN.get(), DryingBasinRecipeAppendix::new);
5✔
37
        InfoBookParser.registerAppendixRecipeFactories(RegistryEntries.RECIPETYPE_MECHANICAL_DRYING_BASIN.get(), MechanicalDryingBasinRecipeAppendix::new);
5✔
38

39
        InfoBookParser.registerAppendixFactory(Reference.MOD_ID + ":aspect", new InfoBookParser.IAppendixFactory() {
8✔
40
            @Override
41
            public SectionAppendix create(IInfoBook infoBook, Element node) throws InfoBookParser.InvalidAppendixException {
42
                String aspectName = node.getTextContent();
×
43
                IAspect aspect = Aspects.REGISTRY.getAspect(ResourceLocation.parse(aspectName));
×
44
                if (aspect == null) {
×
45
                    throw new InfoBookParser.InvalidAppendixException(String.format("Could not find an aspect by name %s.", aspectName));
×
46
                }
47
                return new AspectAppendix(infoBook, aspect);
×
48
            }
49
        });
50

51
        InfoBookParser.registerAppendixListFactory(Reference.MOD_ID + ":part_aspects", new InfoBookParser.IAppendixListFactory() {
8✔
52
            @Override
53
            public List<SectionAppendix> create(final IInfoBook infoBook, Element node) throws InfoBookParser.InvalidAppendixException {
54
                String partName = node.getTextContent();
×
55
                IPartType partType = PartTypes.REGISTRY.getPartType(ResourceLocation.parse(partName));
×
56
                if (partType == null) {
×
57
                    throw new InfoBookParser.InvalidAppendixException(String.format("Could not find a part type by name '%s'.", partName));
×
58
                }
59
                List<IAspect> aspects = Lists.newArrayList(Aspects.REGISTRY.getAspects(partType));
×
60
                return Lists.transform(aspects, new Function<IAspect, SectionAppendix>() {
×
61
                    @Nullable
62
                    @Override
63
                    public SectionAppendix apply(IAspect input) {
64
                        return new AspectAppendix(infoBook, input);
×
65
                    }
66
                });
67
            }
68
        });
69

70
        InfoBookParser.registerAppendixFactory(Reference.MOD_ID + ":operator", new InfoBookParser.IAppendixFactory() {
8✔
71
            @Override
72
            public SectionAppendix create(IInfoBook infoBook, Element node) throws InfoBookParser.InvalidAppendixException {
73
                String operatorName = node.getTextContent();
×
74
                IOperator operator = Operators.REGISTRY.getOperator(ResourceLocation.parse(operatorName));
×
75
                if (operator == null) {
×
76
                    throw new InfoBookParser.InvalidAppendixException(String.format("Could not find an operator by name %s.", operatorName));
×
77
                }
78
                return new OperatorAppendix(infoBook, operator);
×
79
            }
80
        });
81

82
        InfoBookParser.registerAppendixListFactory(Reference.MOD_ID + ":operators_output", new InfoBookParser.IAppendixListFactory() {
8✔
83
            @Override
84
            public List<SectionAppendix> create(final IInfoBook infoBook, Element node) throws InfoBookParser.InvalidAppendixException {
85
                String categoryName = node.getTextContent();
×
86
                List<IOperator> operators = Lists.newArrayList("*".equals(categoryName) ? Operators.REGISTRY.getOperators() : Operators.REGISTRY.getOperatorsInCategory(categoryName));
×
87
                if (operators.isEmpty()) {
×
88
                    operators = Lists.newArrayList();
×
89
                    for (IOperator operator : Operators.REGISTRY.getOperators()) {
×
90
                        if (operator.getUniqueName().toString().matches(categoryName)) {
×
91
                            operators.add(operator);
×
92
                        }
93
                    }
×
94
                }
95
                return Lists.transform(operators, new Function<IOperator, SectionAppendix>() {
×
96
                    @Nullable
97
                    @Override
98
                    public SectionAppendix apply(IOperator input) {
99
                        return new OperatorAppendix(infoBook, input);
×
100
                    }
101
                });
102
            }
103
        });
104
    }
1✔
105

106
    private OnTheDynamicsOfIntegrationBook() {
107
        super(IntegratedDynamics._instance, 2, Reference.BOOK_URL);
5✔
108
    }
1✔
109

110
    public static synchronized OnTheDynamicsOfIntegrationBook getInstance() {
111
        if(_instance == null) {
2!
112
            _instance = new OnTheDynamicsOfIntegrationBook();
4✔
113
        }
114
        return _instance;
2✔
115
    }
116
}
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