summaryrefslogtreecommitdiff
path: root/ihl/recipes/RecipeInputOreDictionaryList.java
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-02-12 20:43:03 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-02-12 20:43:03 +0300
commit5cb4c6e24033cf337812390d99a6817d24d21eab (patch)
tree695789855920199efd4702a7bb3e4bacfe58b9f0 /ihl/recipes/RecipeInputOreDictionaryList.java
parent8f22398517206aed21a7fd840f463332429fae35 (diff)
Removed explosion radius limitations. Explosion calculation optimized (reduced memory usage). One more detonator and explosive pack recipe. GT6 recipes for both chemical reactors and cryogenic distiller. Max stack size of muffle furnace is limited to 32. A lot of old features are removed.
Diffstat (limited to 'ihl/recipes/RecipeInputOreDictionaryList.java')
-rw-r--r--ihl/recipes/RecipeInputOreDictionaryList.java241
1 files changed, 107 insertions, 134 deletions
diff --git a/ihl/recipes/RecipeInputOreDictionaryList.java b/ihl/recipes/RecipeInputOreDictionaryList.java
index 572f15b..e438d98 100644
--- a/ihl/recipes/RecipeInputOreDictionaryList.java
+++ b/ihl/recipes/RecipeInputOreDictionaryList.java
@@ -10,140 +10,113 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
-public class RecipeInputOreDictionaryList implements IRecipeInput
-{
-
- public final String[] input;
- public final int amount;
- public final Integer meta;
- private List<ItemStack> ores;
-
- public RecipeInputOreDictionaryList(String[] input1)
- {
- this(input1, 1);
- }
-
- public RecipeInputOreDictionaryList(String[] input1, int amount1)
- {
- this(input1, amount1, (Integer)null);
- }
-
- public RecipeInputOreDictionaryList(String[] input1, int amount1, Integer meta)
- {
- this.input = input1;
- this.amount = amount1;
- this.meta = meta;
- }
+public class RecipeInputOreDictionaryList implements IRecipeInput {
+
+ public final String[] input;
+ public final int amount;
+ public final Integer meta;
+ private List<ItemStack> ores;
+
+ public RecipeInputOreDictionaryList(String[] input1) {
+ this(input1, 1);
+ }
+
+ public RecipeInputOreDictionaryList(String[] input1, int amount1) {
+ this(input1, amount1, (Integer) null);
+ }
+
+ public RecipeInputOreDictionaryList(String[] input1, int amount1, Integer meta) {
+ this.input = input1;
+ this.amount = amount1;
+ this.meta = meta;
+ }
+
+ @Override
+ public boolean matches(ItemStack subject) {
+ List<ItemStack> inputs = this.getOres();
+ boolean useOreStackMeta = this.meta == null;
+ Item subjectItem = subject.getItem();
+ int subjectMeta = subject.getItemDamage();
+ Iterator<ItemStack> i$ = inputs.iterator();
+ Item oreItem;
+ int metaRequired;
+
+ do {
+ do {
+ ItemStack oreStack;
+
+ do {
+ if (!i$.hasNext()) {
+ return false;
+ }
+
+ oreStack = i$.next();
+ oreItem = oreStack.getItem();
+ } while (oreItem == null);
+
+ metaRequired = useOreStackMeta ? oreStack.getItemDamage() : this.meta.intValue();
+ } while (subjectItem != oreItem);
+ } while (subjectMeta != metaRequired && metaRequired != 32767);
+
+ return true;
+ }
+
+ @Override
+ public int getAmount() {
+ return this.amount;
+ }
+
+ @Override
+ public List<ItemStack> getInputs() {
+ List<ItemStack> ores = this.getOres();
+ boolean hasInvalidEntries = false;
+ Iterator<ItemStack> ret = ores.iterator();
+
+ while (ret.hasNext()) {
+ ItemStack i$ = ret.next();
+
+ if (i$.getItem() == null) {
+ hasInvalidEntries = true;
+ break;
+ }
+ }
+
+ if (!hasInvalidEntries) {
+ return ores;
+ } else {
+ ArrayList<ItemStack> ret1 = new ArrayList<ItemStack>(ores.size());
+ Iterator<ItemStack> i$1 = ores.iterator();
+
+ while (i$1.hasNext()) {
+ ItemStack stack = i$1.next();
+
+ if (stack.getItem() != null) {
+ ret1.add(stack);
+ }
+ }
+
+ return Collections.unmodifiableList(ret1);
+ }
+ }
@Override
- public boolean matches(ItemStack subject)
- {
- List<ItemStack> inputs = this.getOres();
- boolean useOreStackMeta = this.meta == null;
- Item subjectItem = subject.getItem();
- int subjectMeta = subject.getItemDamage();
- Iterator<ItemStack> i$ = inputs.iterator();
- Item oreItem;
- int metaRequired;
-
- do
- {
- do
- {
- ItemStack oreStack;
-
- do
- {
- if (!i$.hasNext())
- {
- return false;
- }
-
- oreStack = i$.next();
- oreItem = oreStack.getItem();
- }
- while (oreItem == null);
-
- metaRequired = useOreStackMeta ? oreStack.getItemDamage() : this.meta.intValue();
- }
- while (subjectItem != oreItem);
- }
- while (subjectMeta != metaRequired && metaRequired != 32767);
-
- return true;
- }
-
- @Override
- public int getAmount()
- {
- return this.amount;
- }
-
- @Override
- public List<ItemStack> getInputs()
- {
- List<ItemStack> ores = this.getOres();
- boolean hasInvalidEntries = false;
- Iterator<ItemStack> ret = ores.iterator();
-
- while (ret.hasNext())
- {
- ItemStack i$ = ret.next();
-
- if (i$.getItem() == null)
- {
- hasInvalidEntries = true;
- break;
- }
- }
-
- if (!hasInvalidEntries)
- {
- return ores;
- }
- else
- {
- ArrayList<ItemStack> ret1 = new ArrayList<ItemStack>(ores.size());
- Iterator<ItemStack> i$1 = ores.iterator();
-
- while (i$1.hasNext())
- {
- ItemStack stack = i$1.next();
-
- if (stack.getItem() != null)
- {
- ret1.add(stack);
- }
- }
-
- return Collections.unmodifiableList(ret1);
- }
- }
-
- @Override
- public String toString()
- {
- return this.meta == null ? "RInputOreDict<" + this.amount + "x" + this.input + ">" : "RInputOreDict<" + this.amount + "x" + this.input + "@" + this.meta + ">";
- }
-
- private List<ItemStack> getOres()
- {
- if (this.ores != null)
- {
- return this.ores;
- }
- else
- {
- this.ores = new ArrayList<ItemStack>();
- for(int i=0;i<this.input.length;i++)
- {
- ArrayList<ItemStack> ret = OreDictionary.getOres(this.input[i]);
- if (ret != OreDictionary.EMPTY_LIST)
- {
- this.ores.addAll(ret);
- }
- }
- return this.ores;
- }
- }
+ public String toString() {
+ return this.meta == null ? "RInputOreDict<" + this.amount + "x" + this.input + ">"
+ : "RInputOreDict<" + this.amount + "x" + this.input + "@" + this.meta + ">";
+ }
+
+ private List<ItemStack> getOres() {
+ if (this.ores != null) {
+ return this.ores;
+ } else {
+ this.ores = new ArrayList<ItemStack>();
+ for (int i = 0; i < this.input.length; i++) {
+ ArrayList<ItemStack> ret = OreDictionary.getOres(this.input[i]);
+ if (ret != OreDictionary.EMPTY_LIST) {
+ this.ores.addAll(ret);
+ }
+ }
+ return this.ores;
+ }
+ }
}