Record Class EntityDefinition<T extends Entity>

java.lang.Object
java.lang.Record
org.geysermc.geyser.entity.EntityDefinition<T>
Type Parameters:
T - the entity type this definition represents

public record EntityDefinition<T extends Entity>(EntityFactory<T extends Entity> factory, com.github.steveice10.mc.protocol.data.game.entity.type.EntityType entityType, String identifier, float width, float height, float offset, List<EntityMetadataTranslator<? super T extends Entity,​?,​?>> translators) extends Record
Represents data for an entity. This includes properties such as height and width, as well as the list of entity metadata translators needed to translate the properties sent from the server. The translators are structured in such a way that inserting a new one (for example in version updates) is convenient.
  • Constructor Details

    • EntityDefinition

      public EntityDefinition(EntityFactory<T> factory, com.github.steveice10.mc.protocol.data.game.entity.type.EntityType entityType, String identifier, float width, float height, float offset, List<EntityMetadataTranslator<? super T,​?,​?>> translators)
      Creates an instance of a EntityDefinition record class.
      Parameters:
      factory - the value for the factory record component
      entityType - the value for the entityType record component
      identifier - the value for the identifier record component
      width - the value for the width record component
      height - the value for the height record component
      offset - the value for the offset record component
      translators - the value for the translators record component
  • Method Details

    • inherited

      public static <T extends Entity> EntityDefinition.Builder<T> inherited(BaseEntityFactory<T> factory, EntityDefinition<? super T> parent)
    • inherited

      public static <T extends Entity> EntityDefinition.Builder<T> inherited(EntityFactory<T> factory, EntityDefinition<? super T> parent)
    • builder

      public static <T extends Entity> EntityDefinition.Builder<T> builder(EntityFactory<T> factory)
    • translateMetadata

      public <M> void translateMetadata(T entity, com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata<M,​? extends com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType<M>> metadata)
    • 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 '=='.
      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.
    • factory

      public EntityFactory<T> factory()
      Returns the value of the factory record component.
      Returns:
      the value of the factory record component
    • entityType

      public com.github.steveice10.mc.protocol.data.game.entity.type.EntityType entityType()
      Returns the value of the entityType record component.
      Returns:
      the value of the entityType record component
    • identifier

      public String identifier()
      Returns the value of the identifier record component.
      Returns:
      the value of the identifier record component
    • width

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

      public float height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • offset

      public float offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • translators

      public List<EntityMetadataTranslator<? super T,​?,​?>> translators()
      Returns the value of the translators record component.
      Returns:
      the value of the translators record component