Skip to content

Commit

Permalink
Merge pull request #885 from LemonCaramel/fix/translate-fallback
Browse files Browse the repository at this point in the history
fix some issues with translatable component fallback
  • Loading branch information
kashike authored Mar 24, 2023
2 parents 8a32fac + 8b3cd4a commit fbe91f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected <O extends NBTComponent<O, B>, B extends NBTComponentBuilder<O, B>> B
// of this component might need additional rendering

final TranslatableComponent.Builder builder = Component.translatable()
.key(component.key());
.key(component.key()).fallback(component.fallback());
if (!component.args().isEmpty()) {
final List<Component> args = new ArrayList<>(component.args());
for (int i = 0, size = args.size(); i < size; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ final class ComponentSerializerImpl extends TypeAdapter<Component> {
static final String TRANSLATE = "translate";
static final String TRANSLATE_FALLBACK = "fallback";
static final String TRANSLATE_WITH = "with";
static final String FALLBACK = "fallback";
static final String SCORE = "score";
static final String SCORE_NAME = "name";
static final String SCORE_OBJECTIVE = "objective";
Expand Down Expand Up @@ -275,10 +274,6 @@ public void write(final JsonWriter out, final Component value) throws IOExceptio
out.name(TRANSLATE_WITH);
this.gson.toJson(translatable.args(), COMPONENT_LIST_TYPE, out);
}
if (translatable.fallback() != null) {
out.name(FALLBACK);
out.value(translatable.fallback());
}
} else if (value instanceof ScoreComponent) {
final ScoreComponent score = (ScoreComponent) value;
out.name(SCORE);
Expand Down

0 comments on commit fbe91f9

Please sign in to comment.