Skip to content

Commit

Permalink
Separate item and fluid tooltip callbacks (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumquat-ir authored Nov 12, 2021
1 parent 0be128b commit 36f31d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void getIngredients(@Nonnull IIngredients ingredients) {
}
}

public void addTooltip(int slotIndex, boolean input, Object ingredient, List<String> tooltip) {
public void addItemTooltip(int slotIndex, boolean input, Object ingredient, List<String> tooltip) {
boolean notConsumed = input && recipe.isNotConsumedInput(ingredient);
ChanceEntry entry = input ? null : chanceOutput.get(slotIndex);

Expand All @@ -109,6 +109,14 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List<Str
}
}

public void addFluidTooltip(int slotIndex, boolean input, Object ingredient, List<String> tooltip) {
boolean notConsumed = input && recipe.isNotConsumedInput(ingredient);

if (notConsumed) {
tooltip.add(I18n.format("gregtech.recipe.not_consumed"));
}
}

@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
int yPosition = recipeHeight - getPropertyListHeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip
}
}
}
itemStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
fluidStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
itemStackGroup.addTooltipCallback(recipeWrapper::addItemTooltip);
fluidStackGroup.addTooltipCallback(recipeWrapper::addFluidTooltip);
itemStackGroup.set(ingredients);
fluidStackGroup.set(ingredients);
}
Expand Down

0 comments on commit 36f31d7

Please sign in to comment.