Record Class PlayerInput
java.lang.Object
java.lang.Record
fr.fidorial.entity.player.PlayerInput
- Record Components:
forward- the forward keybackward- the backward keyleft- the strafe left keyright- the strafe right keyjump- the jump keysneak- the sneak keysprint- the sprint key
public record PlayerInput(boolean forward, boolean backward, boolean left, boolean right, boolean jump, boolean sneak, boolean sprint)
extends Record
The movement keys a player is holding, as their client reports them.
The client sends this state whether or not the player can actually move, so it also works as a plain keyboard reader while movement is blocked.
- Since:
- 0.1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlayerInput(boolean forward, boolean backward, boolean left, boolean right, boolean jump, boolean sneak, boolean sprint) Creates an instance of aPlayerInputrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbackward()Returns the value of thebackwardrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanforward()Returns the value of theforwardrecord component.final inthashCode()Returns a hash code value for this object.booleanjump()Returns the value of thejumprecord component.booleanleft()Returns the value of theleftrecord component.booleanright()Returns the value of therightrecord component.booleansneak()Returns the value of thesneakrecord component.booleansprint()Returns the value of thesprintrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
No key held.
-
-
Constructor Details
-
PlayerInput
public PlayerInput(boolean forward, boolean backward, boolean left, boolean right, boolean jump, boolean sneak, boolean sprint) Creates an instance of aPlayerInputrecord class.- Parameters:
forward- the value for theforwardrecord componentbackward- the value for thebackwardrecord componentleft- the value for theleftrecord componentright- the value for therightrecord componentjump- the value for thejumprecord componentsneak- the value for thesneakrecord componentsprint- the value for thesprintrecord 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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
forward
-
backward
-
left
-
right
-
jump
-
sneak
-
sprint
-