Package de.Keyle.MyPet.api.gui
Record Class ClickPayload
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.ClickPayload
- Record Components:
slot- the clicked slotitemIndex- page-relative index within a paginated list, or-1elsewhereclickType- how the slot was clickedshift- whether shift was heldcursor- what the player was holding on the cursor
public record ClickPayload(int slot, int itemIndex, ClickType clickType, boolean shift, ItemStack cursor)
extends Record
Payload routed to
MenuHandler.onClick(de.Keyle.MyPet.api.gui.MenuInstance, java.lang.String, de.Keyle.MyPet.api.gui.ClickPayload) for every click inside a tracked menu.
`itemIndex` is the index inside a paginated-list section (or -1 for non-list sections).-
Constructor Summary
ConstructorsConstructorDescriptionClickPayload(int slot, int itemIndex, ClickType clickType, boolean shift, ItemStack cursor) Creates an instance of aClickPayloadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclickTyperecord component.cursor()Returns the value of thecursorrecord component.final booleanIndicates whether some other object is "equal to" this one.static ClickPayloadCreates a payload for a click outside any paginated list, with no item index.final inthashCode()Returns a hash code value for this object.intReturns the value of theitemIndexrecord component.booleanshift()Returns the value of theshiftrecord component.intslot()Returns the value of theslotrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ClickPayload
Creates an instance of aClickPayloadrecord class.
-
-
Method Details
-
forSlot
Creates a payload for a click outside any paginated list, with no item index.- Parameters:
slot- the clicked slottype- how the slot was clickedshift- whether shift was heldcursor- what the player was holding on the cursor- Returns:
- a payload whose
itemIndexis-1
-
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 '=='. -
slot
public int slot()Returns the value of theslotrecord component.- Returns:
- the value of the
slotrecord component
-
itemIndex
public int itemIndex()Returns the value of theitemIndexrecord component.- Returns:
- the value of the
itemIndexrecord component
-
clickType
Returns the value of theclickTyperecord component.- Returns:
- the value of the
clickTyperecord component
-
shift
public boolean shift()Returns the value of theshiftrecord component.- Returns:
- the value of the
shiftrecord component
-
cursor
Returns the value of thecursorrecord component.- Returns:
- the value of the
cursorrecord component
-