diff options
| author | VinDevGH <65317011+VinDevGH@users.noreply.github.com> | 2024-10-25 18:40:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-25 23:40:33 +0000 |
| commit | 64cc28633dca68e7071e5541a371cad4f35ea525 (patch) | |
| tree | a467d1e446b2de3ea7afc3fc9fd3becafb171f3b /src/main/java/gregtech/common/tileentities/machines/multi/purification | |
| parent | f5b1ce0880c45006a3ad2b2124e0c36abbfa3d30 (diff) | |
| download | GT5-Unofficial-64cc28633dca68e7071e5541a371cad4f35ea525.tar.gz GT5-Unofficial-64cc28633dca68e7071e5541a371cad4f35ea525.tar.bz2 GT5-Unofficial-64cc28633dca68e7071e5541a371cad4f35ea525.zip | |
fix waterline cycle breaking on reload (#3420)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/multi/purification')
| -rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBase.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBase.java index b43421bd82..5276607c9a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBase.java @@ -357,6 +357,7 @@ public abstract class MTEPurificationUnitBase<T extends MTEExtendedPowerMultiBlo * @param progressTime Current progress time */ public void startCycle(int cycleTime, int progressTime) { + ThreadLocalRandom random = ThreadLocalRandom.current(); startRecipeProcessing(); // Important to calculate this before depleting inputs, otherwise we may get issues with boost items // disappearing. @@ -385,34 +386,38 @@ public abstract class MTEPurificationUnitBase<T extends MTEExtendedPowerMultiBlo fluidOutputs[i] = this.currentRecipe.mFluidOutputs[i].copy(); fluidOutputs[i].amount *= effectiveParallel; } - this.mOutputFluids = fluidOutputs; - this.mOutputItems = this.currentRecipe.mOutputs; - // Set this value, so it can be displayed in Waila. Note that the logic for the units is - // specifically overridden so setting this value does not actually drain power. - // Instead, power is drained by the main purification plant controller. - this.lEUt = -this.getActualPowerUsage(); - endRecipeProcessing(); - } - public void addRecipeOutputs() { - ThreadLocalRandom random = ThreadLocalRandom.current(); - this.addFluidOutputs(mOutputFluids); - // If this recipe has random item outputs, roll on it and add outputs + ItemStack[] itemOutputs = new ItemStack[this.currentRecipe.mOutputs.length]; + + // If this recipe has random item outputs, roll on it and add to outputs if (this.currentRecipe.mChances != null) { // Roll on each output individually for (int i = 0; i < this.currentRecipe.mOutputs.length; ++i) { // Recipes store probabilities as a value ranging from 1-10000 int roll = random.nextInt(10000); if (roll <= this.currentRecipe.mChances[i]) { - this.addOutput(this.currentRecipe.mOutputs[i]); + itemOutputs[i] = this.currentRecipe.mOutputs[i].copy(); } } } else { // Guaranteed item output for (int i = 0; i < this.currentRecipe.mOutputs.length; ++i) { - this.addOutput(this.currentRecipe.mOutputs[i]); + itemOutputs[i] = this.currentRecipe.mOutputs[i].copy(); } } + + this.mOutputFluids = fluidOutputs; + this.mOutputItems = itemOutputs; + // Set this value, so it can be displayed in Waila. Note that the logic for the units is + // specifically overridden so setting this value does not actually drain power. + // Instead, power is drained by the main purification plant controller. + this.lEUt = -this.getActualPowerUsage(); + endRecipeProcessing(); + } + + public void addRecipeOutputs() { + this.addFluidOutputs(mOutputFluids); + this.addItemOutputs(mOutputItems); } public void endCycle() { |
