Package org.geysermc.geyser.entity
Class EntityDefinition.Builder<T extends Entity>
java.lang.Object
org.geysermc.geyser.entity.EntityDefinition.Builder<T>
- Enclosing class:
- EntityDefinition<T extends Entity>
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(EntityFactory<T> factory, org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType type, String identifier, float width, float height, float offset, GeyserEntityProperties registeredProperties, List<EntityMetadataTranslator<? super T, ?, ?>> translators) -
Method Summary
Modifier and TypeMethodDescriptionaddTranslator(EntityMetadataTranslator<T, ?, ?> translator) <U,EM extends org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata<U, ? extends org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType<U>>>
EntityDefinition.Builder<T>addTranslator(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType<U> type, BiConsumer<T, EM> translateFunction) build()Build the given entity.build(boolean register) height(float height) heightAndWidth(float value) Sets the height and width as one valueidentifier(String identifier) offset(float offset) properties(GeyserEntityProperties registeredProperties) registeredProperties(GeyserEntityProperties registeredProperties) type(org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType type) Resets the identifier as wellwidth(float width)
-
Constructor Details
-
Builder
public Builder(EntityFactory<T> factory, org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType type, String identifier, float width, float height, float offset, GeyserEntityProperties registeredProperties, List<EntityMetadataTranslator<? super T, ?, ?>> translators)
-
-
Method Details
-
heightAndWidth
Sets the height and width as one value -
offset
-
type
public EntityDefinition.Builder<T> type(org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType type) Resets the identifier as well -
properties
-
addTranslator
public <U,EM extends org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata<U, EntityDefinition.Builder<T> addTranslator? extends org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType<U>>> (org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType<U> type, BiConsumer<T, EM> translateFunction) -
addTranslator
-
build
Build the given entity. If a testing environment has been discovered the entity is not registered, otherwise it is. This is to prevent all the registries from loading, which will fail (and should not be loaded) while testing -
build
- Parameters:
register- whether to register this entity in the Registries for entity types. Generally this should be set to false if we're not expecting this entity to spawn from the network.
-
identifier
- Returns:
this.
-
width
- Returns:
this.
-
height
- Returns:
this.
-
registeredProperties
public EntityDefinition.Builder<T> registeredProperties(GeyserEntityProperties registeredProperties) - Returns:
this.
-