Skip to content

Commit

Permalink
fix fast DnD and recipe tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
slprime committed Jan 29, 2024
1 parent 316494d commit e050faa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/java/codechicken/nei/BookmarkPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ public static class BookmarkGrid extends ItemsGrid {

private static class RecipeTooltipRenderer {

public int slotIndex = 0;
public ItemStack stack = null;
public BookmarkRecipeId recipeId = null;

public GuiRecipe<?> gui = null;
public Runnable createRecipeGui = null;
}
Expand Down Expand Up @@ -1071,16 +1073,17 @@ private void drawRecipeTooltip(int mousex, int mousey, List<String> itemTooltip)
return;
}

if (this.recipeTooltipRenderer == null || this.recipeTooltipRenderer.slotIndex != focused.slotIndex) {

if (this.recipeTooltipRenderer == null || this.recipeTooltipRenderer.recipeId != meta.recipeId) {
this.recipeTooltipRenderer = new RecipeTooltipRenderer();
this.recipeTooltipRenderer.slotIndex = focused.slotIndex;
this.recipeTooltipRenderer.stack = this.realItems.get(focused.slotIndex);
this.recipeTooltipRenderer.recipeId = meta.recipeId;

this.recipeTooltipRenderer.createRecipeGui = () -> {
final int slotIndex = this.recipeTooltipRenderer.slotIndex;
final BookmarkRecipeId recipeId = this.metadata.get(slotIndex).recipeId;
GuiRecipe<?> gui = GuiCraftingRecipe
.createRecipeGui("recipeId", false, this.realItems.get(slotIndex), recipeId);
GuiRecipe<?> gui = GuiCraftingRecipe.createRecipeGui(
"recipeId",
false,
this.recipeTooltipRenderer.stack,
this.recipeTooltipRenderer.recipeId);

if (gui != null) {
gui.initGui();
Expand Down

0 comments on commit e050faa

Please sign in to comment.