Package net.minecraft.server.dialog.body
Record Class ItemBody
java.lang.Object
java.lang.Record
net.minecraft.server.dialog.body.ItemBody
- All Implemented Interfaces:
DialogBody
public record ItemBody(ItemStack item, Optional<PlainMessage> description, boolean showDecorations, boolean showTooltip, int width, int height)
extends Record
implements DialogBody
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Optional
<PlainMessage> The field for thedescription
record component.private final int
The field for theheight
record component.private final ItemStack
The field for theitem
record component.static final com.mojang.serialization.MapCodec
<ItemBody> private final boolean
The field for theshowDecorations
record component.private final boolean
The field for theshowTooltip
record component.private final int
The field for thewidth
record component.Fields inherited from interface net.minecraft.server.dialog.body.DialogBody
COMPACT_LIST_CODEC, DIALOG_BODY_CODEC
-
Constructor Summary
ConstructorsConstructorDescriptionItemBody
(ItemStack item, Optional<PlainMessage> description, boolean showDecorations, boolean showTooltip, int width, int height) Creates an instance of aItemBody
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescription
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
height()
Returns the value of theheight
record component.item()
Returns the value of theitem
record component.com.mojang.serialization.MapCodec
<ItemBody> mapCodec()
boolean
Returns the value of theshowDecorations
record component.boolean
Returns the value of theshowTooltip
record component.final String
toString()
Returns a string representation of this record class.int
width()
Returns the value of thewidth
record component.
-
Field Details
-
item
The field for theitem
record component. -
description
The field for thedescription
record component. -
showDecorations
private final boolean showDecorationsThe field for theshowDecorations
record component. -
showTooltip
private final boolean showTooltipThe field for theshowTooltip
record component. -
width
private final int widthThe field for thewidth
record component. -
height
private final int heightThe field for theheight
record component. -
MAP_CODEC
-
-
Constructor Details
-
ItemBody
public ItemBody(ItemStack item, Optional<PlainMessage> description, boolean showDecorations, boolean showTooltip, int width, int height) Creates an instance of aItemBody
record class.- Parameters:
item
- the value for theitem
record componentdescription
- the value for thedescription
record componentshowDecorations
- the value for theshowDecorations
record componentshowTooltip
- the value for theshowTooltip
record componentwidth
- the value for thewidth
record componentheight
- the value for theheight
record component
-
-
Method Details
-
mapCodec
- Specified by:
mapCodec
in interfaceDialogBody
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
item
Returns the value of theitem
record component.- Returns:
- the value of the
item
record component
-
description
Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
showDecorations
public boolean showDecorations()Returns the value of theshowDecorations
record component.- Returns:
- the value of the
showDecorations
record component
-
showTooltip
public boolean showTooltip()Returns the value of theshowTooltip
record component.- Returns:
- the value of the
showTooltip
record component
-
width
public int width()Returns the value of thewidth
record component.- Returns:
- the value of the
width
record component
-
height
public int height()Returns the value of theheight
record component.- Returns:
- the value of the
height
record component
-