/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.google.common.collect.ImmutableList */ package net.minecraft.network.chat; import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Optional; import net.minecraft.network.chat.Style; import net.minecraft.util.Unit; public interface FormattedText { public static final Optional STOP_ITERATION = Optional.of(Unit.INSTANCE); public static final FormattedText EMPTY = new FormattedText(){ @Override public Optional visit(ContentConsumer output) { return Optional.empty(); } @Override public Optional visit(StyledContentConsumer output, Style parentStyle) { return Optional.empty(); } }; public Optional visit(ContentConsumer var1); public Optional visit(StyledContentConsumer var1, Style var2); public static FormattedText of(final String text) { return new FormattedText(){ @Override public Optional visit(ContentConsumer output) { return output.accept(text); } @Override public Optional visit(StyledContentConsumer output, Style parentStyle) { return output.accept(parentStyle, text); } }; } public static FormattedText of(final String text, final Style style) { return new FormattedText(){ @Override public Optional visit(ContentConsumer output) { return output.accept(text); } @Override public Optional visit(StyledContentConsumer output, Style parentStyle) { return output.accept(style.applyTo(parentStyle), text); } }; } public static FormattedText composite(FormattedText ... parts) { return FormattedText.composite((List)ImmutableList.copyOf((Object[])parts)); } public static FormattedText composite(final List parts) { return new FormattedText(){ @Override public Optional visit(ContentConsumer output) { for (FormattedText part : parts) { Optional result = part.visit(output); if (!result.isPresent()) continue; return result; } return Optional.empty(); } @Override public Optional visit(StyledContentConsumer output, Style parentStyle) { for (FormattedText part : parts) { Optional result = part.visit(output, parentStyle); if (!result.isPresent()) continue; return result; } return Optional.empty(); } }; } default public String getString() { StringBuilder builder = new StringBuilder(); this.visit(contents -> { builder.append(contents); return Optional.empty(); }); return builder.toString(); } public static interface ContentConsumer { public Optional accept(String var1); } public static interface StyledContentConsumer { public Optional accept(Style var1, String var2); } }