Record Class DisplayInfo

java.lang.Object
java.lang.Record
net.minecraft.advancements.DisplayInfo

public record DisplayInfo(ItemStackTemplate icon, Component title, Component description, Optional<ClientAsset.ResourceTexture> background, AdvancementType type, boolean showToast, boolean announceToChat, boolean hidden) extends Record
  • Field Details

    • icon

      private final ItemStackTemplate icon
      The field for the icon record component.
    • title

      private final Component title
      The field for the title record component.
    • description

      private final Component description
      The field for the description record component.
    • background

      private final Optional<ClientAsset.ResourceTexture> background
      The field for the background record component.
    • type

      private final AdvancementType type
      The field for the type record component.
    • showToast

      private final boolean showToast
      The field for the showToast record component.
    • announceToChat

      private final boolean announceToChat
      The field for the announceToChat record component.
    • hidden

      private final boolean hidden
      The field for the hidden record component.
    • CODEC

      public static final com.mojang.serialization.Codec<DisplayInfo> CODEC
    • STREAM_CODEC

      public static final StreamCodec<RegistryFriendlyByteBuf, DisplayInfo> STREAM_CODEC
  • Constructor Details

    • DisplayInfo

      public DisplayInfo(ItemStackTemplate icon, Component title, Component description, Optional<ClientAsset.ResourceTexture> background, AdvancementType type, boolean showToast, boolean announceToChat, boolean hidden)
      Creates an instance of a DisplayInfo record class.
      Parameters:
      icon - the value for the icon record component
      title - the value for the title record component
      description - the value for the description record component
      background - the value for the background record component
      type - the value for the type record component
      showToast - the value for the showToast record component
      announceToChat - the value for the announceToChat record component
      hidden - the value for the hidden record component
  • Method Details

    • serializeToNetwork

      private void serializeToNetwork(RegistryFriendlyByteBuf output)
    • fromNetwork

      private static DisplayInfo fromNetwork(RegistryFriendlyByteBuf input)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • icon

      public ItemStackTemplate icon()
      Returns the value of the icon record component.
      Returns:
      the value of the icon record component
    • title

      public Component title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • description

      public Component description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • background

      public Optional<ClientAsset.ResourceTexture> background()
      Returns the value of the background record component.
      Returns:
      the value of the background record component
    • type

      public AdvancementType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • showToast

      public boolean showToast()
      Returns the value of the showToast record component.
      Returns:
      the value of the showToast record component
    • announceToChat

      public boolean announceToChat()
      Returns the value of the announceToChat record component.
      Returns:
      the value of the announceToChat record component
    • hidden

      public boolean hidden()
      Returns the value of the hidden record component.
      Returns:
      the value of the hidden record component