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

CyclopsMC / CommonCapabilities / #479006675

pending completion
#479006675

push

github-actions

rubensworks
Update to MC 1.19

1 of 1 new or added line in 1 file covered. (100.0%)

877 of 2182 relevant lines covered (40.19%)

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.minecraftforge.eventbus.api.EventPriority;
4
import net.minecraftforge.eventbus.api.IEventBus;
5
import net.minecraftforge.fml.common.Mod;
6
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
7
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
8
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
9
import net.minecraftforge.registries.ForgeRegistries;
10
import net.minecraftforge.registries.NewRegistryEvent;
11
import net.minecraftforge.registries.RegisterEvent;
12
import org.apache.logging.log4j.Level;
13
import org.cyclops.commoncapabilities.api.capability.recipehandler.IPrototypedIngredientAlternatives;
14
import org.cyclops.commoncapabilities.api.capability.recipehandler.PrototypedIngredientAlternativesItemStackTag;
15
import org.cyclops.commoncapabilities.api.capability.recipehandler.PrototypedIngredientAlternativesList;
16
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
17
import org.cyclops.commoncapabilities.capability.ingredient.storage.IngredientComponentStorageHandlerConfig;
18
import org.cyclops.commoncapabilities.capability.inventorystate.InventoryStateConfig;
19
import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig;
20
import org.cyclops.commoncapabilities.capability.recipehandler.RecipeHandlerConfig;
21
import org.cyclops.commoncapabilities.capability.temperature.TemperatureConfig;
22
import org.cyclops.commoncapabilities.capability.worker.WorkerConfig;
23
import org.cyclops.commoncapabilities.modcompat.vanilla.VanillaModCompat;
24
import org.cyclops.commoncapabilities.proxy.ClientProxy;
25
import org.cyclops.commoncapabilities.proxy.CommonProxy;
26
import org.cyclops.cyclopscore.config.ConfigHandler;
27
import org.cyclops.cyclopscore.init.ModBaseVersionable;
28
import org.cyclops.cyclopscore.modcompat.ModCompatLoader;
29
import org.cyclops.cyclopscore.proxy.IClientProxy;
30
import org.cyclops.cyclopscore.proxy.ICommonProxy;
31

32
import java.util.Objects;
33

34
/**
35
 * The main mod class of this mod.
36
 * @author rubensworks (aka kroeserr)
37
 *
38
 */
39
@Mod(Reference.MOD_ID)
40
public class CommonCapabilities extends ModBaseVersionable<CommonCapabilities> {
41

42
    /**
43
     * The unique instance of this mod.
44
     */
45
    public static CommonCapabilities _instance;
46
    private final IEventBus modEventBus;
47

48
    public CommonCapabilities() {
49
        super(Reference.MOD_ID, (instance) -> _instance = instance);
×
50
        this.modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
×
51
        this.modEventBus.addListener(EventPriority.LOW, this::onRegister);
×
52
        this.modEventBus.addListener(EventPriority.LOW, this::onRegistriesLoad);
×
53
        this.modEventBus.addListener(EventPriority.LOW, this::afterCapabilitiesLoaded);
×
54
    }
×
55

56
    public IEventBus getModEventBus() {
57
        return modEventBus;
×
58
    }
59

60
    @Override
61
    protected void setup(FMLCommonSetupEvent event) {
62
        super.setup(event);
×
63
        Objects.requireNonNull(IngredientComponent.ITEMSTACK, "Item ingredient component is not initialized");
×
64
        Objects.requireNonNull(IngredientComponent.FLUIDSTACK, "Fluid ingredient component is not initialized");
×
65
        Objects.requireNonNull(IngredientComponent.ENERGY, "Energy ingredient component is not initialized");
×
66
    }
×
67

68
    @Override
69
    protected void loadModCompats(ModCompatLoader modCompatLoader) {
70
        super.loadModCompats(modCompatLoader);
×
71
        modCompatLoader.addModCompat(new VanillaModCompat());
×
72
        // TODO: temporarily disable some mod compats
73
        //modCompatLoader.addModCompat(new TConstructModCompat());
74
        //modCompatLoader.addModCompat(new ForestryModCompat());
75
        //modCompatLoader.addModCompat(new ThermalExpansionModCompat());
76
        //modCompatLoader.addModCompat(new EnderIOModCompat());
77
        //modCompatLoader.addModCompat(new Ic2ModCompat());
78
    }
×
79

80
    @Override
81
    protected IClientProxy constructClientProxy() {
82
        return new ClientProxy();
×
83
    }
84

85
    @Override
86
    protected ICommonProxy constructCommonProxy() {
87
        return new CommonProxy();
×
88
    }
89

90
    @Override
91
    protected boolean hasDefaultCreativeModeTab() {
92
        return false;
×
93
    }
94

95
    @Override
96
    protected void onConfigsRegister(ConfigHandler configHandler) {
97
        super.onConfigsRegister(configHandler);
×
98

99
        configHandler.addConfigurable(new GeneralConfig());
×
100

101
        configHandler.addConfigurable(new WorkerConfig());
×
102
        configHandler.addConfigurable(new TemperatureConfig());
×
103
        configHandler.addConfigurable(new InventoryStateConfig());
×
104
        configHandler.addConfigurable(new SlotlessItemHandlerConfig());
×
105
        configHandler.addConfigurable(new RecipeHandlerConfig());
×
106
        configHandler.addConfigurable(new IngredientComponentStorageHandlerConfig());
×
107
    }
×
108

109
    public void onRegister(NewRegistryEvent event) {
110
        IPrototypedIngredientAlternatives.SERIALIZERS.put(
×
111
                PrototypedIngredientAlternativesList.SERIALIZER.getId(),
×
112
                PrototypedIngredientAlternativesList.SERIALIZER);
113
        IPrototypedIngredientAlternatives.SERIALIZERS.put(
×
114
                PrototypedIngredientAlternativesItemStackTag.SERIALIZER.getId(),
×
115
                PrototypedIngredientAlternativesItemStackTag.SERIALIZER);
116
    }
×
117

118
    public void onRegistriesLoad(RegisterEvent event) {
119
        if (event.getRegistryKey().equals(ForgeRegistries.BLOCKS.getRegistryKey())) {
×
120
            IngredientComponent.REGISTRY.register(IngredientComponents.ITEMSTACK.getName(), IngredientComponents.ITEMSTACK);
×
121
            IngredientComponent.REGISTRY.register(IngredientComponents.FLUIDSTACK.getName(), IngredientComponents.FLUIDSTACK);
×
122
            IngredientComponent.REGISTRY.register(IngredientComponents.ENERGY.getName(), IngredientComponents.ENERGY);
×
123
        }
124
    }
×
125

126
    public void afterCapabilitiesLoaded(InterModEnqueueEvent event) {
127
        IngredientComponents.registerStorageWrapperHandlers();
×
128
    }
×
129

130
    /**
131
     * Log a new info message for this mod.
132
     * @param message The message to show.
133
     */
134
    public static void clog(String message) {
135
        clog(Level.INFO, message);
×
136
    }
×
137

138
    /**
139
     * Log a new message of the given level for this mod.
140
     * @param level The level in which the message must be shown.
141
     * @param message The message to show.
142
     */
143
    public static void clog(Level level, String message) {
144
        CommonCapabilities._instance.getLoggerHelper().log(level, message);
×
145
    }
×
146

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