• 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

0.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.Lists;
4
import com.google.common.collect.Sets;
5
import lombok.Data;
6
import lombok.experimental.Delegate;
7
import net.minecraft.core.BlockPos;
8
import net.minecraft.core.Direction;
9
import net.minecraft.core.registries.Registries;
10
import net.minecraft.resources.ResourceKey;
11
import net.minecraft.resources.ResourceLocation;
12
import net.minecraft.world.level.Level;
13
import net.neoforged.neoforge.server.ServerLifecycleHooks;
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
×
35
    private final Set<ISidedPathElement> elements;
×
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) {
×
45
        this.elements = elements;
×
46
    }
×
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();
×
73
        for(ISidedPathElement e : elements) {
×
74
            list.add(e.getParams());
×
75
        }
×
76
        return list;
×
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