mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-22 21:09:43 +00:00
* Network throttle: Force ME update packets to be sent once every 50ms. 1. Item and fluid packets are separated to their own classes, as they are not even allowed to be mixed together in the first place. This will enforce a strict separation of the two. 2. New network worker thread for handling ME inventory updates. Instead of creating packets directly, classes should schedule packet(s) to be sent at the next 50ms boundary. The packet has a limit of 256 items to prevent killing the client, but this can be changed in the config. In fact, the packet send rate is also configurable. 3. Upon opening a terminal GUI, ME update packets are split. Only the last received packet will trigger a terminal sorting, so if the ME system is large, it may take several seconds (!) to load all the items. * Update SPacketMEFluidInvUpdate.java --------- Co-authored-by: Martin Robertz <[email protected]>
70 lines
2.7 KiB
Java
70 lines
2.7 KiB
Java
package com.glodblock.github.common;
|
|
|
|
import java.io.File;
|
|
|
|
import net.minecraftforge.common.config.Configuration;
|
|
|
|
import cpw.mods.fml.relauncher.FMLInjectionData;
|
|
|
|
public class Config {
|
|
|
|
private static final Configuration Config = new Configuration(
|
|
new File(new File((File) FMLInjectionData.data()[6], "config"), "ae2fc.cfg"));
|
|
|
|
public static boolean fluidCells;
|
|
public static boolean noFluidPacket;
|
|
public static boolean fluidIOBus;
|
|
public static boolean removeRecipe;
|
|
public static boolean blacklistEssentiaGas;
|
|
public static double portableCellBattery;
|
|
public static int packetSize;
|
|
public static int packetRate;
|
|
|
|
public static void run() {
|
|
loadCategory();
|
|
loadProperty();
|
|
}
|
|
|
|
private static void loadProperty() {
|
|
fluidCells = Config.getBoolean(
|
|
"Enable Fluid Storage Cell",
|
|
"Fluid Craft for AE2",
|
|
true,
|
|
"Enable this to generate the fluid storage cells. If you are playing with EC2, you can turn it off.");
|
|
noFluidPacket = Config.getBoolean(
|
|
"No Fluid Packet",
|
|
"Fluid Craft for AE2",
|
|
false,
|
|
"Enable this to make normal ME Interface can emit fluid with fluid pattern, like the ME Dual Interface.");
|
|
fluidIOBus = Config.getBoolean(
|
|
"Enable AE2FC's Fluid I/O Bus",
|
|
"Fluid Craft for AE2",
|
|
true,
|
|
"Enable this to add Fluid Import/Export Bus like EC2's one.");
|
|
removeRecipe = Config.getBoolean(
|
|
"Disable all recipes",
|
|
"Fluid Craft for AE2",
|
|
false,
|
|
"Disable all recipes, for quick tweaker.");
|
|
blacklistEssentiaGas = Config.getBoolean(
|
|
"Blacklist Essentia Gas",
|
|
"Fluid Craft for AE2",
|
|
true,
|
|
"Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
|
|
portableCellBattery = Config.get("Fluid Craft for AE2", "Portable Fluid Cell Battery Capacity", 20000D)
|
|
.getDouble();
|
|
packetSize = Config.get("Fluid Craft for AE2", "packetSize", 256, "Number of items to be sent per packet")
|
|
.getInt();
|
|
if (packetSize <= 0) packetSize = 256;
|
|
packetRate = Config
|
|
.get("Fluid Craft for AE2", "packetRate", 50, "Period at which packets are dispatched, in ms.")
|
|
.getInt();
|
|
if (packetRate <= 0) packetRate = 50;
|
|
if (Config.hasChanged()) Config.save();
|
|
}
|
|
|
|
private static void loadCategory() {
|
|
Config.addCustomCategoryComment("Fluid Craft for AE2", "Settings for AE2FC.");
|
|
}
|
|
}
|