Use shortcut key to trigger overlay recipe (#248)

* Use shortcut key to trigger overlay recipe

* Add a way to remove overlay renderer

* Change of implementation

* Fix crash
This commit is contained in:
MuXiu1997 authored and GitHub committed 2022-05-16 17:57:00 +02:00
1 parent 91e9b2a5ae
commit d735cc2a38
6 files changed
+94 -63

No files matched your search

@@ -346,12 +346,8 @@ public class BookmarkPanel extends PanelWidget
public BookmarkRecipeId getBookmarkRecipeId(ItemStack stackA)
{
final Point mousePos = getMousePosition();
final ItemPanelSlot slot = getSlotMouseOver(mousePos.x, mousePos.y);
if (slot != null && StackInfo.equalItemAndNBT(slot.item, stackA, true)) {
return ((BookmarkGrid) grid).getRecipeId(slot.slotIndex);
}
BookmarkRecipeId mouseOverRecipeId = getBookmarkMouseOverRecipeId(stackA);
if (mouseOverRecipeId != null) return mouseOverRecipeId;
BookmarkRecipeId recipeId = ((BookmarkGrid) grid).findRecipeId(stackA);
@@ -367,6 +363,25 @@ public class BookmarkPanel extends PanelWidget
return recipeId;
}
public BookmarkRecipeId getBookmarkMouseOverRecipeId(ItemStack stackA)
{
final Point mousePos = getMousePosition();
final ItemPanelSlot slot = getSlotMouseOver(mousePos.x, mousePos.y);
if (slot != null) {
if (stackA == null || StackInfo.equalItemAndNBT(slot.item, stackA, true)) {
return ((BookmarkGrid) grid).getRecipeId(slot.slotIndex);
}
}
return null;
}
public BookmarkRecipeId getBookmarkMouseOverRecipeId()
{
return getBookmarkMouseOverRecipeId(null);
}
protected String getNamespaceLabelText(boolean shortFormat)
{
String activePage = String.valueOf(activeNamespaceIndex + 1);