Skip to content

Commit

Permalink
fix: read the source of Hurt correctly (#73)
Browse files Browse the repository at this point in the history
* fix: read the source of Hurt correctly

* fix: typo

* fix: use constructor instead of `ResourceLocation#tryParse`
  • Loading branch information
SettingDust committed Mar 7, 2024
1 parent d19de69 commit 6967cc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public boolean matchesFallingBlock(BlockState blockstate, CompoundTag nbt) {
return false;
} else {
if (access.getNbt() != NbtPredicate.ANY) {
if (nbt == null || !access.getNbt().matches(nbt)) {
return false;
}
return nbt != null && access.getNbt().matches(nbt);
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/snownee/lychee/core/post/Hurt.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static class Type extends PostActionType<Hurt> {

@Override
public Hurt fromJson(JsonObject o) {
return new Hurt(MinMaxBounds.Doubles.fromJson(o.get("damage")), new ResourceLocation("generic"));
return new Hurt(MinMaxBounds.Doubles.fromJson(o.get("damage")), new ResourceLocation(o.get("source").getAsString()));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/snownee/lychee/core/post/If.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public boolean preventSync() {
public void validate(ILycheeRecipe<?> recipe, ILycheeRecipe.NBTPatchContext patchContext) {
Preconditions.checkArgument(!getConditions().isEmpty() || failureEntries.length == 0, "Failure entries must be empty when there is no condition");
for (PostAction action : getChildActions().toList()) {
Preconditions.checkArgument(action.getClass() != NBTPatch.class, "NBTPatch cannot be used in RandomSelect");
Preconditions.checkArgument(action.getClass() != NBTPatch.class, "NBTPatch cannot be used in If");
action.validate(recipe, patchContext);
}
}
Expand Down

0 comments on commit 6967cc9

Please sign in to comment.