Skip to content

Commit

Permalink
Merge pull request #65 from GTNewHorizons/fix_list
Browse files Browse the repository at this point in the history
fix wrong array list
  • Loading branch information
boubou19 authored Jul 23, 2024
2 parents d333aa2 + b632b2b commit 2d8ac4a
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 22 deletions.
13 changes: 7 additions & 6 deletions src/main/java/gttweaker/mods/gregtech/machines/BlastFurnace.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static gregtech.api.util.GT_RecipeConstants.COIL_HEAT;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -63,14 +64,14 @@ public static void addRecipe(IItemStack[] output, ILiquidStack fluidOutput, IIng
protected void applySingleRecipe(ArgIterator i) {
ItemStack input1 = i.nextItem();
ItemStack input2 = i.nextItem();
List<ItemStack> inputs = Arrays.asList(input1, input2);
List<ItemStack> inputs = new ArrayList<>(Arrays.asList(input1, input2));
inputs.removeIf(Objects::isNull);

FluidStack fluidInput = i.nextFluid();
FluidStack fluidOutput = i.nextFluid();
ItemStack output1 = i.nextItem();
ItemStack output2 = i.nextItem();
List<ItemStack> outputs = Arrays.asList(output1, output2);
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(output1, output2));
outputs.removeIf(Objects::isNull);
int duration = i.nextInt();
int eut = i.nextInt();
Expand Down Expand Up @@ -108,13 +109,13 @@ public static void addRecipe(IItemStack[] output, ILiquidStack fluidInput, IIngr
protected void applySingleRecipe(ArgIterator i) {
ItemStack input1 = i.nextItem();
ItemStack input2 = i.nextItem();
List<ItemStack> inputs = Arrays.asList(input1, input2);
List<ItemStack> inputs = new ArrayList<>(Arrays.asList(input1, input2));
inputs.removeIf(Objects::isNull);

FluidStack fluidInput = i.nextFluid();
ItemStack output1 = i.nextItem();
ItemStack output2 = i.nextItem();
List<ItemStack> outputs = Arrays.asList(output1, output2);
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(output1, output2));
outputs.removeIf(Objects::isNull);
int duration = i.nextInt();
int eut = i.nextInt();
Expand Down Expand Up @@ -148,12 +149,12 @@ public static void addRecipe(IItemStack[] output, IIngredient[] input, int durat
protected void applySingleRecipe(ArgIterator i) {
ItemStack input1 = i.nextItem();
ItemStack input2 = i.nextItem();
List<ItemStack> inputs = Arrays.asList(input1, input2);
List<ItemStack> inputs = new ArrayList<>(Arrays.asList(input1, input2));
inputs.removeIf(Objects::isNull);

ItemStack output1 = i.nextItem();
ItemStack output2 = i.nextItem();
List<ItemStack> outputs = Arrays.asList(output1, output2);
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(output1, output2));
outputs.removeIf(Objects::isNull);
int duration = i.nextInt();
int eut = i.nextInt();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/gttweaker/mods/gregtech/machines/Canner.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.cannerRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -73,7 +74,7 @@ protected void applySingleRecipe(ArgIterator i) {
ItemStack input2 = i.nextItem();
ItemStack output1 = i.nextItem();
ItemStack output2 = i.nextItem();
List<ItemStack> outputs = Arrays.asList(output1, output2);
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(output1, output2));
outputs.removeIf(Objects::isNull);

int duration = i.nextInt();
Expand Down
23 changes: 18 additions & 5 deletions src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -73,8 +74,14 @@ protected void applySingleRecipe(ArgIterator i) {
ItemStack input2 = i.nextItem();
FluidStack fluidInput = i.nextFluid();
FluidStack fluidOutput = i.nextFluid();
List<ItemStack> outputs = Arrays
.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem()));
outputs.removeIf(Objects::isNull);

int[] chances = i.nextIntArr();
Expand Down Expand Up @@ -122,13 +129,19 @@ protected void applySingleRecipe(ArgIterator i) {
ItemStack input1 = i.nextItem();
int cellNumber = i.nextInt();
ItemStack input2 = cellNumber > 0 ? ItemList.Cell_Empty.get(cellNumber) : null;
List<ItemStack> inputs = Arrays.asList(input1, input2);
List<ItemStack> inputs = new ArrayList<>(Arrays.asList(input1, input2));
inputs.removeIf(Objects::isNull);

FluidStack fluidInput = i.nextFluid();
FluidStack fluidOutput = i.nextFluid();
List<ItemStack> outputs = Arrays
.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem()));
outputs.removeIf(Objects::isNull);

int[] chances = i.nextIntArr();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.chemicalBathRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -61,7 +62,8 @@ public static void addRecipe(IItemStack[] output, IIngredient input, ILiquidStac
protected void applySingleRecipe(ArgIterator i) {
ItemStack input = i.nextItem();
FluidStack fluidInput = i.nextFluid();
List<ItemStack> outputs = Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem()));
outputs.removeIf(Objects::isNull);
int[] chances = i.nextIntArr();
int duration = i.nextInt();
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.electrolyzerRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -71,8 +72,14 @@ protected void applySingleRecipe(ArgIterator i) {
ItemStack[] inputs = new ItemStack[] { i.nextItem(), i.nextItem() };
FluidStack fluidInput = i.nextFluid();
FluidStack fluidOutput = i.nextFluid();
List<ItemStack> outputs = Arrays
.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem()));
outputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down Expand Up @@ -113,8 +120,14 @@ protected void applySingleRecipe(ArgIterator i) {
ItemStack[] inputs = new ItemStack[] { i.nextItem(), i.nextItem() };
FluidStack fluidInput = i.nextFluid();
FluidStack fluidOutput = i.nextFluid();
List<ItemStack> outputs = Arrays
.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem(),
i.nextItem()));
outputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static gregtech.api.util.GT_RecipeConstants.ADDITIVE_AMOUNT;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -68,7 +69,7 @@ protected void applySingleRecipe(ArgIterator i) {
int additiveAmount = i.nextInt();
ItemStack output1 = i.nextItem();
ItemStack output2 = i.nextItem();
List<ItemStack> outputs = Arrays.asList(output1, output2);
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(output1, output2));
outputs.removeIf(Objects::isNull);
RA.stdBuilder()
.itemInputs(input)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/gttweaker/mods/gregtech/machines/Lathe.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.latheRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -65,7 +66,7 @@ public static void addRecipe(IItemStack[] outputs, IIngredient input, int durati
@Override
protected void applySingleRecipe(ArgIterator i) {
ItemStack input = i.nextItem();
List<ItemStack> outputs = Arrays.asList(i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(Arrays.asList(i.nextItem(), i.nextItem()));
outputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/gttweaker/mods/gregtech/machines/Mixer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.mixerRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -59,7 +60,8 @@ public static void addRecipe(IItemStack output, ILiquidStack fluidOutput, IIngre

@Override
protected void applySingleRecipe(ArgIterator i) {
List<ItemStack> inputs = Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> inputs = new ArrayList<>(
Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem()));
inputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down Expand Up @@ -93,7 +95,8 @@ public static void addRecipe(IItemStack output, IIngredient[] input, int duratio

@Override
protected void applySingleRecipe(ArgIterator i) {
List<ItemStack> inputs = Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> inputs = new ArrayList<>(
Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem()));
inputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.recipe.RecipeMaps.electroMagneticSeparatorRecipes;
import static gttweaker.util.ArrayHelper.itemOrNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -58,7 +59,8 @@ public static void addRecipe(IItemStack[] output, IIngredient input, int[] outCh
@Override
protected void applySingleRecipe(ArgIterator i) {
ItemStack input = i.nextItem();
List<ItemStack> outputs = Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem());
List<ItemStack> outputs = new ArrayList<>(
Arrays.asList(i.nextItem(), i.nextItem(), i.nextItem()));
outputs.removeIf(Objects::isNull);

RA.stdBuilder()
Expand Down

0 comments on commit 2d8ac4a

Please sign in to comment.