Fix configurable upgrade modifiers (8.0 is because 8 is maximum number of upgrades (not 9, I was being silly before) and we want to return def*upgradeModifier^1 when fully upgraded).

This commit is contained in:
Ben Spiers 2013-12-27 01:12:46 +00:00
parent 9feaae03bb
commit fa3aef17b6
4 changed files with 8 additions and 8 deletions

View file

@ -190,7 +190,8 @@ public class CommonProxy
Mekanism.TO_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MJToJoules", .04D).getDouble(.04D);
Mekanism.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(10000D);
Mekanism.VOICE_PORT = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoicePort", 36123).getInt();
Mekanism.upgradeModifier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL,"UpgradeModifier", 10).getInt();
//If this is less than 1, upgrades make machines worse. If less than 0, I don't even know.
Mekanism.maxUpgradeMultiplier = Math.max(1, Mekanism.configuration.get(Configuration.CATEGORY_GENERAL,"UpgradeModifier", 10).getInt());
Mekanism.TO_TE = Mekanism.TO_BC*10;
Mekanism.FROM_TE = Mekanism.FROM_BC/10;

View file

@ -265,7 +265,7 @@ public class Mekanism
public static int obsidianTNTDelay = 100;
public static int UPDATE_DELAY = 10;
public static int VOICE_PORT = 36123;
public static int upgradeModifier = 10;
public static int maxUpgradeMultiplier = 10;
public static double ENERGY_PER_REDSTONE = 10000;
public static double TO_IC2;

View file

@ -5,7 +5,6 @@ import java.io.DataOutputStream;
import mekanism.common.Mekanism;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import com.google.common.io.ByteArrayDataInput;
@ -49,7 +48,7 @@ public class PacketConfigSync implements IMekanismPacket
Mekanism.TO_BC = dataStream.readDouble();
Mekanism.ENERGY_PER_REDSTONE = dataStream.readDouble();
Mekanism.VOICE_PORT = dataStream.readInt();
Mekanism.upgradeModifier = dataStream.readInt();
Mekanism.maxUpgradeMultiplier = dataStream.readInt();
Mekanism.TO_TE = Mekanism.TO_BC*10;
Mekanism.FROM_TE = Mekanism.FROM_BC/10;
@ -97,7 +96,7 @@ public class PacketConfigSync implements IMekanismPacket
dataStream.writeDouble(Mekanism.TO_BC);
dataStream.writeDouble(Mekanism.ENERGY_PER_REDSTONE);
dataStream.writeInt(Mekanism.VOICE_PORT);
dataStream.writeInt(Mekanism.upgradeModifier);
dataStream.writeInt(Mekanism.maxUpgradeMultiplier);
dataStream.writeDouble(Mekanism.enrichmentChamberUsage);
dataStream.writeDouble(Mekanism.osmiumCompressorUsage);

View file

@ -612,7 +612,7 @@ public final class MekanismUtils
*/
public static int getTicks(int speedUpgrade, int def)
{
return (int)(def * Math.pow(Mekanism.upgradeModifier, (-speedUpgrade/(double)(Mekanism.upgradeModifier-1))));
return (int)(def * Math.pow(Mekanism.maxUpgradeMultiplier, -speedUpgrade/8.0));
}
/**
@ -624,7 +624,7 @@ public final class MekanismUtils
*/
public static double getEnergyPerTick(int speedUpgrade, int energyUpgrade, double def)
{
return def * Math.pow(Mekanism.upgradeModifier, ((speedUpgrade-energyUpgrade)/(double)(Mekanism.upgradeModifier-1)));
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (speedUpgrade-energyUpgrade)/8.0);
}
/**
@ -635,7 +635,7 @@ public final class MekanismUtils
*/
public static double getMaxEnergy(int energyUpgrade, double def)
{
return def * Math.pow(Mekanism.upgradeModifier, (energyUpgrade/(double)(Mekanism.upgradeModifier-1)));
return def * Math.pow(Mekanism.maxUpgradeMultiplier, energyUpgrade/8.0);
}
/**