mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 13:28:00 +01:00
use remaining items to calculate remainder items for basin recipes
This commit is contained in:
parent
eb2f1fecdc
commit
2e25d4fdb2
1 changed files with 10 additions and 7 deletions
|
@ -22,6 +22,8 @@ import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
|||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -32,7 +34,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||
public class BasinRecipe extends ProcessingRecipe<Container> {
|
||||
|
||||
public static boolean match(BasinBlockEntity basin, Recipe<?> recipe) {
|
||||
FilteringBehaviour filter = basin.getFilter();
|
||||
|
@ -148,23 +150,24 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
|||
}
|
||||
|
||||
if (simulate) {
|
||||
CraftingContainer remainderContainer = new DummyCraftingContainer(availableItems, extractedItemsFromSlot);
|
||||
|
||||
if (recipe instanceof BasinRecipe basinRecipe) {
|
||||
recipeOutputItems.addAll(basinRecipe.rollResults());
|
||||
|
||||
|
||||
for (FluidStack fluidStack : basinRecipe.getFluidResults())
|
||||
if (!fluidStack.isEmpty())
|
||||
recipeOutputFluids.add(fluidStack);
|
||||
for (ItemStack stack : basinRecipe.getRemainingItems(basin.getInputInventory()))
|
||||
for (ItemStack stack : basinRecipe.getRemainingItems(remainderContainer))
|
||||
if (!stack.isEmpty())
|
||||
recipeOutputItems.add(stack);
|
||||
|
||||
|
||||
} else {
|
||||
recipeOutputItems.add(recipe.getResultItem(basin.getLevel()
|
||||
.registryAccess()));
|
||||
|
||||
if (recipe instanceof CraftingRecipe craftingRecipe) {
|
||||
for (ItemStack stack : craftingRecipe
|
||||
.getRemainingItems(new DummyCraftingContainer(availableItems, extractedItemsFromSlot)))
|
||||
for (ItemStack stack : craftingRecipe.getRemainingItems(remainderContainer))
|
||||
if (!stack.isEmpty())
|
||||
recipeOutputItems.add(stack);
|
||||
}
|
||||
|
@ -225,7 +228,7 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(SmartInventory inv, @Nonnull Level worldIn) {
|
||||
public boolean matches(Container inv, @Nonnull Level worldIn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue