From 066e79f38f57d6dbe371dc69e45457998a1845bd Mon Sep 17 00:00:00 2001 From: 90 Date: Fri, 7 Jun 2024 20:47:27 +0100 Subject: [PATCH] Add config option for EMC sync throttling --- src/main/java/gripe/_90/appliede/AppliedEConfig.java | 8 ++++++++ .../gripe/_90/appliede/me/service/KnowledgeService.java | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/gripe/_90/appliede/AppliedEConfig.java b/src/main/java/gripe/_90/appliede/AppliedEConfig.java index 4f3e39c..e840e26 100644 --- a/src/main/java/gripe/_90/appliede/AppliedEConfig.java +++ b/src/main/java/gripe/_90/appliede/AppliedEConfig.java @@ -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.") @@ -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() { @@ -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; diff --git a/src/main/java/gripe/_90/appliede/me/service/KnowledgeService.java b/src/main/java/gripe/_90/appliede/me/service/KnowledgeService.java index f574d64..81ef287 100644 --- a/src/main/java/gripe/_90/appliede/me/service/KnowledgeService.java +++ b/src/main/java/gripe/_90/appliede/me/service/KnowledgeService.java @@ -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; @@ -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 moduleNodes = new ArrayList<>(); private final Map> providers = new HashMap<>();