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

CyclopsMC / IntegratedDynamics / 22175890785

19 Feb 2026 09:22AM UTC coverage: 45.359% (+0.01%) from 45.348%
22175890785

push

github

rubensworks
Add config option to force unloaded network elements to tick

Related to #1605, #1571, #1567

2665 of 8644 branches covered (30.83%)

Branch coverage included in aggregate %.

12019 of 23729 relevant lines covered (50.65%)

2.4 hits per line

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

75.89
/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 proxy.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
81
    public static int proxyBaseConsumption = 2;
2✔
82
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the redstone reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
83
    public static int redstoneReaderBaseConsumption = 1;
2✔
84
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the redstone writer.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
85
    public static int redstoneWriterBaseConsumption = 1;
2✔
86
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the variable store.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
87
    public static int variablestoreBaseConsumption = 4;
2✔
88
    @ConfigurableProperty(category = "general", comment = "The base energy usage for the world reader.", minimalValue = 0, configLocation = ModConfig.Type.SERVER)
89
    public static int worldReaderBaseConsumption = 1;
2✔
90

91
    @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)
92
    public static int partOverlayRenderdistance = 15;
2✔
93

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

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

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

103
    @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)
104
    public static List<String> nbtTagBlacklist = Lists.newArrayList(); // Tag names that have to be ignored
2✔
105

106
    @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)
107
    public static boolean safeMode = false;
2✔
108

109
    @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)
110
    public static int ingredientNetworkObserverFrequencyMin = 5;
2✔
111

112
    @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)
113
    public static int ingredientNetworkObserverFrequencyMax = 40;
2✔
114

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

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

121
    @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)
122
    public static int ingredientNetworkObserverFrequencyForced = 0;
2✔
123

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

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

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

133
    @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)
134
    public static boolean logCardEvaluation = false;
2✔
135

136
    @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)
137
    public static int operatorRecursionLimit = 256;
2✔
138

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

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

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

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

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

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

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

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

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

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

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

172
    @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)
173
    public static int enchancementOffsetPartDropValue = 4;
2✔
174

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

178
    @ConfigurableProperty(category = "general", comment = "The minimum update interval to enforce for all parts, in number of ticks.", configLocation = ModConfig.Type.SERVER)
179
    public static int partsMinimumUpdateInterval = 1;
2✔
180
    @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)
181
    public static List<String> partMinimumUpdateIntervals = Lists.newArrayList();
2✔
182
    public static Map<IPartType<?, ?>, Integer> partMinimumUpdateIntervalsMap = Maps.newIdentityHashMap();
2✔
183

184
    @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)
185
    public static boolean tickUnloadedNetworkElements = false;
3✔
186

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

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

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

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

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

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