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

CyclopsMC / IntegratedDynamics / 22037263793

15 Feb 2026 02:22PM UTC coverage: 45.155% (+0.04%) from 45.112%
22037263793

push

github

rubensworks
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21-lts

2639 of 8620 branches covered (30.61%)

Branch coverage included in aggregate %.

11938 of 23662 relevant lines covered (50.45%)

2.4 hits per line

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

75.68
/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();
3✔
183

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

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

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

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

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

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