• 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

31.25
/src/main/java/org/cyclops/integrateddynamics/api/part/PartCapability.java
1
package org.cyclops.integrateddynamics.api.part;
2

3
import net.minecraft.resources.ResourceLocation;
4
import net.neoforged.neoforge.capabilities.BaseCapability;
5
import net.neoforged.neoforge.capabilities.CapabilityRegistry;
6
import net.neoforged.neoforge.capabilities.ICapabilityProvider;
7
import org.jetbrains.annotations.ApiStatus;
8
import org.jetbrains.annotations.Nullable;
9

10
import java.util.IdentityHashMap;
11
import java.util.List;
12
import java.util.Map;
13

14
/**
15
 * @author rubensworks
16
 */
17
public class PartCapability<T> extends BaseCapability<T, PartTarget> {
18

19
    public static <T> PartCapability<T> create(ResourceLocation name, Class<T> typeClass) {
20
        return (PartCapability<T>) registry.create(name, typeClass, PartTarget.class);
7✔
21
    }
22

23
    public static synchronized List<PartCapability<?>> getAll() {
24
        return registry.getAll();
×
25
    }
26

27
    // INTERNAL
28

29
    // Requires explicitly-typed constructor due to ECJ inference failure.
30
    private static final CapabilityRegistry<PartCapability<?>> registry = new CapabilityRegistry<PartCapability<?>>((name, type, clazz) -> new PartCapability<>(name, type));
12✔
31

32
    private PartCapability(ResourceLocation name, Class<T> typeClass) {
33
        super(name, typeClass, PartTarget.class);
5✔
34
    }
1✔
35

36
    final Map<IPartType<?, ?>, List<ICapabilityProvider<IPartType<?, ?>, PartTarget, T>>> providers = new IdentityHashMap<>();
5✔
37

38
    @ApiStatus.Internal
39
    @Nullable
40
    public T getCapability(IPartType<?, ?> partType, PartTarget context) {
41
        for (var provider : providers.getOrDefault(partType, List.of())) {
×
42
            var ret = provider.getCapability(partType, context);
×
43
            if (ret != null)
×
44
                return ret;
×
45
        }
×
46
        return null;
×
47
    }
48

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