Package org.geysermc.geyser.entity
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.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionEntityDefinition(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 aEntityDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Entity>
EntityDefinition.Builder<T>builder(EntityFactory<T> factory)
com.github.steveice10.mc.protocol.data.game.entity.type.EntityType
Returns the value of theentityType
record component.boolean
Indicates whether some other object is "equal to" this one.factory()
Returns the value of thefactory
record component.int
hashCode()
Returns a hash code value for this object.float
height()
Returns the value of theheight
record component.Returns the value of theidentifier
record component.static <T extends Entity>
EntityDefinition.Builder<T>inherited(BaseEntityFactory<T> factory, EntityDefinition<? super T> parent)
static <T extends Entity>
EntityDefinition.Builder<T>inherited(EntityFactory<T> factory, EntityDefinition<? super T> parent)
float
offset()
Returns the value of theoffset
record component.toString()
Returns a string representation of this record class.<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)
List<EntityMetadataTranslator<? super T,?,?>>
Returns the value of thetranslators
record component.float
width()
Returns the value of thewidth
record component.
-
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 aEntityDefinition
record class.- Parameters:
factory
- the value for thefactory
record componententityType
- the value for theentityType
record componentidentifier
- the value for theidentifier
record componentwidth
- the value for thewidth
record componentheight
- the value for theheight
record componentoffset
- the value for theoffset
record componenttranslators
- the value for thetranslators
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
-
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
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
factory
Returns the value of thefactory
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 theentityType
record component.- Returns:
- the value of the
entityType
record component
-
identifier
Returns the value of theidentifier
record component.- Returns:
- the value of the
identifier
record component
-
width
public float width()Returns the value of thewidth
record component.- Returns:
- the value of the
width
record component
-
height
public float height()Returns the value of theheight
record component.- Returns:
- the value of the
height
record component
-
offset
public float offset()Returns the value of theoffset
record component.- Returns:
- the value of the
offset
record component
-
translators
Returns the value of thetranslators
record component.- Returns:
- the value of the
translators
record component
-