Record Class NbtContents

java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.NbtContents
All Implemented Interfaces:
ComponentContents

public record NbtContents(CompilableString<NbtPathArgument.NbtPath> nbtPath, boolean interpreting, boolean plain, Optional<Component> separator, DataSource dataSource) extends Record implements ComponentContents
  • Field Details

    • nbtPath

      private final CompilableString<NbtPathArgument.NbtPath> nbtPath
      The field for the nbtPath record component.
    • interpreting

      private final boolean interpreting
      The field for the interpreting record component.
    • plain

      private final boolean plain
      The field for the plain record component.
    • separator

      private final Optional<Component> separator
      The field for the separator record component.
    • dataSource

      private final DataSource dataSource
      The field for the dataSource record component.
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • NBT_PATH_CODEC

      public static final Codec<CompilableString<NbtPathArgument.NbtPath>> NBT_PATH_CODEC
    • MAP_CODEC

      public static final MapCodec<NbtContents> MAP_CODEC
  • Constructor Details

    • NbtContents

      public NbtContents(CompilableString<NbtPathArgument.NbtPath> nbtPath, boolean interpreting, boolean plain, Optional<Component> separator, DataSource dataSource)
      Creates an instance of a NbtContents record class.
      Parameters:
      nbtPath - the value for the nbtPath record component
      interpreting - the value for the interpreting record component
      plain - the value for the plain record component
      separator - the value for the separator record component
      dataSource - the value for the dataSource record component
  • Method Details

    • resolve

      public MutableComponent resolve(ResolutionContext context, int recursionDepth) throws CommandSyntaxException
      Specified by:
      resolve in interface ComponentContents
      Throws:
      CommandSyntaxException
    • codec

      public MapCodec<NbtContents> codec()
      Specified by:
      codec in interface ComponentContents
    • 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.
    • nbtPath

      Returns the value of the nbtPath record component.
      Returns:
      the value of the nbtPath record component
    • interpreting

      public boolean interpreting()
      Returns the value of the interpreting record component.
      Returns:
      the value of the interpreting record component
    • plain

      public boolean plain()
      Returns the value of the plain record component.
      Returns:
      the value of the plain record component
    • separator

      public Optional<Component> separator()
      Returns the value of the separator record component.
      Returns:
      the value of the separator record component
    • dataSource

      public DataSource dataSource()
      Returns the value of the dataSource record component.
      Returns:
      the value of the dataSource record component