Skip to content

Commit

Permalink
Add config option for EMC sync throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jun 7, 2024
1 parent c3d2a73 commit 066e79f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/gripe/_90/appliede/AppliedEConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class AppliedEConfig {
private final ForgeConfigSpec.DoubleValue moduleEnergyUsage;
private final ForgeConfigSpec.IntValue emcPerByte;
private final ForgeConfigSpec.BooleanValue terminalExtractFromOwnEmcOnly;
private final ForgeConfigSpec.IntValue syncThrottleInterval;

private AppliedEConfig(ForgeConfigSpec.Builder builder) {
moduleEnergyUsage = builder.comment("The amount of AE energy per tick used by the ME Transmutation Module.")
Expand All @@ -29,6 +30,9 @@ private AppliedEConfig(ForgeConfigSpec.Builder builder) {
"from the player using the terminal rather than all players with modules attached.",
"This option does not cover re-insertion and conversion back into EMC.")
.define("terminalExtractFromOwnEmcOnly", false);
syncThrottleInterval = builder.comment(
"How many ticks to wait before the next player EMC sync when manipulating stored EMC.")
.defineInRange("syncThrottleInterval", 20, 1, 200);
}

public double getModuleEnergyUsage() {
Expand All @@ -43,6 +47,10 @@ public boolean terminalExtractFromOwnEmcOnly() {
return terminalExtractFromOwnEmcOnly.get();
}

public int getSyncThrottleInterval() {
return syncThrottleInterval.get();
}

public static class Client {
public static final Client CONFIG;
public static final ForgeConfigSpec SPEC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import appeng.api.storage.MEStorage;
import appeng.me.storage.NullInventory;

import gripe._90.appliede.AppliedEConfig;
import gripe._90.appliede.me.misc.TransmutationPattern;
import gripe._90.appliede.mixin.misc.TransmutationOfflineAccessor;
import gripe._90.appliede.part.EMCModulePart;
Expand All @@ -41,7 +42,7 @@
import moze_intel.projecte.api.proxy.ITransmutationProxy;

public class KnowledgeService implements IGridService, IGridServiceProvider {
private static final int TICKS_PER_SYNC = 20;
private static final int TICKS_PER_SYNC = AppliedEConfig.CONFIG.getSyncThrottleInterval();

private final List<IManagedGridNode> moduleNodes = new ArrayList<>();
private final Map<UUID, Supplier<IKnowledgeProvider>> providers = new HashMap<>();
Expand Down

0 comments on commit 066e79f

Please sign in to comment.