aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
authorDavid Vierra <codewarrior@hawaii.rr.com>2018-01-28 03:03:09 -1000
committerDavid Vierra <codewarrior@hawaii.rr.com>2018-01-28 03:07:05 -1000
commitc691dafed53cd962993df166d8d50cab535bf459 (patch)
tree4f195951c9eb37e624c4e51dd802d04be257b6ff /src/Java/gtPlusPlus/core
parentf7594feadd1c947eccf7e3c611b0b3ec75cd16ea (diff)
downloadGT5-Unofficial-c691dafed53cd962993df166d8d50cab535bf459.tar.gz
GT5-Unofficial-c691dafed53cd962993df166d8d50cab535bf459.tar.bz2
GT5-Unofficial-c691dafed53cd962993df166d8d50cab535bf459.zip
Rewrite and refactor checkRecipe() for several multiblocks, restore machine sounds
`checkRecipeGeneric()` implements parallel processing, EU/t discounts and speed boosts, increased random chances, and can be used to consider each input bus individually (as seen in the Industrial Material Press) to allow each bus to use a different Configuration Circuit. Also considers the voltage input limit of the multiblock when counting recipes to do in parallel - if the energy hatch is too small, it will process fewer recipes at once. Plays the machine's sound, if any, on success. `checkRecipeGeneric()` also checks `canBufferOutput()` and will pause the machine if it has no bus/hatch room for the recipe output. `getValidOutputSlots()` is rewritten as `canBufferOutput()`, which now checks both the item output buses and fluid output hatches to make sure recipe output can be accepted. This is used to pause a machine instead of allowing it to continue working and void outputs, if the outputs can't be stored in a bus and/or hatch. NOTE: `canBufferOutput()` doesn't consider parallel processing, so there are a few recipes where, if done in parallel, it may get a false positive on the buffer check and void some outputs. In practice, this will rarely happen. Removed unused imports, fields, and locals. Industrial Centrifuge now uses `checkRecipeGeneric()` with 4 parallel recipes and a 40% speed boost. Industrial Coke Oven now uses `checkRecipeGeneric()` with 12 parallel recipes if using Heat-Resistant Casings, or 24 if using Heat-Proof Casings. Sound plays while processing. Industrial Cutting Machine now uses `checkRecipeGeneric()` with 2 parallel recipes and a 60% speed boost. Pollution removed since the Machine is built with no Muffler Hatch. Industrial Electrolyzer now uses `checkRecipeGeneric()` with 2 parallel recipes and a 40% speed boost. Maceration Stack now uses `checkRecipeGeneric()` with 8*tTier parallel recipes, a 60% speed boost, and an increased amount (~33%) of random outputs. Sound plays while processing. Material Press now uses `checkRecipeGeneric()` with 2 parallel recipes and a 50% speed boost. Each input bus is considered separately for finding recipes, allowing each bus to hold a different Configuration Circuit. Sound plays while processing. Industrial Sifter now uses `checkRecipeGeneric()` with 2 parallel recipes, a 400% speed boost, and an increased amount (~15%) of random outputs. Changed particles to appear above the sieve grates. Industrial Thermal Centrifuge now uses `checkRecipeGeneric()` with 2 parallel recipes and a 60% speed boost. Industrial Washing Plant now uses `checkRecipeGeneric()` with 2 parallel recipes and an 80% speed boost. Stone Dust outputs are no longer deleted. Wire Factory now uses `checkRecipeGeneric()` with 2 parallel recipes and a 60% speed boost. Sound plays while processing.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/util/array/ArrayUtils.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java
index 910c4597af..c3addca79e 100644
--- a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java
+++ b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java
@@ -1,6 +1,11 @@
package gtPlusPlus.core.util.array;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class ArrayUtils {
@@ -15,4 +20,9 @@ public class ArrayUtils {
return series;
}
+ public static ItemStack[] removeNulls(final ItemStack[] v) {
+ List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v));
+ list.removeAll(Collections.singleton((ItemStack)null));
+ return list.toArray(new ItemStack[list.size()]);
+ }
}