aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-12-05 13:34:58 +0800
committerGitHub <noreply@github.com>2022-12-05 06:34:58 +0100
commit1ba0be9f2746403843082589b75fe3353d71b4e4 (patch)
tree10711214f614558029f84af367a05fa4fc6b74ef
parentfd6750ad7c16c749db5ce30b63fb8518e62b3cb7 (diff)
downloadGT5-Unofficial-1ba0be9f2746403843082589b75fe3353d71b4e4.tar.gz
GT5-Unofficial-1ba0be9f2746403843082589b75fe3353d71b4e4.tar.bz2
GT5-Unofficial-1ba0be9f2746403843082589b75fe3353d71b4e4.zip
fix IOOBE in bio vat (#241)
Former-commit-id: 344a9899f5bb84dd966add9b097382ddf3e9e4c1
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
index cbfd68b39b..6d3ec8383c 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
@@ -88,7 +88,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
private int mSievert;
private int mNeededSievert;
private int mCasing = 0;
- private int mExpectedTimes = 0;
+ private int mExpectedMultiplier = 0;
private int mTimes = 0;
public GT_TileEntity_BioVat(int aID, String aName, String aNameRegional) {
@@ -222,7 +222,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
* @param needEqual if the recipeFluidOutput should be equal to the fluid in the output hatch
* @return the expected output multiplier
*/
- private int getExpectedTimes(@Nullable FluidStack recipeFluidOutput, boolean needEqual) {
+ private int getExpectedMultiplier(@Nullable FluidStack recipeFluidOutput, boolean needEqual) {
FluidStack storedFluidOutputs = this.getStoredFluidOutputs();
if (storedFluidOutputs == null) return 1;
if (!needEqual || storedFluidOutputs.isFluidEqual(recipeFluidOutput)) {
@@ -319,10 +319,10 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
final FluidStack recipeFluidOutput = gtRecipe.getFluidOutput(0);
final FluidStack recipeFluidInput = gtRecipe.mFluidInputs[0];
- this.mExpectedTimes = this.getExpectedTimes(recipeFluidOutput, true);
+ this.mExpectedMultiplier = this.getExpectedMultiplier(recipeFluidOutput, true);
this.mTimes = 1;
- for (int i = 1; i < this.mExpectedTimes; i++) {
+ for (int i = 1; i < this.mExpectedMultiplier; i++) {
if (this.depleteInput(recipeFluidInput)) {
this.mTimes++;
}
@@ -755,9 +755,13 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
final String[] baseInfoData = super.getInfoData();
final String[] infoData = new String[baseInfoData.length + 2];
System.arraycopy(baseInfoData, 0, infoData, 0, baseInfoData.length);
+ // See https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11923
+ // here we must check the machine is well-formed as otherwise getExpectedMultiplier might error out!
infoData[infoData.length - 2] = StatCollector.translateToLocal("BW.infoData.BioVat.expectedProduction") + ": "
+ EnumChatFormatting.GREEN
- + (mMaxProgresstime <= 0 ? getExpectedTimes(null, false) : mExpectedTimes) * 100
+ + (mMachine
+ ? (mMaxProgresstime <= 0 ? getExpectedMultiplier(null, false) : mExpectedMultiplier) * 100
+ : -1)
+ EnumChatFormatting.RESET + " %";
infoData[infoData.length - 1] =
StatCollector.translateToLocal("BW.infoData.BioVat.production") + ": " + EnumChatFormatting.GREEN