Record Class EntityDataSource

java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.EntityDataSource
All Implemented Interfaces:
DataSource

public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) extends Record implements DataSource
  • Field Details

    • selectorPattern

      private final String selectorPattern
      The field for the selectorPattern record component.
    • compiledSelector

      @Nullable private final EntitySelector compiledSelector
      The field for the compiledSelector record component.
  • Constructor Details

    • EntityDataSource

      public EntityDataSource(String p_237330_)
    • EntityDataSource

      public EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector)
      Creates an instance of a EntityDataSource record class.
      Parameters:
      selectorPattern - the value for the selectorPattern record component
      compiledSelector - the value for the compiledSelector record component
  • Method Details

    • compileSelector

      @Nullable private static EntitySelector compileSelector(String p_237336_)
    • getData

      public Stream<CompoundTag> getData(CommandSourceStack p_237341_) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      getData in interface DataSource
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • toString

      public 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
    • equals

      public boolean equals(Object p_237339_)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      p_237339_ - the object with which to compare
      Returns:
      true if this object is the same as the p_237339_ argument; false otherwise.
    • hashCode

      public 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
    • selectorPattern

      public String selectorPattern()
      Returns the value of the selectorPattern record component.
      Returns:
      the value of the selectorPattern record component
    • compiledSelector

      @Nullable public EntitySelector compiledSelector()
      Returns the value of the compiledSelector record component.
      Returns:
      the value of the compiledSelector record component