Skip to content

Commit

Permalink
make RecipeMemorySlot a jei ingredient provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Feb 1, 2025
1 parent a0cb66b commit 09a8ee5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@

import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.api.widget.Interactable;
import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider;
import com.cleanroommc.modularui.screen.RichTooltip;
import com.cleanroommc.modularui.screen.viewport.ModularGuiContext;
import com.cleanroommc.modularui.theme.WidgetTheme;
import com.cleanroommc.modularui.utils.MouseData;
import com.cleanroommc.modularui.widget.Widget;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class RecipeMemorySlot extends Widget<RecipeMemorySlot> implements Interactable {
public class RecipeMemorySlot extends Widget<RecipeMemorySlot> implements Interactable, JeiIngredientProvider {

private final CraftingRecipeMemory memory;
private final int index;
Expand Down Expand Up @@ -87,4 +89,10 @@ public Result onMousePressed(int mouseButton) {

return Result.ACCEPT;
}

@Override
public @Nullable Object getIngredient() {
if (!this.memory.hasRecipe(this.index)) return null;
return this.memory.getRecipeOutputAtIndex(this.index);
}
}

0 comments on commit 09a8ee5

Please sign in to comment.