Record Class PlainTextContents.LiteralContents
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.PlainTextContents.LiteralContents
- All Implemented Interfaces:
ComponentContents
,PlainTextContents
- Enclosing interface:
- PlainTextContents
public static record PlainTextContents.LiteralContents(String text)
extends Record
implements PlainTextContents
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.chat.ComponentContents
ComponentContents.Type<T extends ComponentContents>
Nested classes/interfaces inherited from interface net.minecraft.network.chat.contents.PlainTextContents
PlainTextContents.LiteralContents
-
Field Summary
Fields inherited from interface net.minecraft.network.chat.contents.PlainTextContents
CODEC, EMPTY, TYPE
-
Constructor Summary
ConstructorDescriptionLiteralContents
(String text) Creates an instance of aLiteralContents
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.text()
Returns the value of thetext
record component.toString()
Returns a string representation of this record class.<T> Optional<T>
visit
(FormattedText.ContentConsumer<T> p_312000_) <T> Optional<T>
visit
(FormattedText.StyledContentConsumer<T> p_313135_, Style p_310796_) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.network.chat.ComponentContents
resolve
Methods inherited from interface net.minecraft.network.chat.contents.PlainTextContents
type
-
Field Details
-
text
The field for thetext
record component.
-
-
Constructor Details
-
LiteralContents
Creates an instance of aLiteralContents
record class.- Parameters:
text
- the value for thetext
record component
-
-
Method Details
-
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. -
text
Returns the value of thetext
record component.- Specified by:
text
in interfacePlainTextContents
- Returns:
- the value of the
text
record component
-
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)
.
-