diff options
author | miozune <miozune@gmail.com> | 2023-12-04 05:34:27 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-03 21:34:27 +0100 |
commit | f74c7cc297d1d19d38a19683cd277ad9ce605d3a (patch) | |
tree | b2a5d66ec5a959099240fb1db239ffc0f9531839 /src/main/java/gregtech/common/power | |
parent | b08cde7de4ec93cba05fb070991ad1dffb800ce1 (diff) | |
download | GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.tar.gz GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.tar.bz2 GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.zip |
Refactor RecipeMap (#2345)
* Remove deprecated and unused things
* Move recipemap subclasses
* Move GT_Recipe_Map to outside and rename to RecipeMap
* Move recipemap instances to separated class & remove prepending s
* Remove useless GT_Recipe constructors
* Always use ModularUI
* Rename IGT_RecipeMap -> IRecipeMap
* Add RecipeMapBuilder
* Remove more deprecated and unused things
* Fix RecipeMap type parameters
* Use multimap for recipe index
* Fix bending recipe error in dev env
* Remove mUniqueIdentifier
* Update AE2FC
* Less edgy texture for NEI recipe background
* Add replicator fluid output slot for NEI and machine GUI
* Fix fluid fuels not having fuel value in large boilers
* Remove GT_RectHandler and NEI_TransferRectHost
* Remove RecipeMapHandler
* Move NEI energy description from RecipeMapFrontend to Power
* Refactor the way to filter fusion recipes
* Check restriction for some properties
* Remove showVoltageAmperage
* Make Power accept GT_Recipe
* Fix NPE
* Move NEI duration description to Power from Frontend
* Directly implement IRecipeProcessingAwareHatch for GT_MetaTileEntity_Hatch_InputBus_ME
* Make Power integrated with GT_OverclockCalculator
* Rename Power -> OverclockDescriber
* Don't modify recipe find logic until postload finishes
* Reformat reserved MTE ids
* Fix check for too few inputs on recipe addition
* Move replicator logic to backend
* Stop un-hiding assline recipes
* Allow setting custom recipe comparator & implement for fusion
* Update AE2FC
* Rename getRecipeList and getRecipes -> getRecipeMap
* Automatically register recipe catalysts
* Cleanup the way to detect recipe collision
* Make use of BasicUIProperties for basic machines
* Make use of BasicUIProperties for UIHelper
* Rename specialHandler -> recipeTransformer
* Add way to automatically register handler info
* Add recipe category
* Add some APIs for addons
* Rename blastRecipes ->
blastFurnaceRecipes
* Remove GT_MetaTileEntity_BasicMachine_GT_Recipe#mSharedTank and #mRequiresFluidForFiltering
* Don't require setting duration and EU/t for fuel recipes
* Don't require setting EU/t for primitive blast furnace recipes
* Revert change to addMultiblockChemicalRecipe
* Fix large boiler general desc recipe not being added
* Hide duration and EU/t from large boiler
* Cleanup recipe stacktrace draw
* Extend metadata usage of recipe builder to recipe itself
* Implement metadata handling & NEI comparator for PCB factory
* Some rename around NEIRecipeInfo
* Some toString implementations
* Add more APIs for addons & some rename
* Infer handler icon from recipe catalyst if one is not set
* Also shrink recipe title when OC is not used
* Remove rare earth centrifuge recipe
* Use metadata for replicator backend
* Adjust geothermal generator output slot
* Allow having multiple transferrects
* Store recipemap reference in backend
* Rename vacuumRecipes -> vacuumFreezerRecipes
* Add config to tweak visibility of recipe categories
* Remove mHideRecyclingRecipes in favor of recipe category config
* Fix typo fluidSolidfierRecipes -> fluidSolidifierRecipes
* Refactor findRecipe and ProcessingLogic to use Stream
* Fix BBF handler icon & remove bronze blast furnace
* Add fluent API for findRecipe
* Add way to stop adding progressbar
* Change arg order for special texture
* Avoid overwriting interesting failure with NO_RECIPE
* Some changes for FuelBackend
* Set space project icon
* Remove localization from TT
* Remove CNC recipe adder
* Move recipe extractor from AE2FC
* Minor internal change for ProcessingLogic#applyRecipe
* More javadoc on #getAvailableRecipeMaps
* Better implementation of #ofSupplier
* Move replicator exponent config to GT_Proxy
* Remove RC & IC2 macerator handling
* Rename StreamUtil -> GT_StreamUtil
* Refactor code around RecipeMetadataStorage
* Revise #compileRecipe javadoc
* Switch extreme diesel recipe loader to downstream recipe map
* Optimize #reMap
* Rename reload -> reloadNEICache
* Minor tweak for drawEnergyInfo
* a bit more doc
* Adjust recipe catalysts
* Add toString implementation for GT_Fluid for debug
* Minor revision for OilCrackerBackend
* Index replicator recipes by material
---------
Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
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; - } -} |