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

CyclopsMC / CommonCapabilities / #479006705

21 Mar 2024 03:43PM UTC coverage: 39.629% (-0.3%) from 39.919%
#479006705

push

github

rubensworks
Fix failing unit tests

877 of 2213 relevant lines covered (39.63%)

0.4 hits per line

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

0.0
/src/main/java/org/cyclops/commoncapabilities/CommonCapabilities.java
1
package org.cyclops.commoncapabilities;
2

3
import net.neoforged.bus.api.EventPriority;
4
import net.neoforged.bus.api.IEventBus;
5
import net.neoforged.fml.common.Mod;
6
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
7
import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent;
8
import net.neoforged.neoforge.registries.NewRegistryEvent;
9
import net.neoforged.neoforge.registries.RegisterEvent;
10
import org.apache.logging.log4j.Level;
11
import org.cyclops.commoncapabilities.api.capability.recipehandler.IPrototypedIngredientAlternatives;
12
import org.cyclops.commoncapabilities.api.capability.recipehandler.PrototypedIngredientAlternativesItemStackTag;
13
import org.cyclops.commoncapabilities.api.capability.recipehandler.PrototypedIngredientAlternativesList;
14
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
15
import org.cyclops.commoncapabilities.modcompat.vanilla.VanillaModCompat;
16
import org.cyclops.commoncapabilities.proxy.ClientProxy;
17
import org.cyclops.commoncapabilities.proxy.CommonProxy;
18
import org.cyclops.cyclopscore.config.ConfigHandler;
19
import org.cyclops.cyclopscore.init.ModBaseVersionable;
20
import org.cyclops.cyclopscore.modcompat.ModCompatLoader;
21
import org.cyclops.cyclopscore.proxy.IClientProxy;
22
import org.cyclops.cyclopscore.proxy.ICommonProxy;
23

24
import java.util.Objects;
25

26
/**
27
 * The main mod class of this mod.
28
 * @author rubensworks (aka kroeserr)
29
 *
30
 */
31
@Mod(Reference.MOD_ID)
32
public class CommonCapabilities extends ModBaseVersionable<CommonCapabilities> {
33

34
    /**
35
     * The unique instance of this mod.
36
     */
37
    public static CommonCapabilities _instance;
38

39
    public CommonCapabilities(IEventBus modEventBus) {
40
        super(Reference.MOD_ID, (instance) -> _instance = instance, modEventBus);
×
41
        modEventBus.register(IngredientComponent.class);
×
42
        modEventBus.addListener(EventPriority.LOW, this::onRegister);
×
43
        modEventBus.addListener(EventPriority.LOW, this::onRegistriesLoad);
×
44
        modEventBus.addListener(EventPriority.LOW, this::afterCapabilitiesLoaded);
×
45
    }
×
46

47
    @Override
48
    protected void setup(FMLCommonSetupEvent event) {
49
        super.setup(event);
×
50
        Objects.requireNonNull(IngredientComponent.ITEMSTACK, "Item ingredient component is not initialized");
×
51
        Objects.requireNonNull(IngredientComponent.FLUIDSTACK, "Fluid ingredient component is not initialized");
×
52
        Objects.requireNonNull(IngredientComponent.ENERGY, "Energy ingredient component is not initialized");
×
53
    }
×
54

55
    @Override
56
    protected void loadModCompats(ModCompatLoader modCompatLoader) {
57
        super.loadModCompats(modCompatLoader);
×
58
        modCompatLoader.addModCompat(new VanillaModCompat());
×
59
        // TODO: temporarily disable some mod compats
60
        //modCompatLoader.addModCompat(new TConstructModCompat());
61
        //modCompatLoader.addModCompat(new ForestryModCompat());
62
        //modCompatLoader.addModCompat(new ThermalExpansionModCompat());
63
        //modCompatLoader.addModCompat(new EnderIOModCompat());
64
        //modCompatLoader.addModCompat(new Ic2ModCompat());
65
    }
×
66

67
    @Override
68
    protected IClientProxy constructClientProxy() {
69
        return new ClientProxy();
×
70
    }
71

72
    @Override
73
    protected ICommonProxy constructCommonProxy() {
74
        return new CommonProxy();
×
75
    }
76

77
    @Override
78
    protected boolean hasDefaultCreativeModeTab() {
79
        return false;
×
80
    }
81

82
    @Override
83
    protected void onConfigsRegister(ConfigHandler configHandler) {
84
        super.onConfigsRegister(configHandler);
×
85

86
        configHandler.addConfigurable(new GeneralConfig());
×
87
    }
×
88

89
    public void onRegister(NewRegistryEvent event) {
90
        IPrototypedIngredientAlternatives.SERIALIZERS.put(
×
91
                PrototypedIngredientAlternativesList.SERIALIZER.getId(),
×
92
                PrototypedIngredientAlternativesList.SERIALIZER);
93
        IPrototypedIngredientAlternatives.SERIALIZERS.put(
×
94
                PrototypedIngredientAlternativesItemStackTag.SERIALIZER.getId(),
×
95
                PrototypedIngredientAlternativesItemStackTag.SERIALIZER);
96
    }
×
97

98
    public void onRegistriesLoad(RegisterEvent event) {
99
        event.register(IngredientComponent.REGISTRY.key(), IngredientComponents.ITEMSTACK.getName(), () -> IngredientComponents.ITEMSTACK);
×
100
        event.register(IngredientComponent.REGISTRY.key(), IngredientComponents.FLUIDSTACK.getName(), () -> IngredientComponents.FLUIDSTACK);
×
101
        event.register(IngredientComponent.REGISTRY.key(), IngredientComponents.ENERGY.getName(), () -> IngredientComponents.ENERGY);
×
102
    }
×
103

104
    public void afterCapabilitiesLoaded(InterModEnqueueEvent event) {
105
        IngredientComponents.registerStorageWrapperHandlers();
×
106
    }
×
107

108
    /**
109
     * Log a new info message for this mod.
110
     * @param message The message to show.
111
     */
112
    public static void clog(String message) {
113
        clog(Level.INFO, message);
×
114
    }
×
115

116
    /**
117
     * Log a new message of the given level for this mod.
118
     * @param level The level in which the message must be shown.
119
     * @param message The message to show.
120
     */
121
    public static void clog(Level level, String message) {
122
        CommonCapabilities._instance.getLoggerHelper().log(level, message);
×
123
    }
×
124

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