Skip to content

Commit

Permalink
Fix #1622
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Oct 11, 2024
1 parent 107f6b5 commit 27c02e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
Expand Down Expand Up @@ -75,7 +74,8 @@ public static void consumeRecipes(Consumer<EmptyingRecipe> consumer) {
if (handler == null)
return;
FluidStack extracted = TransferUtil.extractAnyFluid(handler, FluidConstants.BUCKET);
ItemStack result = ctx.getItemVariant().toStack(ItemHelper.truncateLong(ctx.getAmount()));
int amount = ctx.getItemVariant().isBlank() ? 0 : (int) ctx.getAmount(); // GH#1622
ItemStack result = ctx.getItemVariant().toStack(ItemHelper.truncateLong(amount));
if (extracted.isEmpty())
return;
if (result.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PotionItem;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.Level;

Expand Down Expand Up @@ -65,7 +64,8 @@ public static Pair<FluidStack, ItemStack> emptyItem(Level world, ItemStack stack
return Pair.of(resultingFluid, resultingItem);
try (Transaction t = TransferUtil.getTransaction()) {
resultingFluid = TransferUtil.extractAnyFluid(tank, FluidConstants.BUCKET);
resultingItem = ctx.getItemVariant().toStack((int) ctx.getAmount());
int amount = ctx.getItemVariant().isBlank() ? 0 : (int) ctx.getAmount(); // GH#1622
resultingItem = ctx.getItemVariant().toStack(amount);
if (!simulate) {
stack.shrink(1);
t.commit();
Expand Down

0 comments on commit 27c02e5

Please sign in to comment.