• 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

21.67
/src/main/java/org/cyclops/integrateddynamics/core/path/Cluster.java
1
package org.cyclops.integrateddynamics.core.path;
2

3
import com.google.common.collect.Lists;
4
import com.google.common.collect.Sets;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.core.Direction;
7
import net.minecraft.core.registries.Registries;
8
import net.minecraft.resources.ResourceKey;
9
import net.minecraft.resources.Identifier;
10
import net.minecraft.world.level.Level;
11
import net.neoforged.neoforge.server.ServerLifecycleHooks;
12
import org.cyclops.cyclopscore.helper.IModHelpersNeoForge;
13
import org.cyclops.integrateddynamics.Capabilities;
14
import org.cyclops.integrateddynamics.IntegratedDynamics;
15
import org.cyclops.integrateddynamics.api.path.IPathElement;
16
import org.cyclops.integrateddynamics.api.path.ISidedPathElement;
17
import org.cyclops.integrateddynamics.api.path.SidedPathElementParams;
18
import org.cyclops.integrateddynamics.capability.path.SidedPathElement;
19

20
import java.util.*;
21

22
/**
23
 * A cluster for a collection of path elements.
24
 * @author rubensworks
25
 */
26
public class Cluster implements Collection<ISidedPathElement> {
27

28
    private final Set<ISidedPathElement> elements;
29

30
    /**
31
     * This constructor should not be called, except for the process of constructing networks from NBT.
32
     */
33
    public Cluster() {
×
34
        this.elements = Sets.newTreeSet();
×
35
    }
×
36

37
    public Cluster(TreeSet<ISidedPathElement> elements) {
2✔
38
        this.elements = elements;
3✔
39
    }
1✔
40

41
    public Set<ISidedPathElement> getElements() {
42
        return elements;
×
43
    }
44

45
    @Override
46
    public boolean equals(Object o) {
47
        if (this == o) return true;
×
48
        if (o == null || getClass() != o.getClass()) return false;
×
49
        Cluster that = (Cluster) o;
×
50
        return Objects.equals(elements, that.elements);
×
51
    }
52

53
    @Override
54
    public int hashCode() {
55
        return Objects.hash(elements);
×
56
    }
57

58
    @Override
59
    public String toString() {
60
        return "Cluster{" +
×
61
                "elements=" + elements +
62
                '}';
63
    }
64

65
    // Delegate methods to elements Set
66
    @Override
67
    public int size() {
68
        return elements.size();
×
69
    }
70

71
    @Override
72
    public boolean isEmpty() {
73
        return elements.isEmpty();
4✔
74
    }
75

76
    @Override
77
    public boolean contains(Object o) {
78
        return elements.contains(o);
×
79
    }
80

81
    @Override
82
    public Iterator<ISidedPathElement> iterator() {
83
        return elements.iterator();
4✔
84
    }
85

86
    @Override
87
    public Object[] toArray() {
88
        return elements.toArray();
×
89
    }
90

91
    @Override
92
    public <T> T[] toArray(T[] a) {
93
        return elements.toArray(a);
×
94
    }
95

96
    @Override
97
    public boolean add(ISidedPathElement iSidedPathElement) {
98
        return elements.add(iSidedPathElement);
×
99
    }
100

101
    @Override
102
    public boolean remove(Object o) {
103
        return elements.remove(o);
5✔
104
    }
105

106
    @Override
107
    public boolean containsAll(Collection<?> c) {
108
        return elements.containsAll(c);
×
109
    }
110

111
    @Override
112
    public boolean addAll(Collection<? extends ISidedPathElement> c) {
113
        return elements.addAll(c);
×
114
    }
115

116
    @Override
117
    public boolean removeAll(Collection<?> c) {
118
        return elements.removeAll(c);
×
119
    }
120

121
    @Override
122
    public boolean retainAll(Collection<?> c) {
123
        return elements.retainAll(c);
×
124
    }
125

126
    @Override
127
    public void clear() {
128
        elements.clear();
×
129
    }
×
130

131
    public void fromParams(List<SidedPathElementParams> pathElements) {
132
        for (SidedPathElementParams pathElementParam : pathElements) {
×
133
            Identifier dimensionId = Identifier.parse(pathElementParam.dimension());
×
134
            ResourceKey<Level> dimension = ResourceKey.create(Registries.DIMENSION, dimensionId);
×
135
            Level world = ServerLifecycleHooks.getCurrentServer().getLevel(dimension);
×
136
            BlockPos pos = pathElementParam.pos();
×
137
            Direction side = pathElementParam.side().orElse(null);
×
138

139
            if (world == null) {
×
140
                IntegratedDynamics.clog(org.apache.logging.log4j.Level.WARN, String.format("Skipped loading part from a network at the " +
×
141
                        "invalid dimension id %s.", dimensionId));
142
            } else {
143
                IPathElement pathElement = IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(world, pos, side, Capabilities.PathElement.BLOCK).orElse(null);
×
144
                if(pathElement == null) {
×
145
                    IntegratedDynamics.clog(org.apache.logging.log4j.Level.WARN, String.format("Skipped loading part from a network at " +
×
146
                            "position %s in world %s because it has no valid path element.", pos, dimensionId));
147
                } else {
148
                    elements.add(SidedPathElement.of(pathElement, side));
×
149
                }
150
            }
151
        }
×
152
    }
×
153

154
    public List<SidedPathElementParams> toParams() {
155
        List<SidedPathElementParams> list = Lists.newArrayList();
2✔
156
        for(ISidedPathElement e : elements) {
11✔
157
            list.add(e.getParams());
5✔
158
        }
1✔
159
        return list;
2✔
160
    }
161
}
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