Skip to content

Commit

Permalink
fix: crashes due to recipe codec null handling
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Jan 20, 2024
1 parent 5c37e0f commit 0205c01
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class RitualRecipe implements Recipe<Container> {
Ingredient.CODEC.optionalFieldOf("item_to_use").forGetter(r -> Optional.ofNullable(r.itemToUse)),
Codec.STRING.optionalFieldOf("command").forGetter(r -> Optional.ofNullable(r.command))
).apply(instance, (pentacleId, ritualType, ritualDummy, result, entityToSummon, entityNbt, activationItem, ingredients, duration, spiritMaxAge, spiritJobType, entityToSacrifice, itemToUse, command) -> new RitualRecipe(pentacleId, ritualType, ritualDummy, result, entityToSummon.orElse(null), entityNbt.orElse(null), activationItem,
NonNullList.copyOf(ingredients), duration, spiritMaxAge, spiritJobType.orElse(null), entityToSacrifice.orElse(null), itemToUse.orElse(null), command.orElse(null)))
NonNullList.copyOf(ingredients), duration, spiritMaxAge, spiritJobType.orElse(null), entityToSacrifice.orElse(null), itemToUse.orElse(Ingredient.EMPTY), command.orElse(null)))
);
public static Serializer SERIALIZER = new Serializer();
final ItemStack result;
Expand Down Expand Up @@ -224,7 +224,7 @@ public Ritual getRitual() {
}

public String getEntityToSacrificeDisplayName() {
return this.entityToSacrifice.displayName();
return this.entityToSacrifice != null ? this.entityToSacrifice.displayName() : "";
}

public ResourceLocation getSpiritJobType() {
Expand Down

0 comments on commit 0205c01

Please sign in to comment.