• 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/api/network/NetworkCapability.java
1
package org.cyclops.integrateddynamics.api.network;
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.List;
11
import java.util.Map;
12

13
/**
14
 * @author rubensworks
15
 */
16
public class NetworkCapability<T> extends BaseCapability<T, Void> {
17

18
    public static <T> NetworkCapability<T> create(ResourceLocation name, Class<T> typeClass) {
19
        return (NetworkCapability<T>) registry.create(name, typeClass, void.class);
×
20
    }
21

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

26
    // INTERNAL
27

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

31
    private NetworkCapability(ResourceLocation name, Class<T> typeClass) {
32
        super(name, typeClass, void.class);
×
33
    }
×
34

35
    @ApiStatus.Internal
36
    @Nullable
37
    public T getCapability(Map<NetworkCapability<?>, List<ICapabilityProvider<INetwork, Void, ?>>> providers, INetwork network) {
38
        List<ICapabilityProvider<INetwork, Void, ?>> list = providers.get(this);
×
39
        if (list != null) {
×
40
            for (var provider : (List<ICapabilityProvider<INetwork, Void, T>>) (List) list) {
×
41
                var ret = provider.getCapability(network, null);
×
42
                if (ret != null)
×
43
                    return ret;
×
44
            }
×
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