Record Class ObjectContents
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.ObjectContents
- All Implemented Interfaces:
ComponentContents
public record ObjectContents(ObjectInfo contents, Optional<Component> fallback)
extends Record
implements ComponentContents
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ObjectInfoThe field for thecontentsrecord component.The field for thefallbackrecord component.static final MapCodec<ObjectContents> private static final String -
Constructor Summary
ConstructorsConstructorDescriptionObjectContents(ObjectInfo contents, Optional<Component> fallback) Creates an instance of aObjectContentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()contents()Returns the value of thecontentsrecord component.final booleanIndicates whether some other object is "equal to" this one.fallback()Returns the value of thefallbackrecord component.final inthashCode()Returns a hash code value for this object.resolve(ResolutionContext context, int recursionDepth) final StringtoString()Returns a string representation of this record class.<T> Optional<T> visit(FormattedText.ContentConsumer<T> output) <T> Optional<T> visit(FormattedText.StyledContentConsumer<T> output, Style currentStyle)
-
Field Details
-
contents
The field for thecontentsrecord component. -
fallback
-
PLACEHOLDER
-
MAP_CODEC
-
-
Constructor Details
-
ObjectContents
Creates an instance of aObjectContentsrecord class.- Parameters:
contents- the value for thecontentsrecord componentfallback- the value for thefallbackrecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceComponentContents
-
resolve
public MutableComponent resolve(ResolutionContext context, int recursionDepth) throws CommandSyntaxException - Specified by:
resolvein interfaceComponentContents- Throws:
CommandSyntaxException
-
visit
- Specified by:
visitin interfaceComponentContents
-
visit
- Specified by:
visitin interfaceComponentContents
-
toString
-
hashCode
-
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). -
contents
Returns the value of thecontentsrecord component.- Returns:
- the value of the
contentsrecord component
-
fallback
-