Skip to content

Commit

Permalink
Fix blueberry text being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed May 25, 2022
1 parent 7f28171 commit 5f3e354
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import net.blueberrymc.network.CustomComponentSerializer;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.ComponentContents;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style;
import net.minecraft.util.GsonHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
Expand All @@ -21,6 +23,7 @@
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

Expand Down Expand Up @@ -135,6 +138,25 @@ public BlueberryText cloneWithArgs(@Nullable Object@Nullable... args) {
return new BlueberryText(namespace, path, args);
}

@Override
public <T> @NotNull Optional<T> visit(@NotNull FormattedText.ContentConsumer<T> contentConsumer) {
return contentConsumer.accept(getContents());
}

@Override
public <T> @NotNull Optional<T> visit(@NotNull FormattedText.StyledContentConsumer<T> styledContentConsumer, @NotNull Style style) {
return styledContentConsumer.accept(style, getContents());
}

@Override
public String toString() {
return "BlueberryText{" +
"namespace='" + namespace + '\'' +
", path='" + path + '\'' +
", args=" + args +
'}';
}

static {
CustomComponentSerializer.registerSerializer(BlueberryText.class, new Serializer());
}
Expand Down

0 comments on commit 5f3e354

Please sign in to comment.