Interface NarrationMessageBuilder

All Known Implementing Classes:
ScreenNarrator.MessageBuilder

@Environment(CLIENT) public interface NarrationMessageBuilder
A builder for narration messages.

Narration messages consist of multiple sections known as parts. Each narration message can contain only one narration per part.

You can create a submessage by calling nextMessage(). Each submessage can have its own set of narrations for the different narration parts.

The narrations added to a message will be ordered by their part first, in NarrationPart's natural ordering. If there are multiple narrations for a part added through submessages, they will be ordered earliest submessage first.

Mappings:
Namespace Name
official ejv
intermediary net/minecraft/class_6382
named net/minecraft/client/gui/screen/narration/NarrationMessageBuilder
  • Method Details

    • put

      default void put(NarrationPart part, Text text)
      Adds a Text narration to this message builder.

      If a narration already exists for the specified narration part, it is replaced by the new narration.

      Parameters:
      text - the message for the narration
      Implementation Requirements:
      The default implementation behaves like put(part, text.getString()).
      Mappings:
      Namespace Name Mixin selector
      official a Lejv;a(Leju;Lrq;)V
      intermediary method_37034 Lnet/minecraft/class_6382;method_37034(Lnet/minecraft/class_6381;Lnet/minecraft/class_2561;)V
      named put Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;put(Lnet/minecraft/client/gui/screen/narration/NarrationPart;Lnet/minecraft/text/Text;)V
    • put

      default void put(NarrationPart part, String string)
      Adds a string narration to this message builder.

      If a narration already exists for the specified narration part, it is replaced by the new narration.

      Parameters:
      string - the message for the narration
      Mappings:
      Namespace Name Mixin selector
      official a Lejv;a(Leju;Ljava/lang/String;)V
      intermediary method_37033 Lnet/minecraft/class_6382;method_37033(Lnet/minecraft/class_6381;Ljava/lang/String;)V
      named put Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;put(Lnet/minecraft/client/gui/screen/narration/NarrationPart;Ljava/lang/String;)V
    • put

      default void put(NarrationPart part, Text[] texts)
      Adds an array of Text narrations to this message builder.

      Each Text in the input array will be its own sentence as described in Narration.texts(java.util.List<net.minecraft.text.Text>).

      If a narration already exists for the specified narration part, it is replaced by the new narration.

      Parameters:
      texts - the messages for the narration
      Implementation Requirements:
      The default implementation creates a Narration for the texts using Narration.texts(java.util.List<net.minecraft.text.Text>).
      Mappings:
      Namespace Name Mixin selector
      official a Lejv;a(Leju;[Lrq;)V
      intermediary method_37035 Lnet/minecraft/class_6382;method_37035(Lnet/minecraft/class_6381;[Lnet/minecraft/class_2561;)V
      named put Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;put(Lnet/minecraft/client/gui/screen/narration/NarrationPart;[Lnet/minecraft/text/Text;)V
    • put

      void put(NarrationPart part, Narration<?> narration)
      Adds a narration to this message builder.

      If a narration already exists for the specified narration part, it is replaced by the new narration.

      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lejv;a(Leju;Lejx;)V
      intermediary method_37032 Lnet/minecraft/class_6382;method_37032(Lnet/minecraft/class_6381;Lnet/minecraft/class_6384;)V
      named put Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;put(Lnet/minecraft/client/gui/screen/narration/NarrationPart;Lnet/minecraft/client/gui/screen/narration/Narration;)V
    • nextMessage

      Creates a narration message builder for a submessage.

      Submessages can have their own set of narrations for the narration parts, which are merged with the "parent" message's narrations as described above.

      Returns:
      the created builder
      API Note:
      All returned builder instances are equivalent and refer to the same submessage. If you want to add yet another set of narrations, call this method again on the first submessage builder to obtain a "nested" submessage builder.
      Mappings:
      Namespace Name Mixin selector
      official a Lejv;a()Lejv;
      intermediary method_37031 Lnet/minecraft/class_6382;method_37031()Lnet/minecraft/class_6382;
      named nextMessage Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;nextMessage()Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;