diff options
Diffstat (limited to 'src/main/java/gregtech/common/power')
6 files changed, 0 insertions, 339 deletions
diff --git a/src/main/java/gregtech/common/power/BasicMachineEUPower.java b/src/main/java/gregtech/common/power/BasicMachineEUPower.java deleted file mode 100644 index 6fec7e7954..0000000000 --- a/src/main/java/gregtech/common/power/BasicMachineEUPower.java +++ /dev/null @@ -1,74 +0,0 @@ -package gregtech.common.power; - -import static gregtech.api.enums.GT_Values.V; - -public class BasicMachineEUPower extends EUPower { - - protected static final String OC = " (OC)"; - protected boolean wasOverclocked; - - public BasicMachineEUPower(byte tier, int amperage) { - super(tier, amperage); - } - - public BasicMachineEUPower(byte tier, int amperage, int specialValue) { - super(tier, amperage, specialValue); - } - - @Override - public void computePowerUsageAndDuration(int euPerTick, int duration) { - super.computePowerUsageAndDuration(euPerTick, duration); - if (tier == 0) { - // Long time calculation - long xMaxProgresstime = ((long) duration) << 1; - if (xMaxProgresstime > Integer.MAX_VALUE - 1) { - // make impossible if too long - recipeEuPerTick = Integer.MAX_VALUE - 1; - recipeDuration = Integer.MAX_VALUE - 1; - } else { - recipeEuPerTick = euPerTick >> 2; - recipeDuration = (int) xMaxProgresstime; - } - } else { - // Long EUt calculation - long xEUt = euPerTick; - // Isnt too low EUt check? - long tempEUt = Math.max(xEUt, V[1]); - - recipeDuration = duration; - - while (tempEUt <= V[tier - 1] * (long) amperage) { - tempEUt <<= 2; // this actually controls overclocking - // xEUt *= 4;//this is effect of everclocking - recipeDuration >>= 1; // this is effect of overclocking - xEUt = recipeDuration == 0 ? xEUt >> 1 : xEUt << 2; // U know, if the time is less than 1 tick make the - // machine use 2x less power - } - if (xEUt > Integer.MAX_VALUE - 1) { - recipeEuPerTick = Integer.MAX_VALUE - 1; - recipeDuration = Integer.MAX_VALUE - 1; - } else { - recipeEuPerTick = (int) xEUt; - if (recipeEuPerTick == 0) recipeEuPerTick = 1; - if (recipeDuration == 0) recipeDuration = 1; // set time to 1 tick - } - } - wasOverclocked = checkIfOverclocked(); - } - - @Override - public String getPowerUsageString() { - return decorateWithOverclockLabel(super.getPowerUsageString()); - } - - protected String decorateWithOverclockLabel(String s) { - if (wasOverclocked) { - s += OC; - } - return s; - } - - protected boolean checkIfOverclocked() { - return originalVoltage != computeVoltageForEuRate(recipeEuPerTick); - } -} diff --git a/src/main/java/gregtech/common/power/EUPower.java b/src/main/java/gregtech/common/power/EUPower.java deleted file mode 100644 index a01e827f38..0000000000 --- a/src/main/java/gregtech/common/power/EUPower.java +++ /dev/null @@ -1,58 +0,0 @@ -package gregtech.common.power; - -import gregtech.api.util.GT_Utility; - -public class EUPower extends Power { - - protected final int amperage; - protected int originalVoltage; - - public EUPower(byte tier, int amperage) { - super(tier); - this.amperage = amperage; - } - - public EUPower(byte tier, int amperage, int specialValue) { - super(tier, specialValue); - this.amperage = amperage; - } - - @Override - // This generic EU Power class has no overclock defined and does no special calculations. - public void computePowerUsageAndDuration(int euPerTick, int duration) { - originalVoltage = computeVoltageForEuRate(euPerTick); - recipeEuPerTick = euPerTick; - recipeDuration = duration; - } - - @Override - public String getTierString() { - return GT_Utility.getColoredTierNameFromTier(tier); - } - - @Override - public String getTotalPowerString() { - return GT_Utility.formatNumbers((long) recipeDuration * recipeEuPerTick) + " EU"; - } - - @Override - public String getPowerUsageString() { - return GT_Utility.formatNumbers(recipeEuPerTick) + " EU/t"; - } - - @Override - public String getVoltageString() { - String voltageDescription = GT_Utility.formatNumbers(originalVoltage) + " EU/t"; - voltageDescription += GT_Utility.getTierNameWithParentheses(originalVoltage); - return voltageDescription; - } - - @Override - public String getAmperageString() { - return GT_Utility.formatNumbers(amperage); - } - - protected int computeVoltageForEuRate(int euPerTick) { - return amperage != 0 ? euPerTick / amperage : euPerTick; - } -} diff --git a/src/main/java/gregtech/common/power/FusionPower.java b/src/main/java/gregtech/common/power/FusionPower.java deleted file mode 100644 index d3bcdd41b4..0000000000 --- a/src/main/java/gregtech/common/power/FusionPower.java +++ /dev/null @@ -1,52 +0,0 @@ -package gregtech.common.power; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.util.EnumChatFormatting; - -import gregtech.api.enums.GT_Values; -import gregtech.nei.FusionSpecialValueFormatter; - -public class FusionPower extends BasicMachineEUPower { - - public FusionPower(byte tier, int startupPower) { - super(tier, 1, startupPower); - } - - @Override - public void computePowerUsageAndDuration(int euPerTick, int duration, int specialValue) { - originalVoltage = computeVoltageForEuRate(euPerTick); - recipeEuPerTick = euPerTick; - recipeDuration = duration; - // It's safe to assume fusion is above ULV. We put this as safety check here anyway - if (tier > 0) { - int maxPossibleOverclocks = FusionSpecialValueFormatter.getFusionTier(this.specialValue, V[tier - 1]) - - FusionSpecialValueFormatter.getFusionTier(specialValue, euPerTick); - // Isn't too low EUt check? - long tempEUt = Math.max(euPerTick, V[1]); - - recipeDuration = duration; - - while (tempEUt <= V[tier - 1] * (long) amperage && maxPossibleOverclocks-- > 0) { - tempEUt <<= 1; // this actually controls overclocking - recipeDuration >>= 1; // this is effect of overclocking - } - if (tempEUt > Integer.MAX_VALUE - 1) { - recipeEuPerTick = Integer.MAX_VALUE - 1; - recipeDuration = Integer.MAX_VALUE - 1; - } else { - recipeEuPerTick = (int) tempEUt; - if (recipeEuPerTick == 0) recipeEuPerTick = 1; - if (recipeDuration == 0) recipeDuration = 1; // set time to 1 tick - } - } - wasOverclocked = checkIfOverclocked(); - } - - @Override - public String getTierString() { - return GT_Values.TIER_COLORS[tier] + "MK " - + (tier - 5) // Mk1 <-> LuV - + EnumChatFormatting.RESET; - } -} diff --git a/src/main/java/gregtech/common/power/Power.java b/src/main/java/gregtech/common/power/Power.java deleted file mode 100644 index 28cdfa3559..0000000000 --- a/src/main/java/gregtech/common/power/Power.java +++ /dev/null @@ -1,73 +0,0 @@ -package gregtech.common.power; - -import gregtech.api.util.GT_Utility; - -public abstract class Power { - - protected final byte tier; - protected int recipeEuPerTick; - protected int recipeDuration; - protected final int specialValue; - - public Power(byte tier) { - this(tier, 0); - } - - public Power(byte tier, int specialValue) { - this.tier = tier; - this.specialValue = specialValue; - } - - public byte getTier() { - return tier; - } - - public abstract String getTierString(); - - /** - * This method should be called prior to usage of any value except the power tier. - */ - public abstract void computePowerUsageAndDuration(int euPerTick, int duration); - - public void computePowerUsageAndDuration(int euPerTick, int duration, int specialValue) { - computePowerUsageAndDuration(euPerTick, duration); - } - - public int getEuPerTick() { - return recipeEuPerTick; - } - - public int getDurationTicks() { - return recipeDuration; - } - - public double getDurationSeconds() { - return 0.05d * getDurationTicks(); - } - - public String getDurationStringSeconds() { - return GT_Utility.formatNumbers(getDurationSeconds()) + GT_Utility.trans("161", " secs"); - } - - public String getDurationStringTicks() { - if (getDurationTicks() == 1) { - return GT_Utility.formatNumbers(getDurationTicks()) + GT_Utility.trans("209.1", " tick"); - } - return GT_Utility.formatNumbers(getDurationTicks()) + GT_Utility.trans("209", " ticks"); - } - - public abstract String getTotalPowerString(); - - public abstract String getPowerUsageString(); - - public abstract String getVoltageString(); - - public abstract String getAmperageString(); - - public int compareTo(byte tier, int specialValue) { - if (this.tier < tier) { - return this.tier - tier; - } - return this.specialValue - specialValue; - } -} diff --git a/src/main/java/gregtech/common/power/SteamPower.java b/src/main/java/gregtech/common/power/SteamPower.java deleted file mode 100644 index 6394b6a5ef..0000000000 --- a/src/main/java/gregtech/common/power/SteamPower.java +++ /dev/null @@ -1,54 +0,0 @@ -package gregtech.common.power; - -import gregtech.api.util.GT_Utility; - -public class SteamPower extends Power { - - private final double euPerTickOverride; - private final double durationOverride; - private final String[] STEAM_TIER_NAMES = { "Bronze", "Steel" }; - - public SteamPower(byte tier, double euPerTickMultiplier, double durationMultiplier) { - super(tier); - this.euPerTickOverride = euPerTickMultiplier; - this.durationOverride = durationMultiplier; - } - - @Override - public byte getTier() { - return 1; - } - - @Override - public String getTierString() { - return STEAM_TIER_NAMES[tier - 1]; - } - - @Override - public void computePowerUsageAndDuration(int euPerTick, int duration) { - recipeEuPerTick = (int) (euPerTick * euPerTickOverride); - recipeDuration = (int) (duration * durationOverride); - } - - @Override - public String getTotalPowerString() { - // 2L normal steam == 1EU - return GT_Utility.formatNumbers(2L * recipeDuration * recipeEuPerTick) + " Steam"; - } - - @Override - public String getPowerUsageString() { - // 2L normal steam == 1EU - return GT_Utility.formatNumbers(20L * 2L * recipeEuPerTick) + " L/s Steam"; - } - - @Override - public String getVoltageString() { - return null; - } - - @Override - public String getAmperageString() { - return null; - } -} diff --git a/src/main/java/gregtech/common/power/UnspecifiedEUPower.java b/src/main/java/gregtech/common/power/UnspecifiedEUPower.java deleted file mode 100644 index e411f03613..0000000000 --- a/src/main/java/gregtech/common/power/UnspecifiedEUPower.java +++ /dev/null @@ -1,28 +0,0 @@ -package gregtech.common.power; - -import gregtech.api.util.GT_Utility; - -public class UnspecifiedEUPower extends EUPower { - - private final String VOLTAGE = GT_Utility.trans("271", "unspecified"); - private final String AMPERAGE = GT_Utility.trans("271", "unspecified"); - - public UnspecifiedEUPower(byte tier, int amperage) { - super(tier, amperage); - } - - @Override - public String getPowerUsageString() { - return super.getVoltageString(); - } - - @Override - public String getVoltageString() { - return VOLTAGE; - } - - @Override - public String getAmperageString() { - return AMPERAGE; - } -} |
