• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/core/recipe/handler/RecipeHandlerDryingBasin.java
1
package org.cyclops.integrateddynamics.core.recipe.handler;
2

3
import com.google.common.collect.Lists;
4
import com.google.common.collect.Maps;
5
import com.google.common.collect.Sets;
6
import net.minecraft.core.NonNullList;
7
import net.minecraft.world.item.ItemStack;
8
import net.minecraft.world.item.crafting.RecipeType;
9
import net.minecraft.world.level.Level;
10
import net.neoforged.neoforge.fluids.FluidStack;
11
import net.neoforged.neoforge.transfer.fluid.FluidResource;
12
import net.neoforged.neoforge.transfer.transaction.Transaction;
13
import org.cyclops.commoncapabilities.api.capability.fluidhandler.FluidMatch;
14
import org.cyclops.commoncapabilities.api.capability.recipehandler.IPrototypedIngredientAlternatives;
15
import org.cyclops.commoncapabilities.api.capability.recipehandler.PrototypedIngredientAlternativesList;
16
import org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients;
17
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
18
import org.cyclops.commoncapabilities.api.ingredient.MixedIngredients;
19
import org.cyclops.commoncapabilities.api.ingredient.PrototypedIngredient;
20
import org.cyclops.cyclopscore.ingredient.recipe.IngredientRecipeHelpers;
21
import org.cyclops.cyclopscore.ingredient.recipe.RecipeHandlerRecipeType;
22
import org.cyclops.cyclopscore.recipe.type.IInventoryFluid;
23
import org.cyclops.cyclopscore.recipe.type.InventoryFluid;
24
import org.cyclops.integrateddynamics.core.recipe.type.RecipeDryingBasin;
25

26
import javax.annotation.Nullable;
27
import java.util.List;
28
import java.util.Map;
29
import java.util.function.Supplier;
30

31
/**
32
 * @author rubensworks
33
 */
34
public class RecipeHandlerDryingBasin<T extends RecipeDryingBasin> extends RecipeHandlerRecipeType<IInventoryFluid, T> {
35

36
    public RecipeHandlerDryingBasin(Supplier<Level> worldSupplier, RecipeType<T> recipeType) {
37
        super(worldSupplier,
×
38
                recipeType,
39
                Sets.newHashSet(IngredientComponent.ITEMSTACK, IngredientComponent.FLUIDSTACK),
×
40
                Sets.newHashSet(IngredientComponent.ITEMSTACK, IngredientComponent.FLUIDSTACK));
×
41
    }
×
42

43
    @Nullable
44
    @Override
45
    protected IInventoryFluid getRecipeInputContainer(IMixedIngredients input) {
46
        InventoryFluid inventory = new InventoryFluid(NonNullList.withSize(1, ItemStack.EMPTY), NonNullList.withSize(1, FluidStack.EMPTY));
×
47
        if (!input.getInstances(IngredientComponent.ITEMSTACK).isEmpty()) {
×
48
            inventory.setItem(0, input.getInstances(IngredientComponent.ITEMSTACK).get(0));
×
49
        }
50
        if (!input.getInstances(IngredientComponent.FLUIDSTACK).isEmpty()) {
×
51
            FluidStack fluidStack = input.getInstances(IngredientComponent.FLUIDSTACK).get(0);
×
52
            try (var tx = Transaction.openRoot()) {
×
53
                inventory.getFluidHandler().insert(FluidResource.of(fluidStack), fluidStack.getAmount(), tx);
×
54
                tx.commit();
×
55
            }
56
        }
57
        return inventory;
×
58
    }
59

60
    @Nullable
61
    @Override
62
    protected Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> getRecipeInputIngredients(RecipeDryingBasin recipe) {
63
        Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> inputs = Maps.newIdentityHashMap();
×
64
        if (recipe.getInputIngredient().isPresent()) {
×
65
            inputs.put(IngredientComponent.ITEMSTACK, Lists.newArrayList(IngredientRecipeHelpers.getPrototypesFromIngredient(recipe.getInputIngredient().get())));
×
66
        }
67
        if (recipe.getInputFluid().isPresent()) {
×
68
            inputs.put(IngredientComponent.FLUIDSTACK, Lists.newArrayList(new PrototypedIngredientAlternativesList<>(
×
69
                    Lists.newArrayList(new PrototypedIngredient<>(IngredientComponent.FLUIDSTACK, recipe.getInputFluid().get(), FluidMatch.EXACT)))));
×
70
        }
71
        return inputs;
×
72
    }
73

74
    @Nullable
75
    @Override
76
    protected IMixedIngredients getRecipeOutputIngredients(RecipeDryingBasin recipe) {
77
        Map<IngredientComponent<?, ?>, List<?>> outputIngredients = Maps.newIdentityHashMap();
×
78
        if (!recipe.getOutputItemFirst().isEmpty()) {
×
79
            outputIngredients.put(IngredientComponent.ITEMSTACK, Lists.newArrayList(recipe.getOutputItemFirst()));
×
80
        }
81
        if (!recipe.getOutputFluid().isEmpty()) {
×
82
            outputIngredients.put(IngredientComponent.FLUIDSTACK, Lists.newArrayList(recipe.getOutputFluid().get()));
×
83
        }
84

85
        // Validate output
86
        if (outputIngredients.isEmpty()) {
×
87
            return null;
×
88
        }
89

90
        return new MixedIngredients(outputIngredients);
×
91
    }
92

93
    @Override
94
    public boolean isValidSizeInput(IngredientComponent<?, ?> ingredientComponent, int size) {
95
        return (ingredientComponent == IngredientComponent.ITEMSTACK || ingredientComponent == IngredientComponent.FLUIDSTACK)
×
96
                && size == 1;
97
    }
98
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc