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

CyclopsMC / IntegratedDynamics / 24288228044

11 Apr 2026 05:55PM UTC coverage: 45.738% (+0.02%) from 45.722%
24288228044

push

github

rubensworks
Bump mod version

2806 of 8876 branches covered (31.61%)

Branch coverage included in aggregate %.

12319 of 24193 relevant lines covered (50.92%)

2.43 hits per line

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

76.11
/src/main/java/org/cyclops/integrateddynamics/GeneralConfig.java
1
package org.cyclops.integrateddynamics;
2

3
import com.google.common.collect.Lists;
4
import com.google.common.collect.Maps;
5
import net.minecraft.ResourceLocationException;
6
import net.minecraft.resources.ResourceLocation;
7
import net.neoforged.fml.config.ModConfig;
8
import net.neoforged.fml.event.config.ModConfigEvent;
9
import org.apache.logging.log4j.Level;
10
import org.cyclops.cyclopscore.config.ConfigurableProperty;
11
import org.cyclops.cyclopscore.config.extendedconfig.DummyConfig;
12
import org.cyclops.cyclopscore.tracking.Analytics;
13
import org.cyclops.cyclopscore.tracking.Versions;
14
import org.cyclops.integrateddynamics.api.part.IPartType;
15
import org.cyclops.integrateddynamics.core.part.PartTypes;
16

17
import java.util.List;
18
import java.util.Map;
19
import java.util.Objects;
20

21
/**
22
 * A config with general options for this mod.
23
 * @author rubensworks
24
 *
25
 */
26
public class GeneralConfig extends DummyConfig {
27

28
    @ConfigurableProperty(category = "core", comment = "If an anonymous mod startup analytics request may be sent to our analytics service.")
29
    public static boolean analytics = true;
2✔
30

31
    @ConfigurableProperty(category = "core", comment = "If the version checker should be enabled.")
32
    public static boolean versionChecker = true;
2✔
33

34
    @ConfigurableProperty(category = "machine", comment = "The default update frequency in ticks to use for new parts.", minimalValue = 1, configLocation = ModConfig.Type.SERVER)
35
    public static int defaultPartUpdateFreq = 1;
2✔
36

37
    @ConfigurableProperty(category = "general", comment = "The energy usage multiplier for networks.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
38
    public static int energyConsumptionMultiplier = 0;
2✔
39

40
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the audio reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
41
    public static int audioReaderBaseConsumption = 1;
2✔
42
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the audio writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
43
    public static int audioWriterBaseConsumption = 1;
2✔
44
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the block reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
45
    public static int blockReaderBaseConsumption = 1;
2✔
46
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the mono-directional connector.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
47
    public static int connectorMonoDirectionalBaseConsumption = 32;
2✔
48
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the omni-directional connector.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
49
    public static int connectorOmniDirectionalBaseConsumption = 128;
2✔
50
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the effect writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
51
    public static int effectWriterBaseConsumption = 1;
2✔
52
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the entity reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
53
    public static int entityReaderBaseConsumption = 1;
2✔
54
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the entity writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
55
    public static int entityWriterBaseConsumption = 1;
2✔
56
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the extra-dimensional reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
57
    public static int extraDimensionalReaderBaseConsumption = 1;
2✔
58
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the fluid reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
59
    public static int fluidReaderBaseConsumption = 1;
2✔
60
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the inventory reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
61
    public static int inventoryReaderBaseConsumption = 1;
2✔
62
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the inventory writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
63
    public static int inventoryWriterBaseConsumption = 1;
2✔
64
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the machine reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
65
    public static int machineReaderBaseConsumption = 1;
2✔
66
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the machine writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
67
    public static int machineWriterBaseConsumption = 1;
2✔
68
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the materializer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
69
    public static int materializerBaseConsumption = 1;
2✔
70
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the network reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
71
    public static int networkReaderBaseConsumption = 1;
2✔
72
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the display panel when it has a variable.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
73
    public static int panelDisplayBaseConsumptionEnabled = 2;
2✔
74
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the display panel when does not have a variable.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
75
    public static int panelDisplayBaseConsumptionDisabled = 1;
2✔
76
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the dynamic light panel.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
77
    public static int panelLightDynamicBaseConsumption = 0;
2✔
78
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the static light panel.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
79
    public static int panelLightStaticBaseConsumption = 0;
2✔
80
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the delayer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
81
    public static int delayerBaseConsumption = 2;
2✔
82
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the proxy.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
83
    public static int proxyBaseConsumption = 2;
2✔
84
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the redstone reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
85
    public static int redstoneReaderBaseConsumption = 1;
2✔
86
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the redstone writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
87
    public static int redstoneWriterBaseConsumption = 1;
2✔
88
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the variable store.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
89
    public static int variablestoreBaseConsumption = 4;
2✔
90
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the world reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
91
    public static int worldReaderBaseConsumption = 1;
2✔
92

93
    @ConfigurableProperty(category = "general", comment = "The maximum render distance for part overlays to render. The higher, the more resource intensive.", isCommandable = true, minimalValue = 1, configLocation = ModConfig.Type.CLIENT)
94
    public static int partOverlayRenderdistance = 15;
2✔
95

96
    @ConfigurableProperty(category = "core", comment = "If cable models should be cached for rendering optimization.", isCommandable = true, configLocation = ModConfig.Type.CLIENT)
97
    public static boolean cacheCableModels = true;
2✔
98

99
    @ConfigurableProperty(category = "core", comment = "The maximum network energy transfer rate.", isCommandable = true, minimalValue = 0, configLocation = ModConfig.Type.SERVER)
100
    public static int energyRateLimit = Integer.MAX_VALUE;
2✔
101

102
    @ConfigurableProperty(category = "machine", comment = "The maximum offset in blocks a directional connector can look for its target.", minimalValue = 1, configLocation = ModConfig.Type.SERVER)
103
    public static int maxDirectionalConnectorOffset = 512;
2✔
104

105
    @ConfigurableProperty(category = "machine", comment = "The NBT tags that are not allowed to be read by displaying NBT tags or performing operations on them.", configLocation = ModConfig.Type.SERVER)
106
    public static List<String> nbtTagBlacklist = Lists.newArrayList(); // Tag names that have to be ignored
2✔
107

108
    @ConfigurableProperty(category = "core", comment = "When enabled, networks will stop ticking and values will not be shown and evaluated again. This can be used to fix crashing networks by temporarily enabling this option.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
109
    public static boolean safeMode = false;
2✔
110

111
    @ConfigurableProperty(category = "core", comment = "The fastest possible frequency in ticks at which ingredient network should be observed.", minimalValue = 1, isCommandable = true, configLocation = ModConfig.Type.SERVER)
112
    public static int ingredientNetworkObserverFrequencyMin = 5;
2✔
113

114
    @ConfigurableProperty(category = "core", comment = "The slowest possible frequency in ticks at which ingredient network should be observed.", minimalValue = 1, isCommandable = true, configLocation = ModConfig.Type.SERVER)
115
    public static int ingredientNetworkObserverFrequencyMax = 40;
2✔
116

117
    @ConfigurableProperty(category = "core", comment = "The ingredient network observation frequency slowdown rate in ticks.", minimalValue = 1, isCommandable = true, configLocation = ModConfig.Type.SERVER)
118
    public static int ingredientNetworkObserverFrequencyIncreaseFactor = 1;
2✔
119

120
    @ConfigurableProperty(category = "core", comment = "The ingredient network observation frequency slowdown rate in ticks.", minimalValue = 1, isCommandable = true, configLocation = ModConfig.Type.SERVER)
121
    public static int ingredientNetworkObserverFrequencyDecreaseFactor = 5;
2✔
122

123
    @ConfigurableProperty(category = "core", comment = "The frequency in ticks at which ingredient network should be observed after a position's contents are changed.", minimalValue = 0, isCommandable = true, configLocation = ModConfig.Type.SERVER)
124
    public static int ingredientNetworkObserverFrequencyForced = 0;
2✔
125

126
    @ConfigurableProperty(category = "core", comment = "The number of threads that the ingredient network observer can use.", minimalValue = 1, requiresMcRestart = true, configLocation = ModConfig.Type.SERVER)
127
    public static int ingredientNetworkObserverThreads = 4;
2✔
128

129
    @ConfigurableProperty(category = "core", comment = "If the ingredient network observer can work on separate thread.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
130
    public static boolean ingredientNetworkObserverEnableMultithreading = true;
2✔
131

132
    @ConfigurableProperty(category = "core", comment = "If network change events should be logged. Only enable this when debugging.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
133
    public static boolean logChangeEvents = false;
2✔
134

135
    @ConfigurableProperty(category = "core", comment = "If variable card IDs should be logged during evaluation. This is useful for debugging crashes caused by card evaluation.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
136
    public static boolean logCardEvaluation = false;
2✔
137

138
    @ConfigurableProperty(category = "core", comment = "How deep the recursion stack on an operator can become. This is to avoid game crashes when building things like the omega operator.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
139
    public static int operatorRecursionLimit = 256;
2✔
140

141
    @ConfigurableProperty(category = "machine", comment = "Priority list of mod id's when determining tag-based recipe outputs.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
142
    public static List<String> recipeTagOutputModPriorities = Lists.newArrayList();
2✔
143

144
    @ConfigurableProperty(category = "core", comment = "If corrupted networks should automatically be restored on first tick.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
145
    public static boolean recreateCorruptedNetworks = true;
2✔
146

147
    @ConfigurableProperty(category = "core", comment = "The maximum frequency at which speach messages can be played in milliseconds.", isCommandable = true, configLocation = ModConfig.Type.CLIENT)
148
    public static int speachMaxFrequency = 1000;
2✔
149

150
    @ConfigurableProperty(category = "core" , comment = "When true, use the LONG number format style. Otherwise, use the SHORT style.")
151
    public static boolean numberCompactUseLongStyle = false;
2✔
152

153
    @ConfigurableProperty(category = "core" , comment = "The maximum number of fractional digits to include in the result of the compact operator")
154
    public static int numberCompactMaximumFractionDigits = 2;
2✔
155

156
    @ConfigurableProperty(category = "core" , comment = "The minimum number of fractional digits to include in the result of the compact operator")
157
    public static int numberCompactMinimumFractionDigits = 0;
2✔
158

159
    @ConfigurableProperty(category = "core" , comment = "The maximum number of integer digits to include in the result of the compact operator")
160
    public static int numberCompactMaximumIntegerDigits = 3;
2✔
161

162
    @ConfigurableProperty(category = "core" , comment = "The minimum number of integer digits to include in the result of the compact operator")
163
    public static int numberCompactMinimumIntegerDigits = 1;
2✔
164

165
    @ConfigurableProperty(category = "general", comment = "The default port for running the network diagnostics HTTP server.", configLocation = ModConfig.Type.CLIENT)
166
    public static int diagnosticsWebServerPort = 3030;
2✔
167

168
    @ConfigurableProperty(category = "machine", comment = "The maximum offset in blocks a part can target.", minimalValue = 1, configLocation = ModConfig.Type.SERVER)
169
    public static int maxPartOffset = 32;
2✔
170

171
    @ConfigurableProperty(category = "machine", comment = "The distance from which part offsets should be shown.", minimalValue = 1, configLocation = ModConfig.Type.SERVER)
172
    public static int partOffsetRenderDistance = 16;
2✔
173

174
    @ConfigurableProperty(category = "machine", comment = "The maximum values that Part Offset items will have when dropped from a broken part.", minimalValue = 1, configLocation = ModConfig.Type.SERVER)
175
    public static int enchancementOffsetPartDropValue = 4;
2✔
176

177
    @ConfigurableProperty(category = "machine" , comment = "When true, disable the collision for cable.", configLocation = ModConfig.Type.SERVER)
178
    public static boolean disableCableCollision = false;
2✔
179

180
    @ConfigurableProperty(category = "general", comment = "The minimum update interval to enforce for all parts, in number of ticks.", configLocation = ModConfig.Type.SERVER)
181
    public static int partsMinimumUpdateInterval = 1;
2✔
182
    @ConfigurableProperty(category = "general", comment = "The minimum update intervals to enforce for specific parts. You can add entries in the form of 'integrateddynamics:machine_reader:10', where '10' refers to the number of ticks.", configLocation = ModConfig.Type.SERVER)
183
    public static List<String> partMinimumUpdateIntervals = Lists.newArrayList();
2✔
184
    public static Map<IPartType<?, ?>, Integer> partMinimumUpdateIntervalsMap = Maps.newIdentityHashMap();
2✔
185

186
    @ConfigurableProperty(category = "core" , comment = "When true, network elements will tick, irrespective of whether their chunk is loaded or not.", configLocation = ModConfig.Type.SERVER, isCommandable = true)
187
    public static boolean tickUnloadedNetworkElements = false;
3✔
188

189
    public GeneralConfig() {
190
        super(IntegratedDynamics._instance, "general");
4✔
191
        IntegratedDynamics._instance.getModEventBus().addListener(this::onConfigLoad);
5✔
192
        IntegratedDynamics._instance.getModEventBus().addListener(this::onConfigReload);
5✔
193
    }
1✔
194

195
    @Override
196
    public void onRegistered() {
197
        if(analytics) {
2!
198
            Analytics.registerMod(getMod(), Reference.GA_TRACKING_ID);
4✔
199
        }
200
        if(versionChecker) {
2!
201
            Versions.registerMod(getMod(), IntegratedDynamics._instance, Reference.VERSION_URL);
5✔
202
        }
203
    }
1✔
204

205
    public void onConfigLoad(ModConfigEvent.Loading event) {
206
        if (Objects.equals(event.getConfig().getModId(), Reference.MOD_ID)) {
6!
207
            recreatePartMinimumUpdateIntervals();
2✔
208
        }
209
    }
1✔
210

211
    public void onConfigReload(ModConfigEvent.Loading event) {
212
        if (Objects.equals(event.getConfig().getModId(), Reference.MOD_ID)) {
6!
213
            recreatePartMinimumUpdateIntervals();
2✔
214
        }
215
    }
1✔
216

217
    private void recreatePartMinimumUpdateIntervals() {
218
        partMinimumUpdateIntervalsMap = Maps.newIdentityHashMap();
2✔
219
        for (String entry : partMinimumUpdateIntervals) {
6!
220
            int lastColon = entry.lastIndexOf(":");
×
221
            if (lastColon == -1) {
×
222
                IntegratedDynamics.clog(Level.WARN, "Error while reloading config entry partMinimumUpdateIntervals: Invalid entry " + entry);
×
223
                continue;
×
224
            }
225
            String partType = entry.substring(0, lastColon);
×
226
            int interval;
227
            try {
228
                interval = Integer.parseInt(entry.substring(lastColon + 1));
×
229
            } catch (NumberFormatException e) {
×
230
                IntegratedDynamics.clog(Level.WARN, "Error while reloading config entry partMinimumUpdateIntervals: Invalid interval integer in " + entry);
×
231
                continue;
×
232
            }
×
233
            try {
234
                IPartType<?, ?> part = PartTypes.REGISTRY.getPartType(ResourceLocation.tryParse(partType));
×
235
                if (part != null) {
×
236
                    partMinimumUpdateIntervalsMap.put(part, interval);
×
237
                } else {
238
                    IntegratedDynamics.clog(Level.WARN, "Error while reloading config entry partMinimumUpdateIntervals: Could not find a part with id " + partType);
×
239
                }
240
            } catch (ResourceLocationException e) {
×
241
                IntegratedDynamics.clog(Level.WARN, "Error while reloading config entry partMinimumUpdateIntervals: " + e.getMessage());
×
242
            }
×
243
        }
×
244
    }
1✔
245

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