diff options
author | YannickMG <yannickmg@gmail.com> | 2021-12-30 19:24:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-31 01:24:13 +0100 |
commit | d7930ef92113bcff42059c0b804192ab986ef3c8 (patch) | |
tree | f0939d9bbfdf7c90b97bc5fec051bf0a4119de58 /src/main/java/gregtech/api/util/GT_Recipe.java | |
parent | c25c1bce2dd620c2d39b77f33c57c1fc08b1ecb8 (diff) | |
download | GT5-Unofficial-d7930ef92113bcff42059c0b804192ab986ef3c8.tar.gz GT5-Unofficial-d7930ef92113bcff42059c0b804192ab986ef3c8.tar.bz2 GT5-Unofficial-d7930ef92113bcff42059c0b804192ab986ef3c8.zip |
Basicmachine gui slots highlight fix (#841)
* Updated build script
Also set developmentEnvironmentUserName = Developer
* Added .vscode to .gitignore
* Properly hide unused slots in basic machines
- Adds methods to GT_Recipe_Map to determine whether it contains fluid inputs or outputs
- Adds methods to GT_Slot_Holo to support turning it "off", which also turns off highlighting it on mouse-over
- Uses those changes in GT_GUIContainer_BasicMachine to "turn off" slots unused by a machine
- Some code clarification/deduplication in GT_GUIContainer_BasicMachine
* Hide unused Replicator fluid output slot
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 9fcdac0b51..fe3e90e716 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -845,6 +845,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public final String mUniqueIdentifier; /** + * Whether this recipe map contains any fluid outputs. + */ + private boolean mHasFluidOutputs = false; + + /** * Initialises a new type of Recipe Handler. * * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a pre-initialised Size. @@ -940,12 +945,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe add(GT_Recipe aRecipe) { mRecipeList.add(aRecipe); - for (FluidStack aFluid : aRecipe.mFluidInputs) + for (FluidStack aFluid : aRecipe.mFluidInputs) { if (aFluid != null) { Collection<GT_Recipe> tList = mRecipeFluidMap.computeIfAbsent(aFluid.getFluid(), k -> new HashSet<>(1)); tList.add(aRecipe); mRecipeFluidNameMap.add(aFluid.getFluid().getName()); } + } + if (aRecipe.mFluidOutputs.length != 0) { + this.mHasFluidOutputs = true; + } return addToItemMap(aRecipe); } @@ -1077,6 +1086,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } return aRecipe; } + + /** + * Whether this recipe map contains any fluid outputs. + */ + public boolean hasFluidOutputs() { + return mHasFluidOutputs; + } + + /** + * Whether this recipe map contains any fluid inputs. + */ + public boolean hasFluidInputs() { + return mRecipeFluidNameMap.size() != 0; + } } // ----------------------------------------------------------------------------------------------------------------- |