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 SelectorPattern
The field for theselector
record component.The field for theseparator
record component.static final ComponentContents.Type
<SelectorContents> -
Constructor Summary
ConstructorsConstructorDescriptionSelectorContents
(SelectorPattern selector, Optional<Component> separator) Creates an instance of aSelectorContents
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.resolve
(CommandSourceStack p_237468_, Entity p_237469_, int p_237470_) selector()
Returns the value of theselector
record component.Returns the value of theseparator
record 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 theselector
record component. -
separator
The field for theseparator
record component. -
CODEC
-
TYPE
-
-
Constructor Details
-
SelectorContents
Creates an instance of aSelectorContents
record class.- Parameters:
selector
- the value for theselector
record componentseparator
- the value for theseparator
record component
-
-
Method Details
-
type
- Specified by:
type
in interfaceComponentContents
-
resolve
public MutableComponent resolve(@Nullable CommandSourceStack p_237468_, @Nullable Entity p_237469_, int p_237470_) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
resolve
in interfaceComponentContents
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
visit
- Specified by:
visit
in interfaceComponentContents
-
visit
- Specified by:
visit
in 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 theselector
record component.- Returns:
- the value of the
selector
record component
-
separator
Returns the value of theseparator
record component.- Returns:
- the value of the
separator
record component
-