Skip to content

Commit

Permalink
fix bug : open recipe from bookmark doesn't add item to view history
Browse files Browse the repository at this point in the history
  • Loading branch information
vfyjxf committed Apr 17, 2022
1 parent 45f2f30 commit 3d17fcc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.daemon=false

# General Specifications
mc_version=1.12.2
mod_version=0.2
mod_version=0.2.1
forge_version=14.23.5.2847
jei_version=4.16.1.302
mod_group=com.github.vfyjxf.jeiutilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public void onMouseClicked(GuiScreenEvent.MouseInputEvent event) {
if (recipeInfo != null) {
IFocus.Mode mode = recipeInfo.isInputMode() ? IFocus.Mode.INPUT : IFocus.Mode.OUTPUT;
recipesGui.show(new Focus<Object>(mode, recipeInfo.getIngredient()));
JeiUtilitiesPlugin.getGrid().removeElement(0);
JeiUtilitiesPlugin.getGrid().addHistoryIngredient(recipeInfo.getResult());
IngredientLookupState state = getState();
if (state != null) {
state.setRecipeCategoryIndex(recipeInfo.getRecipeCategoryIndex());
Expand Down Expand Up @@ -142,6 +144,8 @@ public void onKeyPressed(GuiScreenEvent.KeyboardInputEvent event) {
if (recipeInfo != null) {
IFocus.Mode mode = recipeInfo.isInputMode() ? IFocus.Mode.INPUT : IFocus.Mode.OUTPUT;
recipesGui.show(new Focus<Object>(mode, recipeInfo.getIngredient()));
JeiUtilitiesPlugin.getGrid().removeElement(0);
JeiUtilitiesPlugin.getGrid().addHistoryIngredient(recipeInfo.getResult());
IngredientLookupState state = getState();
if (state != null) {
state.setRecipeCategoryIndex(recipeInfo.getRecipeCategoryIndex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public void addHistoryIngredient(Object value) {

}

public void removeElement(int index){
historyIngredientElements.remove(index);
guiHistoryIngredientSlots.set(0, historyIngredientElements);
}

private <T> T normalize(T ingredient) {
IIngredientHelper<T> ingredientHelper = ingredientRegistry.getIngredientHelper(ingredient);
T copy = LegacyUtil.getIngredientCopy(ingredient, ingredientHelper);
Expand Down

0 comments on commit 3d17fcc

Please sign in to comment.