diff options
author | Yang Xizhi <60341015+GlodBlock@users.noreply.github.com> | 2021-12-14 00:22:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 17:22:04 +0100 |
commit | e9a9ffe767d617f47a8376e268f0d438b132f78f (patch) | |
tree | 5cc4a6cef323b63d49e645bc59f0bfcec66bbaab /src | |
parent | ce50964f714e363c4ea72bfd2899fafbc363c12b (diff) | |
download | GT5-Unofficial-e9a9ffe767d617f47a8376e268f0d438b132f78f.tar.gz GT5-Unofficial-e9a9ffe767d617f47a8376e268f0d438b132f78f.tar.bz2 GT5-Unofficial-e9a9ffe767d617f47a8376e268f0d438b132f78f.zip |
Fix wildcard (#70)
* add full dust recipe in plat-line
* fix derp
* turbine compact for BW material
* fix wildcard stuff
* remove log
Former-commit-id: 8fa6886bf8c1cac10036c70a51328f52fbdef71f
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java index ab2fd8976a..bce9676001 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java @@ -1,5 +1,6 @@ package com.github.bartimaeusnek.bartworks.util; +import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; @@ -29,7 +30,17 @@ public class RecipeFinderForParallel { } } for (int tItem : tCompressedItemRecipe.keySet()) { - if (tCompressedItemInput.containsKey(tItem) && tCompressedItemRecipe.get(tItem) != 0) { + /*Wildcard Stuff*/ + if (tItem >> 16 == Short.MAX_VALUE) { + int tCountWildcard = 0; + for (int tInputItem : tCompressedItemInput.keySet()) { + if ((tInputItem & 0xffff) == (tItem & 0xffff)) { + tCountWildcard += tCompressedItemInput.get(tInputItem); + } + } + tCurrentPara = Math.min(tCurrentPara, tCountWildcard / tCompressedItemRecipe.get(tItem)); + } + else if (tCompressedItemInput.containsKey(tItem) && tCompressedItemRecipe.get(tItem) != 0) { tCurrentPara = Math.min(tCurrentPara, tCompressedItemInput.get(tItem) / tCompressedItemRecipe.get(tItem)); } } @@ -47,7 +58,7 @@ public class RecipeFinderForParallel { if (tFluid != null && tCompressedFluidRecipe.containsKey(tFluid.getFluidID())) { if (tFluid.amount >= tCompressedFluidRecipe.get(tFluid.getFluidID())) { tFluid.amount -= tCompressedFluidRecipe.get(tFluid.getFluidID()); - tCompressedItemRecipe.remove(tFluid.getFluidID()); + tCompressedFluidRecipe.remove(tFluid.getFluidID()); } else { tCompressedFluidRecipe.put(tFluid.getFluidID(), tCompressedFluidRecipe.get(tFluid.getFluidID()) - tFluid.amount); @@ -68,6 +79,26 @@ public class RecipeFinderForParallel { } } } + /*Wildcard Stuff*/ + for (int tItem : tCompressedItemRecipe.keySet()) { + if (tItem >> 16 == Short.MAX_VALUE) { + for (ItemStack tInputItem : aItemStacks) { + int InputID = GT_Utility.stackToInt(tInputItem); + if ((InputID & 0xffff) == (tItem & 0xffff)) { + if (tInputItem.stackSize >= tCompressedItemRecipe.get(tItem)) { + tInputItem.stackSize -= tCompressedItemRecipe.get(tItem); + tCompressedItemRecipe.remove(tItem); + break; + } + else { + tCompressedItemRecipe.put(tItem, tCompressedItemRecipe.get(tItem) - tInputItem.stackSize); + tInputItem.stackSize = 0; + } + } + } + } + } + return tCurrentPara; } |