Record Class MobDefinition

java.lang.Object
java.lang.Record
fr.fidorial.entity.mob.MobDefinition
Record Components:
key - the identifier the mob is summoned and saved under
networkType - the vanilla entity type the client renders
maxHealth - the health ceiling in half-hearts
movementSpeed - the walking speed in blocks per tick
width - the hitbox width in blocks
height - the hitbox height in blocks
followRange - the radius in blocks the mob picks targets within, 0 to never target
attackDamage - the damage one hit deals
soundSource - the sound category the mob's sounds are played in
behaviour - builds the brain of each mob of this kind
persistent - whether the mob is written to the region files

public record MobDefinition(Key key, Key networkType, float maxHealth, double movementSpeed, double width, double height, double followRange, float attackDamage, Sound.Source soundSource, MobBehaviour.Factory behaviour, boolean persistent) extends Record
Everything the server needs to build a mob a plugin invented.
Since:
0.1.0
  • Constructor Details

    • MobDefinition

      public MobDefinition(Key key, Key networkType, float maxHealth, double movementSpeed, double width, double height, double followRange, float attackDamage, Sound.Source soundSource, MobBehaviour.Factory behaviour, boolean persistent)
      Creates an instance of a MobDefinition record class.
      Parameters:
      key - the value for the key record component
      networkType - the value for the networkType record component
      maxHealth - the value for the maxHealth record component
      movementSpeed - the value for the movementSpeed record component
      width - the value for the width record component
      height - the value for the height record component
      followRange - the value for the followRange record component
      attackDamage - the value for the attackDamage record component
      soundSource - the value for the soundSource record component
      behaviour - the value for the behaviour record component
      persistent - the value for the persistent record component
  • Method Details

    • builder

      public static MobDefinition.Builder builder(Key key, Key networkType)
      Parameters:
      key - the identifier the mob is summoned and saved under
      networkType - the vanilla entity type the client renders
      Returns:
      a builder pre-filled with the defaults of a small walking animal
      Since:
      0.1.0
    • 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.
    • key

      public Key key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • networkType

      public Key networkType()
      Returns the value of the networkType record component.
      Returns:
      the value of the networkType record component
    • maxHealth

      public float maxHealth()
      Returns the value of the maxHealth record component.
      Returns:
      the value of the maxHealth record component
    • movementSpeed

      public double movementSpeed()
      Returns the value of the movementSpeed record component.
      Returns:
      the value of the movementSpeed record component
    • width

      public double width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public double height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • followRange

      public double followRange()
      Returns the value of the followRange record component.
      Returns:
      the value of the followRange record component
    • attackDamage

      public float attackDamage()
      Returns the value of the attackDamage record component.
      Returns:
      the value of the attackDamage record component
    • soundSource

      public Sound.Source soundSource()
      Returns the value of the soundSource record component.
      Returns:
      the value of the soundSource record component
    • behaviour

      public MobBehaviour.Factory behaviour()
      Returns the value of the behaviour record component.
      Returns:
      the value of the behaviour record component
    • persistent

      public boolean persistent()
      Returns the value of the persistent record component.
      Returns:
      the value of the persistent record component