Record Class SelectorContents
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.SelectorContents
- All Implemented Interfaces:
ComponentContents
public record SelectorContents(SelectorPattern selector, Optional<Component> separator)
extends Record
implements ComponentContents
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.chat.ComponentContents
ComponentContents.Type<T extends ComponentContents> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SelectorContents> private final SelectorPatternThe field for theselectorrecord component.The field for theseparatorrecord component.static final ComponentContents.Type<SelectorContents> -
Constructor Summary
ConstructorsConstructorDescriptionSelectorContents(SelectorPattern selector, Optional<Component> separator) Creates an instance of aSelectorContentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.resolve(CommandSourceStack p_237468_, Entity p_237469_, int p_237470_) selector()Returns the value of theselectorrecord component.Returns the value of theseparatorrecord component.toString()Returns a string representation of this record class.type()<T> Optional<T> visit(FormattedText.ContentConsumer<T> p_237474_) <T> Optional<T> visit(FormattedText.StyledContentConsumer<T> p_237476_, Style p_237477_)
-
Field Details
-
selector
The field for theselectorrecord component. -
separator
The field for theseparatorrecord component. -
CODEC
-
TYPE
-
-
Constructor Details
-
SelectorContents
Creates an instance of aSelectorContentsrecord class.- Parameters:
selector- the value for theselectorrecord componentseparator- the value for theseparatorrecord component
-
-
Method Details
-
type
- Specified by:
typein interfaceComponentContents
-
resolve
public MutableComponent resolve(@Nullable CommandSourceStack p_237468_, @Nullable Entity p_237469_, int p_237470_) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
resolvein interfaceComponentContents- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
visit
- Specified by:
visitin interfaceComponentContents
-
visit
- Specified by:
visitin interfaceComponentContents
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
selector
Returns the value of theselectorrecord component.- Returns:
- the value of the
selectorrecord component
-
separator
Returns the value of theseparatorrecord component.- Returns:
- the value of the
separatorrecord component
-