Re-add autocrafting calculation timeout setting
This commit is contained in:
@@ -71,9 +71,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|||||||
public final class RS {
|
public final class RS {
|
||||||
public static final String ID = "refinedstorage";
|
public static final String ID = "refinedstorage";
|
||||||
|
|
||||||
public static RS INSTANCE;
|
|
||||||
public RSOldConfig config = new RSOldConfig();
|
|
||||||
|
|
||||||
public static final NetworkHandler NETWORK_HANDLER = new NetworkHandler();
|
public static final NetworkHandler NETWORK_HANDLER = new NetworkHandler();
|
||||||
public static final ItemGroup MAIN_GROUP = new MainItemGroup();
|
public static final ItemGroup MAIN_GROUP = new MainItemGroup();
|
||||||
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
|
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage;
|
|
||||||
|
|
||||||
public class RSOldConfig {
|
|
||||||
//region Autocrafting
|
|
||||||
public int calculationTimeoutMs;
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region Categories
|
|
||||||
private static final String AUTOCRAFTING = "autocrafting";
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
/*private void loadConfig() {
|
|
||||||
//region Autocrafting
|
|
||||||
calculationTimeoutMs = config.getInt("calculationTimeoutMs", AUTOCRAFTING, 5000, 5000, Integer.MAX_VALUE, "The autocrafting calculation timeout in milliseconds, tasks taking longer than this to calculate (NOT execute) are cancelled to avoid server strain");
|
|
||||||
//endregion
|
|
||||||
}*/
|
|
||||||
}
|
|
@@ -1,6 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.*;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.*;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementList;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementList;
|
||||||
@@ -373,10 +374,9 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
ICraftingPattern pattern,
|
ICraftingPattern pattern,
|
||||||
boolean root) {
|
boolean root) {
|
||||||
|
|
||||||
/* TODO
|
if (System.currentTimeMillis() - calculationStarted > RS.SERVER_CONFIG.getAutocrafting().getCalculationTimeoutMs()) {
|
||||||
if (System.currentTimeMillis() - calculationStarted > RS.INSTANCE.config.calculationTimeoutMs) {
|
|
||||||
return new CraftingTaskError(CraftingTaskErrorType.TOO_COMPLEX);
|
return new CraftingTaskError(CraftingTaskErrorType.TOO_COMPLEX);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (!patternsUsed.add(pattern)) {
|
if (!patternsUsed.add(pattern)) {
|
||||||
return new CraftingTaskError(CraftingTaskErrorType.RECURSIVE, pattern);
|
return new CraftingTaskError(CraftingTaskErrorType.RECURSIVE, pattern);
|
||||||
|
@@ -35,6 +35,7 @@ public class ServerConfig {
|
|||||||
private CrafterManager crafterManager;
|
private CrafterManager crafterManager;
|
||||||
private CraftingMonitor craftingMonitor;
|
private CraftingMonitor craftingMonitor;
|
||||||
private WirelessCraftingMonitor wirelessCraftingMonitor;
|
private WirelessCraftingMonitor wirelessCraftingMonitor;
|
||||||
|
private Autocrafting autocrafting;
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
upgrades = new Upgrades();
|
upgrades = new Upgrades();
|
||||||
@@ -66,6 +67,7 @@ public class ServerConfig {
|
|||||||
crafterManager = new CrafterManager();
|
crafterManager = new CrafterManager();
|
||||||
craftingMonitor = new CraftingMonitor();
|
craftingMonitor = new CraftingMonitor();
|
||||||
wirelessCraftingMonitor = new WirelessCraftingMonitor();
|
wirelessCraftingMonitor = new WirelessCraftingMonitor();
|
||||||
|
autocrafting = new Autocrafting();
|
||||||
|
|
||||||
spec = builder.build();
|
spec = builder.build();
|
||||||
}
|
}
|
||||||
@@ -190,6 +192,10 @@ public class ServerConfig {
|
|||||||
return wirelessCraftingMonitor;
|
return wirelessCraftingMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Autocrafting getAutocrafting() {
|
||||||
|
return autocrafting;
|
||||||
|
}
|
||||||
|
|
||||||
public class Controller {
|
public class Controller {
|
||||||
private final ForgeConfigSpec.BooleanValue useEnergy;
|
private final ForgeConfigSpec.BooleanValue useEnergy;
|
||||||
private final ForgeConfigSpec.IntValue capacity;
|
private final ForgeConfigSpec.IntValue capacity;
|
||||||
@@ -905,4 +911,20 @@ public class ServerConfig {
|
|||||||
return cancelAllUsage.get();
|
return cancelAllUsage.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Autocrafting {
|
||||||
|
private final ForgeConfigSpec.IntValue calculationTimeoutMs;
|
||||||
|
|
||||||
|
public Autocrafting() {
|
||||||
|
builder.push("autocrafting");
|
||||||
|
|
||||||
|
calculationTimeoutMs = builder.comment("The autocrafting calculation timeout in milliseconds, crafting tasks taking longer than this to calculate are cancelled to avoid server strain").defineInRange("calculationTimeoutMs", 5000, 5000, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCalculationTimeoutMs() {
|
||||||
|
return calculationTimeoutMs.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
public static MessageXXX decode(PacketBuffer buf) {
|
|
||||||
return new MessageXXX(
|
|
||||||
buf.readInt(),
|
|
||||||
buf.readInt(),
|
|
||||||
buf.readBoolean(),
|
|
||||||
buf.readString(),
|
|
||||||
buf.readInt()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void encode(MessageXXX message, PacketBuffer buf) {
|
|
||||||
buf.writeInt(message.compare);
|
|
||||||
buf.writeInt(message.mode);
|
|
||||||
buf.writeBoolean(message.modFilter);
|
|
||||||
buf.writeString(message.name);
|
|
||||||
buf.writeInt(message.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handle(MessageXXX message, Supplier<NetworkEvent.Context> ctx) {
|
|
||||||
ctx.get().enqueueWork(() -> {
|
|
||||||
// XXX
|
|
||||||
});
|
|
||||||
ctx.get().setPacketHandled(true);
|
|
||||||
}
|
|
Reference in New Issue
Block a user