Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: read the source of Hurt correctly #73

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")), ResourceLocation.tryParse(o.get("source").getAsString()));
SettingDust marked this conversation as resolved.
Show resolved Hide resolved
}

@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