aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java20
-rw-r--r--src/main/java/com/github/technus/tectech/util/ItemStackLong.java6
3 files changed, 31 insertions, 13 deletions
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
index 2ec4ffabb1..aa71c388d8 100644
--- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
@@ -67,12 +67,24 @@ public class EyeOfHarmonyRecipe {
this.miningTimeSeconds = miningTimeSeconds;
}
- public List<ItemStackLong> getOutputItems() {
- return outputItems;
+ // Return clone of list.
+ public ArrayList<ItemStackLong> getOutputItems() {
+ ArrayList<ItemStackLong> copyOutputList = new ArrayList<>();
+ for (ItemStackLong itemStackLong : outputItems) {
+ copyOutputList.add(new ItemStackLong(itemStackLong));
+ }
+
+ return copyOutputList;
}
public FluidStack[] getOutputFluids() {
- return outputFluids;
+ ArrayList<FluidStack> copyOutputList = new ArrayList<>();
+
+ for (FluidStack fluidStack : outputFluids) {
+ copyOutputList.add(fluidStack.copy());
+ }
+
+ return copyOutputList.toArray(new FluidStack[0]);
}
public long getHydrogenRequirement() {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
index 8599a97432..72d9e80bf4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
@@ -1694,8 +1694,8 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
public boolean processRecipe(EyeOfHarmonyRecipe recipeObject) {
- if ((getHydrogenStored() < currentRecipe.getHydrogenRequirement())
- && (getHeliumStored() < currentRecipe.getHeliumRequirement())) {
+ // todo: fix changing the tier of block causing multi to unform
+ if ((getHydrogenStored() < currentRecipe.getHydrogenRequirement()) || (getHeliumStored() < currentRecipe.getHeliumRequirement())) {
return false;
}
@@ -1731,18 +1731,18 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
validFluidMap.put(Materials.Helium.getGas(1), 0L);
double yield = recipeYieldCalculator();
- yield = 1; //todo debug, remove.
successChance = 1; // todo debug, remove.
- mOutputFluids = recipeObject.getOutputFluids().clone();
-
- // Iterate over item output list and apply yield values.
- for (ItemStackLong itemStack : recipeObject.getOutputItems()) {
- itemStack.stackSize *= yield;
- outputItems.add(itemStack);
- }
+ // Return copies of the output objects.
+ mOutputFluids = recipeObject.getOutputFluids();
+ outputItems = recipeObject.getOutputItems();
if (yield != 1.0) {
+ // Iterate over item output list and apply yield values.
+ for (ItemStackLong itemStackLong : outputItems) {
+ itemStackLong.stackSize *= yield;
+ }
+
// Iterate over fluid output list and apply yield values.
for (FluidStack fluidStack : mOutputFluids) {
fluidStack.amount *= yield;
diff --git a/src/main/java/com/github/technus/tectech/util/ItemStackLong.java b/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
index e245cc94bf..68a7bafd04 100644
--- a/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
+++ b/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
@@ -11,4 +11,10 @@ public class ItemStackLong {
this.itemStack = itemStack;
this.stackSize = stackSize;
}
+
+ // Copy constructor.
+ public ItemStackLong(ItemStackLong itemStackLong) {
+ this.itemStack = itemStackLong.itemStack;
+ this.stackSize = itemStackLong.stackSize;
+ }
}