• 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

57.69
/src/main/java/org/cyclops/integrateddynamics/core/recipe/type/RecipeSerializerSqueezer.java
1
package org.cyclops.integrateddynamics.core.recipe.type;
2

3
import com.google.gson.JsonSyntaxException;
4
import com.mojang.serialization.Codec;
5
import com.mojang.serialization.MapCodec;
6
import com.mojang.serialization.codecs.RecordCodecBuilder;
7
import net.minecraft.core.NonNullList;
8
import net.minecraft.network.RegistryFriendlyByteBuf;
9
import net.minecraft.network.codec.ByteBufCodecs;
10
import net.minecraft.network.codec.StreamCodec;
11
import net.minecraft.world.item.crafting.Ingredient;
12
import net.minecraft.world.item.crafting.RecipeSerializer;
13
import net.neoforged.neoforge.fluids.FluidStack;
14
import org.cyclops.cyclopscore.codec.ListCodecStrict;
15
import org.cyclops.cyclopscore.helper.RecipeSerializerHelpers;
16
import org.cyclops.integrateddynamics.GeneralConfig;
17

18
import java.util.Optional;
19

20
/**
21
 * Recipe serializer for squeezer recipes
22
 * @author rubensworks
23
 */
24
public class RecipeSerializerSqueezer implements RecipeSerializer<RecipeSqueezer> {
3✔
25

26
    public static final Codec<RecipeSqueezer.IngredientChance> CODEC_INGREDIENT_CHANCE = RecipeSerializerHelpers
1✔
27
            .getCodecItemStackOrTagChance(() -> GeneralConfig.recipeTagOutputModPriorities)
3✔
28
            .xmap(
2✔
29
                    RecipeSqueezer.IngredientChance::new,
30
                    RecipeSqueezer.IngredientChance::getIngredientChance
31
            );
32
    public static final StreamCodec<RegistryFriendlyByteBuf, RecipeSqueezer.IngredientChance> STREAM_CODEC_INGREDIENT_CHANCE = RecipeSerializerHelpers.STREAM_CODEC_ITEMSTACK_OR_ITEMSTACKINGREDIENT_CHANCE
3✔
33
            .map(
2✔
34
                    RecipeSqueezer.IngredientChance::new,
35
                    RecipeSqueezer.IngredientChance::getIngredientChance
36
            );
37

38
    public static final MapCodec<RecipeSqueezer> CODEC = RecordCodecBuilder.mapCodec(
3✔
39
            builder -> builder.group(
7✔
40
                            Ingredient.CODEC.fieldOf("input_item").forGetter(RecipeSqueezer::getInputIngredient),
8✔
41
                            new ListCodecStrict<>(RecipeSerializerSqueezer.CODEC_INGREDIENT_CHANCE).optionalFieldOf("output_items").forGetter(r -> r.getOutputItems().isEmpty() ? Optional.empty() : Optional.of(r.getOutputItems().stream().toList())),
5!
42
                            FluidStack.CODEC.optionalFieldOf("output_fluid").forGetter(RecipeSqueezer::getOutputFluid)
3✔
43
                    )
44
                    .apply(builder, (inputIngredient, outputItemStacks, outputFluid) -> {
1✔
45
                        // Validation
46
                        if (outputItemStacks.isEmpty() && outputFluid.isEmpty()) {
×
47
                            throw new JsonSyntaxException("An output item or fluid is required");
×
48
                        }
49

50
                        return new RecipeSqueezer(inputIngredient, outputItemStacks.map(NonNullList::copyOf).orElseGet(NonNullList::create), outputFluid);
×
51
                    })
52
    );
53
    public static final StreamCodec<RegistryFriendlyByteBuf, RecipeSqueezer> STREAM_CODEC = StreamCodec.composite(
7✔
54
            Ingredient.CONTENTS_STREAM_CODEC, RecipeSqueezer::getInputIngredient,
55
            STREAM_CODEC_INGREDIENT_CHANCE.apply(ByteBufCodecs.collection(NonNullList::createWithCapacity)), RecipeSqueezer::getOutputItems,
4✔
56
            ByteBufCodecs.optional(FluidStack.STREAM_CODEC), RecipeSqueezer::getOutputFluid,
3✔
57
            RecipeSqueezer::new
58
    );
59

60
    @Override
61
    public MapCodec<RecipeSqueezer> codec() {
62
        return CODEC;
×
63
    }
64

65
    @Override
66
    public StreamCodec<RegistryFriendlyByteBuf, RecipeSqueezer> streamCodec() {
67
        return STREAM_CODEC;
×
68
    }
69
}
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