Skip to content

Commit

Permalink
Use draw wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyploszaj committed Sep 19, 2023
1 parent 1891a07 commit 3301e59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xplat/src/main/java/dev/emi/emi/jemi/JemiRecipeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import dev.emi.emi.jemi.impl.JemiRecipeLayoutBuilder;
import dev.emi.emi.jemi.impl.JemiRecipeSlot;
import dev.emi.emi.jemi.impl.JemiRecipeSlotsView;
import dev.emi.emi.runtime.EmiDrawContext;
import mezz.jei.api.gui.builder.IIngredientAcceptor;
import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.ingredients.ITypedIngredient;
Expand Down Expand Up @@ -79,13 +80,14 @@ public boolean craft(EmiRecipe recipe, EmiCraftContext<T> context) {

@Override
public void render(EmiRecipe recipe, EmiCraftContext<T> context, List<Widget> widgets, DrawContext raw) {
EmiDrawContext draw = EmiDrawContext.wrap(raw);
IRecipeTransferError err = jeiCraft(recipe, context, false);
if (err != null) {
if (err.getType() == IRecipeTransferError.Type.COSMETIC) {
for (Widget widget : widgets) {
if (widget instanceof RecipeFillButtonWidget) {
Bounds b = widget.getBounds();
raw.fill(b.left(), b.top(), b.right(), b.bottom(), err.getButtonHighlightColor());
draw.fill(b.left(), b.top(), b.width(), b.height(), err.getButtonHighlightColor());
}
}
}
Expand Down

0 comments on commit 3301e59

Please sign in to comment.