Skip to content

Commit 75f5fc8

Browse files
committed
fix: 🐛 Fixed duplicate and broken Alkahestry recipes in JEI view
1 parent 7aa4d2a commit 75f5fc8

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ loader_version_range=[4,)
1515
mod_id=reliquary
1616
mod_name=Reliquary Reincarnations
1717
mod_license=All Rights Reserved
18-
mod_version=2.0.70
18+
mod_version=2.0.71
1919
mod_group_id=net.p3pp3rf1y
2020
mod_authors=P3pp3rF1y
2121
mod_description=Two words: magical swag. Oh, and a gun.

src/main/java/reliquary/crafting/AlkahestryChargingRecipe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static class Serializer implements RecipeSerializer<AlkahestryChargingRec
126126
)
127127
.apply(instance, AlkahestryChargingRecipe::new));
128128
private static final StreamCodec<RegistryFriendlyByteBuf, AlkahestryChargingRecipe> STREAM_CODEC = StreamCodec.composite(
129-
Ingredient.CONTENTS_STREAM_CODEC,
129+
ByteBufCodecs.fromCodecWithRegistries(Ingredient.CODEC),
130130
AlkahestryChargingRecipe::getChargingIngredient,
131131
ByteBufCodecs.INT,
132132
AlkahestryChargingRecipe::getChargeToAdd,

src/main/java/reliquary/crafting/AlkahestryCraftingRecipe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static class Serializer implements RecipeSerializer<AlkahestryCraftingRec
163163
)
164164
.apply(instance, AlkahestryCraftingRecipe::new));
165165
private static final StreamCodec<RegistryFriendlyByteBuf, AlkahestryCraftingRecipe> STREAM_CODEC = StreamCodec.composite(
166-
Ingredient.CONTENTS_STREAM_CODEC,
166+
ByteBufCodecs.fromCodecWithRegistries(Ingredient.CODEC),
167167
AlkahestryCraftingRecipe::getCraftingIngredient,
168168
ByteBufCodecs.INT,
169169
AlkahestryCraftingRecipe::getChargeNeeded,

src/main/java/reliquary/crafting/AlkahestryRecipeRegistry.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@ public static List<AlkahestryCraftingRecipe> getCraftingRecipes() {
2929
}
3030

3131
static void registerCraftingRecipe(AlkahestryCraftingRecipe alkahestryCraftingRecipe) {
32-
craftingRecipes.add(alkahestryCraftingRecipe);
32+
if (craftingRecipes.stream().noneMatch(recipe -> recipe.getCraftingIngredient().equals(alkahestryCraftingRecipe.getCraftingIngredient())
33+
&& recipe.getChargeNeeded() == alkahestryCraftingRecipe.getChargeNeeded()
34+
&& recipe.getResultCount() == alkahestryCraftingRecipe.getResultCount())) {
35+
craftingRecipes.add(alkahestryCraftingRecipe);
36+
}
3337
}
3438

3539
static void registerChargingRecipe(AlkahestryChargingRecipe alkahestryChargingRecipe) {
36-
chargingRecipes.add(alkahestryChargingRecipe);
40+
if (chargingRecipes.stream().noneMatch(recipe -> recipe.getChargingIngredient().equals(alkahestryChargingRecipe.getChargingIngredient())
41+
&& recipe.getChargeToAdd() == alkahestryChargingRecipe.getChargeToAdd())) {
42+
chargingRecipes.add(alkahestryChargingRecipe);
43+
}
3744
}
3845

3946
public static List<AlkahestryChargingRecipe> getChargingRecipes() {

src/main/java/reliquary/crafting/InfernalTearValueRecipe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static class Serializer implements RecipeSerializer<InfernalTearValueReci
7979
)
8080
.apply(instance, InfernalTearValueRecipe::new));
8181
private static final StreamCodec<RegistryFriendlyByteBuf, InfernalTearValueRecipe> STREAM_CODEC = StreamCodec.composite(
82-
Ingredient.CONTENTS_STREAM_CODEC,
82+
ByteBufCodecs.fromCodecWithRegistries(Ingredient.CODEC),
8383
InfernalTearValueRecipe::getIngredient,
8484
ByteBufCodecs.INT,
8585
InfernalTearValueRecipe::getExperiencePoints,

0 commit comments

Comments
 (0)