aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/glease/ggfab/ConfigurationHandler.java44
-rw-r--r--src/main/java/net/glease/ggfab/GigaGramFab.java1
-rw-r--r--src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java29
-rw-r--r--src/main/resources/assets/ggfab/lang/en_US.lang4
4 files changed, 70 insertions, 8 deletions
diff --git a/src/main/java/net/glease/ggfab/ConfigurationHandler.java b/src/main/java/net/glease/ggfab/ConfigurationHandler.java
new file mode 100644
index 0000000000..c60877d5a5
--- /dev/null
+++ b/src/main/java/net/glease/ggfab/ConfigurationHandler.java
@@ -0,0 +1,44 @@
+package net.glease.ggfab;
+
+import net.minecraftforge.common.config.ConfigCategory;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+import java.io.File;
+import java.util.Map;
+
+public enum ConfigurationHandler {
+ INSTANCE;
+
+ private Configuration config;
+ private float laserOCPenaltyFactor;
+
+ void init(File f) {
+ config = new Configuration(f);
+ loadConfig();
+ setLanguageKeys();
+ }
+
+ private void setLanguageKeys() {
+ for (String categoryName : config.getCategoryNames()) {
+ ConfigCategory category = config.getCategory(categoryName);
+ category.setLanguageKey("ggfab.config." + categoryName);
+ for (Map.Entry<String, Property> entry : category.entrySet()) {
+ entry.getValue().setLanguageKey(String.format("%s.%s", category.getLanguagekey(), entry.getKey()));
+ }
+ }
+ }
+
+ private void loadConfig() {
+ laserOCPenaltyFactor = config.getFloat("advasslinePenaltyFactor", "common.balancing", 0.25f, 0f, 10f, "Laser overclock penalty factor. This will incredibly change the game balance. Even a small step from 0.3 to 0.3 can have very significant impact. Tweak with caution!");
+ config.save();
+ }
+
+ public Configuration getConfig() {
+ return config;
+ }
+
+ public float getLaserOCPenaltyFactor() {
+ return laserOCPenaltyFactor;
+ }
+}
diff --git a/src/main/java/net/glease/ggfab/GigaGramFab.java b/src/main/java/net/glease/ggfab/GigaGramFab.java
index ce6505b9bd..27248b2522 100644
--- a/src/main/java/net/glease/ggfab/GigaGramFab.java
+++ b/src/main/java/net/glease/ggfab/GigaGramFab.java
@@ -22,6 +22,7 @@ public class GigaGramFab {
GGItemList.AdvAssLine.set(new MTE_AdvAssLine(13532, "ggfab.machine.adv_assline", "Advanced Assembly Line").getStackForm(1));
});
GregTech_API.sBeforeGTPostload.add(new ComponentRecipeLoader());
+ ConfigurationHandler.INSTANCE.init(event.getSuggestedConfigurationFile());
}
@Mod.EventHandler
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
index 4bb2e68a28..12b1eca248 100644
--- a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
+++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
@@ -16,6 +16,7 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.*;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
+import net.glease.ggfab.ConfigurationHandler;
import net.glease.ggfab.GGConstants;
import net.glease.ggfab.util.LaserHelper;
import net.glease.ggfab.util.OverclockHelper;
@@ -28,6 +29,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
@@ -58,19 +60,19 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
public static final String TAG_KEY_PROGRESS_TIMES = "mProgressTimeArray";
private static final IStructureDefinition<MTE_AdvAssLine> STRUCTURE_DEFINITION =
StructureDefinition.<MTE_AdvAssLine>builder()
- .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][] {
+ .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{
{" ", "e", " "},
{"~", "l", "G"},
{"g", "m", "g"},
{"b", "i", "b"},
}))
- .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][] {
+ .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{
{" ", "e", " "},
{"d", "l", "d"},
{"g", "m", "g"},
{"b", "I", "b"},
}))
- .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][] {
+ .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][]{
{" ", "e", " "},
{"d", "l", "d"},
{"g", "m", "g"},
@@ -130,6 +132,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
private boolean stuck;
private final ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<>();
+
public MTE_AdvAssLine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -198,11 +201,25 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
UUID ownerUuid = getBaseMetaTileEntity().getOwnerUuid();
if (ownerUuid == null)
return;
- @SuppressWarnings("unchecked") List<EntityPlayerMP> l = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
+ float factor = ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor();
+ @SuppressWarnings("unchecked")
+ List<EntityPlayerMP> l = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayerMP p : l) {
if (p.getUniqueID().equals(ownerUuid)) {
for (int i = 0; i < 9; i++) {
- p.addChatMessage(new ChatComponentTranslation("ggfab.info.advassline." + i));
+ // switch is stupid, but I have no better idea
+ Object[] args;
+ switch (i) {
+ case 7:
+ args = new Object[]{factor};
+ break;
+ case 8:
+ args = new Object[]{(int) (factor * 100) + 400, (int) ((4 + factor) * (4 + factor + factor) * 100), 4 + factor, 4 + factor + factor};
+ break;
+ default:
+ args = new Object[0];
+ }
+ p.addChatMessage(new ChatComponentTranslation("ggfab.info.advassline." + i, args));
}
}
}
@@ -610,7 +627,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
calculateOverclockedNessMulti((long) currentRecipe.mEUt, Math.max(recipe.mDuration / recipe.mInputs.length, 1), 1, inputVoltage);
// then laser overclock if needed
if (!mExoticEnergyHatches.isEmpty()) {
- OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock(lEUt, mMaxProgresstime, inputEUt / recipe.mInputs.length, 0.3f);
+ OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock(lEUt, mMaxProgresstime, inputEUt / recipe.mInputs.length, ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor());
if (laserOverclock != null) {
lEUt = laserOverclock.getEUt();
mMaxProgresstime = laserOverclock.getDuration();
diff --git a/src/main/resources/assets/ggfab/lang/en_US.lang b/src/main/resources/assets/ggfab/lang/en_US.lang
index 6645efb80c..21b3462850 100644
--- a/src/main/resources/assets/ggfab/lang/en_US.lang
+++ b/src/main/resources/assets/ggfab/lang/en_US.lang
@@ -5,8 +5,8 @@ ggfab.info.advassline.3=You can think of an advanced assembly line as a collecti
ggfab.info.advassline.4=It will start processing once the input bus contents align with any stored data stick. The first slice will consume the input in Bus #1. After (recipe time/number of inputs) time, the first slice's work is concluded and will start the second slice. At the same time, first slice will look for input in input bus #1. If there are still enough input there slice #1 will start working again.
ggfab.info.advassline.5=The terminal slice (the n-th slice, where n is number of item input in recipe) will put the recipe output in output bus when it has concluded his work. Whenever a non-terminal slice finished its work, it will try to pass the work onto next slice. If the next slice cannot find the materials in its input bus, the just-finished slice will remain in §4STUCK§r state and hang the assembly line. To help locate these §4STUCK§r assembly lines, the controller's front face will have its status light turned orange.
ggfab.info.advassline.6=The EU/t cost of this machine is number of slices active multiplied by the original recipe EU/t. §4STUCK§r slices do not consume power. It will use the worst energy supplying hatch's input voltage for recipe tier calculation and normal imperfect overclock.
-ggfab.info.advassline.7=With exotic energy hatches, it can overclock beyond usual voltage tier, but will consume even more power than usual imperfect overclock. Every §2laser overclock§r will add 0.3 to power exponent.
-ggfab.info.advassline.8=1 §2laser overclock§r will have 50% recipe time and use 430% power. 2 §2laser overclock§r will have 25% recipe time and use 1978% (4.3*4.6) power. Will not overclock beyond 1 tick. Machine first tries to parallelize, then normal imperfect overclock, then §2laser overclock§r.
+ggfab.info.advassline.7=With exotic energy hatches, it can overclock beyond usual voltage tier, but will consume even more power than usual imperfect overclock. Every §2laser overclock§r will add %s to power exponent.
+ggfab.info.advassline.8=1 §2laser overclock§r will have 50%% recipe time and use %s%% power. 2 §2laser overclock§r will have 25%% recipe time and use %s%% (%s * %s) power. Will not overclock beyond 1 tick. Machine first tries to parallelize, then normal imperfect overclock, then §2laser overclock§r.
ggfab.waila.advassline.slice=Slice #%s: %s s / %s s
ggfab.waila.advassline.slice.small=Slice #%s: %s ticks remaining
ggfab.waila.advassline.slice.idle=Slice #%s: Idle