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

CyclopsMC / IntegratedDynamics / 16552051255

27 Jul 2025 01:58PM UTC coverage: 53.206% (+8.0%) from 45.161%
16552051255

push

github

rubensworks
Resolve minor TODOs

2888 of 8740 branches covered (33.04%)

Branch coverage included in aggregate %.

17341 of 29280 relevant lines covered (59.22%)

3.08 hits per line

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

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

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

22
import java.util.Collection;
23
import java.util.List;
24
import java.util.Set;
25
import java.util.TreeSet;
26

27
/**
28
 * A cluster for a collection of path elements.
29
 * @author rubensworks
30
 */
31
@Data
×
32
public class Cluster implements Collection<ISidedPathElement> {
33

34
    @Delegate
13✔
35
    private final Set<ISidedPathElement> elements;
3✔
36

37
    /**
38
     * This constructor should not be called, except for the process of constructing networks from NBT.
39
     */
40
    public Cluster() {
×
41
        this.elements = Sets.newTreeSet();
×
42
    }
×
43

44
    public Cluster(TreeSet<ISidedPathElement> elements) {
2✔
45
        this.elements = elements;
3✔
46
    }
1✔
47

48
    public void fromParams(List<SidedPathElementParams> pathElements) {
49
        for (SidedPathElementParams pathElementParam : pathElements) {
×
50
            ResourceLocation dimensionId = ResourceLocation.parse(pathElementParam.dimension());
×
51
            ResourceKey<Level> dimension = ResourceKey.create(Registries.DIMENSION, dimensionId);
×
52
            Level world = ServerLifecycleHooks.getCurrentServer().getLevel(dimension);
×
53
            BlockPos pos = pathElementParam.pos();
×
54
            Direction side = pathElementParam.side().orElse(null);
×
55

56
            if (world == null) {
×
57
                IntegratedDynamics.clog(org.apache.logging.log4j.Level.WARN, String.format("Skipped loading part from a network at the " +
×
58
                        "invalid dimension id %s.", dimensionId));
59
            } else {
60
                IPathElement pathElement = IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(world, pos, side, Capabilities.PathElement.BLOCK).orElse(null);
×
61
                if(pathElement == null) {
×
62
                    IntegratedDynamics.clog(org.apache.logging.log4j.Level.WARN, String.format("Skipped loading part from a network at " +
×
63
                            "position %s in world %s because it has no valid path element.", pos, dimensionId));
64
                } else {
65
                    elements.add(SidedPathElement.of(pathElement, side));
×
66
                }
67
            }
68
        }
×
69
    }
×
70

71
    public List<SidedPathElementParams> toParams() {
72
        List<SidedPathElementParams> list = Lists.newArrayList();
2✔
73
        for(ISidedPathElement e : elements) {
11✔
74
            list.add(e.getParams());
5✔
75
        }
1✔
76
        return list;
2✔
77
    }
78
}
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