Record Class ClientState

java.lang.Object
java.lang.Record
dev.zwazel.internal.game.state.ClientState
Record Components:
id - The id of the client
transformBody - The transform of the body of the tank
transformTurret - The transform of the turret of the tank (relative to the body)
state - The state of the player (e.g. alive, dead)
shootCooldown - The amount of ticks until the tank can shoot again
currentHealth - The current health of the tank

public record ClientState(long id, Transform transformBody, Transform transformTurret, ClientState.PlayerState state, long shootCooldown, float currentHealth) extends Record
Represents the state of a client in the game.
  • Constructor Details

    • ClientState

      public ClientState(long id, Transform transformBody, Transform transformTurret, ClientState.PlayerState state, long shootCooldown, float currentHealth)
      Creates an instance of a ClientState record class.
      Parameters:
      id - the value for the id record component
      transformBody - the value for the transformBody record component
      transformTurret - the value for the transformTurret record component
      state - the value for the state record component
      shootCooldown - the value for the shootCooldown record component
      currentHealth - the value for the currentHealth record component
  • Method Details

    • getConnectedClientConfig

      public ConnectedClientConfig getConnectedClientConfig(PublicGameWorld world)
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public long id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • transformBody

      public Transform transformBody()
      Returns the value of the transformBody record component.
      Returns:
      the value of the transformBody record component
    • transformTurret

      public Transform transformTurret()
      Returns the value of the transformTurret record component.
      Returns:
      the value of the transformTurret record component
    • state

      public ClientState.PlayerState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • shootCooldown

      public long shootCooldown()
      Returns the value of the shootCooldown record component.
      Returns:
      the value of the shootCooldown record component
    • currentHealth

      public float currentHealth()
      Returns the value of the currentHealth record component.
      Returns:
      the value of the currentHealth record component