• 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

52.94
/src/main/java/org/cyclops/integrateddynamics/core/part/PartTypeRegistry.java
1
package org.cyclops.integrateddynamics.core.part;
2

3
import com.google.common.collect.Maps;
4
import net.minecraft.resources.ResourceLocation;
5
import org.cyclops.integrateddynamics.api.part.IPartState;
6
import org.cyclops.integrateddynamics.api.part.IPartType;
7
import org.cyclops.integrateddynamics.api.part.IPartTypeRegistry;
8

9
import java.util.Collection;
10
import java.util.Map;
11

12
/**
13
 * Registry for {@link IPartType}.
14
 * @author rubensworks
15
 */
16
public final class PartTypeRegistry implements IPartTypeRegistry {
17

18
    private static PartTypeRegistry INSTANCE = new PartTypeRegistry();
5✔
19

20
    private Map<String, IPartType> partTypes = Maps.newHashMap();
3✔
21

22
    private PartTypeRegistry() {
2✔
23

24
    }
1✔
25

26
    /**
27
     * @return The unique instance.
28
     */
29
    public static PartTypeRegistry getInstance() {
30
        return INSTANCE;
2✔
31
    }
32

33
    @Override
34
    public <P extends IPartType<P, S>, S extends IPartState<P>> P register(P partType) {
35
        if(partTypes.containsKey(partType.getUniqueName())) {
6!
36
            throw new DuplicatePartTypeException(String.format("Tried to register a part type %s with name %s while " +
×
37
                    "the registry already container %s for that name.", partType, partType.getUniqueName(),
×
38
                    partTypes.get(partType.getUniqueName())));
×
39
        }
40
        partTypes.put(partType.getUniqueName().toString(), partType);
8✔
41
        return partType;
2✔
42
    }
43

44
    @Override
45
    public Collection<IPartType> getPartTypes() {
46
        return partTypes.values();
×
47
    }
48

49
    @Override
50
    public IPartType getPartType(ResourceLocation partName) {
51
        return partTypes.get(partName.toString());
×
52
    }
53

54
    public static class DuplicatePartTypeException extends RuntimeException {
55

56
        public DuplicatePartTypeException(String msg) {
57
            super(msg);
×
58
        }
×
59

60
    }
61

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