Compare commits

...

2 commits

Author SHA1 Message Date
rlnt
09c6b9895c bump version
Some checks failed
Build / redirect (push) Has been cancelled
2024-10-23 20:42:48 +00:00
rlnt
ba06760073
fix crash on empty recipe JSONs 2024-10-23 22:36:50 +02:00
4 changed files with 11 additions and 5 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
## Unreleased ## Unreleased
- / - /
## [1.2.2] - 2024-10-23
- fixed crash on empty recipe JSONs
## [1.2.1] - 2024-10-22 ## [1.2.1] - 2024-10-22
- added logging for cases where items are assigned to multiple unification tags - added logging for cases where items are assigned to multiple unification tags
@ -40,6 +44,7 @@ All notable changes to this project will be documented in this file.
Initial 1.21.1 port. Initial 1.21.1 port.
<!-- Versions --> <!-- Versions -->
[1.2.2]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.2.2
[1.2.1]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.2.1 [1.2.1]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.2.1
[1.2.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.2.0 [1.2.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.2.0
[1.1.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.1.0 [1.1.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.21.1-1.1.0

View file

@ -32,13 +32,13 @@ public final class RecipeLink implements RecipeData {
@Nullable @Nullable
public static RecipeLink of(ResourceLocation id, JsonObject originalRecipe) { public static RecipeLink of(ResourceLocation id, JsonObject originalRecipe) {
ResourceLocation type = ResourceLocation.tryParse(originalRecipe.get("type").getAsString()); try {
if (type == null) { ResourceLocation type = ResourceLocation.parse(originalRecipe.get("type").getAsString());
return new RecipeLink(id, originalRecipe, type);
} catch (Exception e) {
AlmostUnifiedCommon.LOGGER.warn("Could not detect recipe type for recipe '{}', skipping.", id); AlmostUnifiedCommon.LOGGER.warn("Could not detect recipe type for recipe '{}', skipping.", id);
return null; return null;
} }
return new RecipeLink(id, originalRecipe, type);
} }
public static RecipeLink ofOrThrow(ResourceLocation id, JsonObject originalRecipe) { public static RecipeLink ofOrThrow(ResourceLocation id, JsonObject originalRecipe) {

View file

@ -112,6 +112,7 @@ public class RecipeTransformer {
return recipes return recipes
.entrySet() .entrySet()
.stream() .stream()
.filter(entry -> entry.getValue() instanceof JsonObject jsonObject && !jsonObject.isEmpty())
.map(entry -> RecipeLink.of(entry.getKey(), entry.getValue().getAsJsonObject())) .map(entry -> RecipeLink.of(entry.getKey(), entry.getValue().getAsJsonObject()))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.sorted(Comparator.comparing(entry -> entry.getId().toString())) .sorted(Comparator.comparing(entry -> entry.getId().toString()))

View file

@ -8,7 +8,7 @@ enableAccessWidener = false
minecraftVersion = 1.21.1 minecraftVersion = 1.21.1
# Mod # Mod
modVersion = 1.2.1 modVersion = 1.2.2
modPackage = com.almostreliable.unified modPackage = com.almostreliable.unified
modId = almostunified modId = almostunified
modName = AlmostUnified modName = AlmostUnified