Record Class ScribeInput
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.menu.scribe.controller.ScribeInput
A utility record that encodes and decodes the Scribe Minigame interactions
into a single integer payload for native Container synchronization.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionScribeInput(int x, int y, int action) Creates an instance of aScribeInputrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintaction()Returns the value of theactionrecord component.static ScribeInputdecode(int payload) Decodes the integer payload received by the server back into an input record.intencode()Encodes the interaction into a single integer payload.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.intx()Returns the value of thexrecord component.inty()Returns the value of theyrecord component.
-
Field Details
-
ACTION_REVEAL
public static final int ACTION_REVEAL- See Also:
-
ACTION_FLAG
public static final int ACTION_FLAG- See Also:
-
ACTION_START
public static final int ACTION_START- See Also:
-
ACTION_ABORT
public static final int ACTION_ABORT- See Also:
-
ACTION_ACK_LOSS
public static final int ACTION_ACK_LOSS- See Also:
-
ACTION_TAKE_BOOK
public static final int ACTION_TAKE_BOOK- See Also:
-
ACTION_RETURN_TO_INDEX
public static final int ACTION_RETURN_TO_INDEX- See Also:
-
ACTION_SELECT_ENCHANTMENT
public static final int ACTION_SELECT_ENCHANTMENT- See Also:
-
-
Constructor Details
-
ScribeInput
public ScribeInput(int x, int y, int action) Creates an instance of aScribeInputrecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentaction- the value for theactionrecord component
-
-
Method Details
-
encode
public int encode()Encodes the interaction into a single integer payload. Bits 0-15: X coordinate (or 16-bit Registry ID) Bits 16-23: Y coordinate Bits 24-31: Action Type -
decode
Decodes the integer payload received by the server back into an input record. -
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. All components in this record class are compared with '=='. -
x
public int x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public int y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
action
public int action()Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-