Record Class DialogBody.Item
java.lang.Object
java.lang.Record
fr.fidorial.dialog.DialogBody.Item
- Record Components:
item- the stack to displaydescription- an optional label shown next to the itemshowDecoration- whether the stack count and damage bar are drawn over the itemshowTooltip- whether hovering the item pops its tooltip upwidth- horizontal size of the element, between 1 and 256height- vertical size of the element, between 1 and 256
- All Implemented Interfaces:
DialogBody
- Enclosing interface:
DialogBody
public static record DialogBody.Item(ItemStack item, @Nullable DialogBody.PlainMessage description, boolean showDecoration, boolean showTooltip, int width, int height)
extends Record
implements DialogBody
An item, rendered as if it were sitting in an inventory slot.
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface DialogBody
DialogBody.Item, DialogBody.PlainMessage -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault width and height of an item body element, matching a vanilla inventory slot.static final intLargest width or height the client accepts for an item body element.Fields inherited from interface DialogBody
DEFAULT_WIDTH, MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionItem(ItemStack item, @Nullable DialogBody.PlainMessage description, boolean showDecoration, boolean showTooltip, int width, int height) Creates an instance of aItemrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.item()Returns the value of theitemrecord component.booleanReturns the value of theshowDecorationrecord component.booleanReturns the value of theshowTooltiprecord component.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.
-
Field Details
-
MAX_ITEM_SIZE
public static final int MAX_ITEM_SIZELargest width or height the client accepts for an item body element.- Since:
- 0.1.0
- See Also:
-
DEFAULT_ITEM_SIZE
public static final int DEFAULT_ITEM_SIZEDefault width and height of an item body element, matching a vanilla inventory slot.- Since:
- 0.1.0
- See Also:
-
-
Constructor Details
-
Item
public Item(ItemStack item, @Nullable DialogBody.PlainMessage description, boolean showDecoration, boolean showTooltip, int width, int height) Creates an instance of aItemrecord class.- Parameters:
item- the value for theitemrecord componentdescription- the value for thedescriptionrecord componentshowDecoration- the value for theshowDecorationrecord componentshowTooltip- the value for theshowTooltiprecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
item
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
showDecoration
public boolean showDecoration()Returns the value of theshowDecorationrecord component.- Returns:
- the value of the
showDecorationrecord component
-
showTooltip
public boolean showTooltip()Returns the value of theshowTooltiprecord component.- Returns:
- the value of the
showTooltiprecord component
-
width
-
height
-