mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-28 22:05:01 +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 com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
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.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
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.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
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) {
|
public static boolean match(BasinBlockEntity basin, Recipe<?> recipe) {
|
||||||
FilteringBehaviour filter = basin.getFilter();
|
FilteringBehaviour filter = basin.getFilter();
|
||||||
|
@ -148,23 +150,24 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simulate) {
|
if (simulate) {
|
||||||
|
CraftingContainer remainderContainer = new DummyCraftingContainer(availableItems, extractedItemsFromSlot);
|
||||||
|
|
||||||
if (recipe instanceof BasinRecipe basinRecipe) {
|
if (recipe instanceof BasinRecipe basinRecipe) {
|
||||||
recipeOutputItems.addAll(basinRecipe.rollResults());
|
recipeOutputItems.addAll(basinRecipe.rollResults());
|
||||||
|
|
||||||
for (FluidStack fluidStack : basinRecipe.getFluidResults())
|
for (FluidStack fluidStack : basinRecipe.getFluidResults())
|
||||||
if (!fluidStack.isEmpty())
|
if (!fluidStack.isEmpty())
|
||||||
recipeOutputFluids.add(fluidStack);
|
recipeOutputFluids.add(fluidStack);
|
||||||
for (ItemStack stack : basinRecipe.getRemainingItems(basin.getInputInventory()))
|
for (ItemStack stack : basinRecipe.getRemainingItems(remainderContainer))
|
||||||
if (!stack.isEmpty())
|
if (!stack.isEmpty())
|
||||||
recipeOutputItems.add(stack);
|
recipeOutputItems.add(stack);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
recipeOutputItems.add(recipe.getResultItem(basin.getLevel()
|
recipeOutputItems.add(recipe.getResultItem(basin.getLevel()
|
||||||
.registryAccess()));
|
.registryAccess()));
|
||||||
|
|
||||||
if (recipe instanceof CraftingRecipe craftingRecipe) {
|
if (recipe instanceof CraftingRecipe craftingRecipe) {
|
||||||
for (ItemStack stack : craftingRecipe
|
for (ItemStack stack : craftingRecipe.getRemainingItems(remainderContainer))
|
||||||
.getRemainingItems(new DummyCraftingContainer(availableItems, extractedItemsFromSlot)))
|
|
||||||
if (!stack.isEmpty())
|
if (!stack.isEmpty())
|
||||||
recipeOutputItems.add(stack);
|
recipeOutputItems.add(stack);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +228,7 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(SmartInventory inv, @Nonnull Level worldIn) {
|
public boolean matches(Container inv, @Nonnull Level worldIn) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue