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

CyclopsMC / CommonCapabilities / #479006705

21 Mar 2024 03:43PM UTC coverage: 39.629% (-0.3%) from 39.919%
#479006705

push

github

rubensworks
Fix failing unit tests

877 of 2213 relevant lines covered (39.63%)

0.4 hits per line

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

55.17
/src/main/java/org/cyclops/commoncapabilities/IngredientComponents.java
1
package org.cyclops.commoncapabilities;
2

3
import com.google.common.collect.Lists;
4
import net.minecraft.nbt.CompoundTag;
5
import net.minecraft.resources.ResourceLocation;
6
import net.minecraft.world.item.Item;
7
import net.minecraft.world.item.ItemStack;
8
import net.minecraft.world.level.material.Fluid;
9
import net.neoforged.neoforge.capabilities.Capabilities;
10
import net.neoforged.neoforge.fluids.FluidStack;
11
import org.cyclops.commoncapabilities.api.capability.fluidhandler.FluidMatch;
12
import org.cyclops.commoncapabilities.api.capability.itemhandler.ItemMatch;
13
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
14
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponentCategoryType;
15
import org.cyclops.commoncapabilities.ingredient.IngredientMatcherEnergy;
16
import org.cyclops.commoncapabilities.ingredient.IngredientMatcherFluidStack;
17
import org.cyclops.commoncapabilities.ingredient.IngredientMatcherItemStack;
18
import org.cyclops.commoncapabilities.ingredient.IngredientSerializerEnergy;
19
import org.cyclops.commoncapabilities.ingredient.IngredientSerializerFluidStack;
20
import org.cyclops.commoncapabilities.ingredient.IngredientSerializerItemStack;
21
import org.cyclops.commoncapabilities.ingredient.storage.IngredientComponentStorageWrapperHandlerEnergyStorage;
22
import org.cyclops.commoncapabilities.ingredient.storage.IngredientComponentStorageWrapperHandlerFluidStack;
23
import org.cyclops.commoncapabilities.ingredient.storage.IngredientComponentStorageWrapperHandlerItemStack;
24
import org.cyclops.commoncapabilities.ingredient.storage.IngredientComponentStorageWrapperHandlerItemStackSlotless;
25

26
/**
27
 * The ingredient components that will be registered by this mod.
28
 *
29
 * These should not be used directly, get their instances via the registry instead!
30
 *
31
 * @author rubensworks
32
 */
33
public class IngredientComponents {
×
34

35
    public static final IngredientComponent<ItemStack, Integer> ITEMSTACK =
1✔
36
            new IngredientComponent<>("minecraft:itemstack", new IngredientMatcherItemStack(),
37
                    new IngredientSerializerItemStack(), Lists.newArrayList(
1✔
38
                    new IngredientComponentCategoryType<>(new ResourceLocation("itemstack/item"),
39
                            Item.class, true,ItemStack::getItem, ItemMatch.ITEM, false),
1✔
40
                    new IngredientComponentCategoryType<>(new ResourceLocation("itemstack/count"),
41
                            Integer.class, false, ItemStack::getCount, ItemMatch.STACKSIZE, true),
1✔
42
                    new IngredientComponentCategoryType<>(new ResourceLocation("itemstack/tag"),
43
                            CompoundTag.class, false, ItemStack::getTag, ItemMatch.TAG, false)
1✔
44
            )).setTranslationKey("recipecomponent.minecraft.itemstack");
1✔
45

46
    public static final IngredientComponent<FluidStack, Integer> FLUIDSTACK =
1✔
47
            new IngredientComponent<>("minecraft:fluidstack", new IngredientMatcherFluidStack(),
48
                    new IngredientSerializerFluidStack(), Lists.newArrayList(
1✔
49
                    new IngredientComponentCategoryType<>(new ResourceLocation("fluidstack/fluid"),
50
                            Fluid.class, true, FluidStack::getFluid, FluidMatch.FLUID, false),
1✔
51
                    new IngredientComponentCategoryType<>(new ResourceLocation("fluidstack/amount"),
52
                            Integer.class, false, FluidStack::getAmount, FluidMatch.AMOUNT, true),
1✔
53
                    new IngredientComponentCategoryType<>(new ResourceLocation("fluidstack/tag"),
54
                            CompoundTag.class, false, FluidStack::getTag, FluidMatch.TAG, false)
1✔
55
            )).setTranslationKey("recipecomponent.minecraft.fluidstack");
1✔
56

57
    public static final IngredientComponent<Long, Boolean> ENERGY =
1✔
58
            new IngredientComponent<>("minecraft:energy", new IngredientMatcherEnergy(),
59
                    new IngredientSerializerEnergy(), Lists.newArrayList(
1✔
60
                    new IngredientComponentCategoryType<>(new ResourceLocation("energy/amount"),
61
                            Long.class, false, amount -> amount, true, true)
1✔
62
            )).setTranslationKey("recipecomponent.minecraft.energy");
1✔
63

64
    public static void registerStorageWrapperHandlers() {
65
        ENERGY.setStorageWrapperHandler(Capabilities.EnergyStorage.BLOCK, new IngredientComponentStorageWrapperHandlerEnergyStorage<>(ENERGY, Capabilities.EnergyStorage.BLOCK));
×
66
        ENERGY.setStorageWrapperHandler(Capabilities.EnergyStorage.ITEM, new IngredientComponentStorageWrapperHandlerEnergyStorage<>(ENERGY, Capabilities.EnergyStorage.ITEM));
×
67
        ENERGY.setStorageWrapperHandler(Capabilities.EnergyStorage.ENTITY, new IngredientComponentStorageWrapperHandlerEnergyStorage<>(ENERGY, Capabilities.EnergyStorage.ENTITY));
×
68

69
        ITEMSTACK.setStorageWrapperHandler(Capabilities.ItemHandler.BLOCK, new IngredientComponentStorageWrapperHandlerItemStack<>(ITEMSTACK, Capabilities.ItemHandler.BLOCK, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.BLOCK));
×
70
        ITEMSTACK.setStorageWrapperHandler(Capabilities.ItemHandler.ITEM, new IngredientComponentStorageWrapperHandlerItemStack<>(ITEMSTACK, Capabilities.ItemHandler.ITEM, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ITEM));
×
71
        ITEMSTACK.setStorageWrapperHandler(Capabilities.ItemHandler.ENTITY, new IngredientComponentStorageWrapperHandlerItemStack<>(ITEMSTACK, Capabilities.ItemHandler.ENTITY, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ENTITY));
×
72

73
        ITEMSTACK.setStorageWrapperHandler(org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.BLOCK, new IngredientComponentStorageWrapperHandlerItemStackSlotless<>(ITEMSTACK, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.BLOCK));
×
74
        ITEMSTACK.setStorageWrapperHandler(org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ITEM, new IngredientComponentStorageWrapperHandlerItemStackSlotless<>(ITEMSTACK, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ITEM));
×
75
        ITEMSTACK.setStorageWrapperHandler(org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ENTITY, new IngredientComponentStorageWrapperHandlerItemStackSlotless(ITEMSTACK, org.cyclops.commoncapabilities.api.capability.Capabilities.SlotlessItemHandler.ENTITY));
×
76

77
        FLUIDSTACK.setStorageWrapperHandler(Capabilities.FluidHandler.BLOCK, new IngredientComponentStorageWrapperHandlerFluidStack<>(FLUIDSTACK, Capabilities.FluidHandler.BLOCK));
×
78
        FLUIDSTACK.setStorageWrapperHandler(Capabilities.FluidHandler.ENTITY, new IngredientComponentStorageWrapperHandlerFluidStack<>(FLUIDSTACK, Capabilities.FluidHandler.ENTITY));
×
79
    }
×
80

81
}
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