From d7930ef92113bcff42059c0b804192ab986ef3c8 Mon Sep 17 00:00:00 2001 From: YannickMG Date: Thu, 30 Dec 2021 19:24:13 -0500 Subject: 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 --- src/main/java/gregtech/api/util/GT_Recipe.java | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/util') 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 @@ -844,6 +844,11 @@ public class GT_Recipe implements Comparable { */ public final String mUniqueIdentifier; + /** + * Whether this recipe map contains any fluid outputs. + */ + private boolean mHasFluidOutputs = false; + /** * Initialises a new type of Recipe Handler. * @@ -940,12 +945,16 @@ public class GT_Recipe implements Comparable { public GT_Recipe add(GT_Recipe aRecipe) { mRecipeList.add(aRecipe); - for (FluidStack aFluid : aRecipe.mFluidInputs) + for (FluidStack aFluid : aRecipe.mFluidInputs) { if (aFluid != null) { Collection 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 { } 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; + } } // ----------------------------------------------------------------------------------------------------------------- -- cgit