From 67639364b3a88210c4cade0b237db9c15b9209c7 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:41:27 +0100 Subject: [PATCH] fix: Add support for itemstack-aware recipe remainders in Fabric, https://github.com/TwelveIterationMods/CookingForBlockheads/issues/656 --- .../java/net/blay09/mods/balm/fabric/FabricBalmHooks.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalmHooks.java b/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalmHooks.java index daae2896..ff117f0f 100644 --- a/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalmHooks.java +++ b/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalmHooks.java @@ -7,6 +7,8 @@ import net.blay09.mods.balm.api.event.server.ServerStartedEvent; import net.blay09.mods.balm.api.event.server.ServerStoppedEvent; import net.blay09.mods.balm.api.fluid.FluidTank; +import net.fabricmc.fabric.api.item.v1.FabricItem; +import net.fabricmc.fabric.api.item.v1.FabricItemStack; import net.fabricmc.fabric.api.registry.FuelRegistry; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; @@ -69,6 +71,10 @@ public boolean isFakePlayer(Player player) { @Override public ItemStack getCraftingRemainingItem(ItemStack itemStack) { + if ((Object) itemStack instanceof FabricItemStack fabricItemStack) { + return fabricItemStack.getRecipeRemainder(); + } + Item craftingRemainingItem = itemStack.getItem().getCraftingRemainingItem(); if (craftingRemainingItem != null) { return new ItemStack(craftingRemainingItem);