Skip to content

Commit

Permalink
Fix jei drag (#1973)
Browse files Browse the repository at this point in the history
Co-authored-by: YoungOnion <[email protected]>
  • Loading branch information
EasterFG and YoungOnionMC authored Sep 19, 2024
1 parent 569eb61 commit 14e321a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ default Object convertIngredient(Object ingredient) {
ingredient = fluid == null ? FluidStack.empty() :
FluidStack.create(fluid, fluidEmiStack.getAmount(), fluidEmiStack.getNbt());
}

if (LDLib.isJeiLoaded() && ingredient instanceof net.minecraftforge.fluids.FluidStack fluidStack) {
ingredient = FluidStack.create(fluidStack.getFluid(), fluidStack.getAmount(), fluidStack.getTag());
}
return ingredient;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.google.common.collect.Lists;
import dev.emi.emi.api.stack.EmiStack;
import mezz.jei.api.ingredients.ITypedIngredient;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
Expand Down Expand Up @@ -53,10 +54,15 @@ public void accept(@NotNull Object ingredient) {
default Object convertIngredient(Object ingredient) {
if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack itemEmiStack) {
Item item = itemEmiStack.getKeyOfType(Item.class);
ingredient = item == null ? null : new ItemStack(item, (int) itemEmiStack.getAmount());
if (ingredient instanceof ItemStack itemStack) {
ItemStack itemStack = item == null ? ItemStack.EMPTY : new ItemStack(item, (int) itemEmiStack.getAmount());
if (!itemStack.isEmpty()) {
itemStack.setTag(itemEmiStack.getNbt());
}
ingredient = itemStack;
}

if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient<?> itemJeiStack) {
return itemJeiStack.getItemStack().orElse(ItemStack.EMPTY);
}
return ingredient;
}
Expand Down

0 comments on commit 14e321a

Please sign in to comment.