Skip to content

Commit

Permalink
Bugfixing (#48)
Browse files Browse the repository at this point in the history
- Fixes a bug that caused the game to crash when a player uses the gradient with no parameters.
- Fixed "%player:hunger%" from not working and erroring.
  • Loading branch information
senseiwells committed Nov 28, 2023
1 parent 4023b7b commit b548d9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public static void register() {

Placeholders.register(new Identifier("player", "hunger"), (ctx, arg) -> {
if (ctx.hasPlayer()) {
return PlaceholderResult.value(String.format("%.0f", ctx.player().getHungerManager().getFoodLevel()));
return PlaceholderResult.value(String.valueOf(ctx.player().getHungerManager().getFoodLevel()));
} else {
return PlaceholderResult.invalid("No player!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ public static void register() {
textColors.add(color);
}
}
// We cannot have an empty list!
if (textColors.isEmpty()) {
return out.value(new ParentNode(out.nodes()));
}

return out.value(GradientNode.colorsHard(textColors, out.nodes()));

}
Expand Down

0 comments on commit b548d9a

Please sign in to comment.