Package cz.jeme.bestium.api.inject
Interface EntityInjection.Builder<M extends net.minecraft.world.entity.Entity & Injectable,E extends org.bukkit.entity.Entity>
- Type Parameters:
M- the type of the Minecraft entity being injectedE- the type of the Bukkit entity the Minecraft entity can be converted to
- All Superinterfaces:
net.kyori.adventure.builder.AbstractBuilder<EntityInjection<M,E>>
- Enclosing interface:
EntityInjection<M extends net.minecraft.world.entity.Entity & Injectable,E extends org.bukkit.entity.Entity>
public static sealed interface EntityInjection.Builder<M extends net.minecraft.world.entity.Entity & Injectable,E extends org.bukkit.entity.Entity>
extends net.kyori.adventure.builder.AbstractBuilder<EntityInjection<M,E>>
A builder used to configure and construct an
EntityInjection.-
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.world.entity.ai.attributes.AttributeSupplierGets the attribute supplier, ornullif this entity is not aLivingEntity.attributes(net.minecraft.world.entity.ai.attributes.AttributeSupplier attributes) Sets the default attributes for this entity.default EntityInjection.Builder<M, E> attributes(net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder builder) Sets the default attributes for this entity.net.minecraft.world.entity.EntityType<?> Gets the backing entity type.backingType(net.minecraft.world.entity.EntityType<?> backingType) Sets the backing type for rendering and size fallback.Gets the craft entity factory.Gets the entity class.net.minecraft.world.entity.EntityType.EntityFactory<M> Gets the entity factory.net.kyori.adventure.key.Keykey()Gets the entity key.net.minecraft.world.entity.MobCategoryGets the mob category.mobCategory(net.minecraft.world.entity.MobCategory category) Sets the mob category of the entity.default EntityInjection.Builder<M, E> Sets the model for this entity using a resource bundled in the plugin's JAR.default EntityInjection.Builder<M, E> Sets the model for this entity using a local file on the filesystem.Sets the model for this entity using the given URL.@Nullable URLmodelUrl()Gets the URL of the model associated with this entity.Gets the type builder customizer.typeCustomizer(Consumer<net.minecraft.world.entity.EntityType.Builder<M>> typeBuilder) Sets a customizer for the entity type builder.Methods inherited from interface net.kyori.adventure.builder.AbstractBuilder
build
-
Method Details
-
key
net.kyori.adventure.key.Key key()Gets the entity key.- Returns:
- the key
-
entityClass
Gets the entity class.- Returns:
- the class
-
entityFactory
net.minecraft.world.entity.EntityType.EntityFactory<M> entityFactory()Gets the entity factory.- Returns:
- the factory
-
convertFunction
ConvertFunction<M,E> convertFunction()Gets the craft entity factory.- Returns:
- the factory
-
backingType
Sets the backing type for rendering and size fallback.Defaults to
EntityType.SILVERFISH.- Parameters:
backingType- the fallback entity type- Returns:
- this builder
-
backingType
net.minecraft.world.entity.EntityType<?> backingType()Gets the backing entity type.- Returns:
- the fallback type
-
mobCategory
Sets the mob category of the entity.Defaults to
MobCategory.MISC.- Parameters:
category- the mob category- Returns:
- this builder
-
mobCategory
net.minecraft.world.entity.MobCategory mobCategory()Gets the mob category.- Returns:
- the category
-
typeCustomizer
EntityInjection.Builder<M,E> typeCustomizer(Consumer<net.minecraft.world.entity.EntityType.Builder<M>> typeBuilder) Sets a customizer for the entity type builder.For example, to define passenger attachments use:
EntityType.Builder.passengerAttachments(Vec3...).Defaults to an empty
Consumer.- Parameters:
typeBuilder- the builder customizer- Returns:
- this builder
-
typeCustomizer
Gets the type builder customizer.- Returns:
- the builder consumer
-
attributes
EntityInjection.Builder<M,E> attributes(net.minecraft.world.entity.ai.attributes.AttributeSupplier attributes) Sets the default attributes for this entity. Only valid for entities extendingLivingEntity.Defaults to
LivingEntity.createLivingAttributes()if this entity is aLivingEntityotherwise tonull.- Parameters:
attributes- the attributes- Returns:
- this builder
- Throws:
UnsupportedOperationException- if the entity is not a LivingEntity- See Also:
-
attributes
default EntityInjection.Builder<M,E> attributes(net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder builder) Sets the default attributes for this entity. Only valid for entities extendingLivingEntity.Defaults to
LivingEntity.createLivingAttributes()if this entity is aLivingEntityotherwise tonull.- Parameters:
builder- the builder used to construct the attributes- Returns:
- this builder
- Throws:
UnsupportedOperationException- if the entity is not a LivingEntity- See Also:
-
attributes
@Nullable net.minecraft.world.entity.ai.attributes.AttributeSupplier attributes()Gets the attribute supplier, ornullif this entity is not aLivingEntity.- Returns:
- the attributes or
null
-
model
default EntityInjection.Builder<M,E> model(io.papermc.paper.plugin.bootstrap.PluginBootstrap bootstrapper, String resource) Sets the model for this entity using a resource bundled in the plugin's JAR.The resource path must be '
/'-separated (e.g.,models/my_entity.bbmodel).This method attempts to load the resource using the bootstrapper's class loader.
- Parameters:
bootstrapper- the plugin bootstrapper whose class loader will be used to load the resourceresource- the path to the resource inside the plugin's JAR- Returns:
- this builder
- Throws:
NullPointerException- if the resource cannot be found in the JAR file
-
model
Sets the model for this entity using a local file on the filesystem.- Parameters:
file- the file containing the model- Returns:
- this builder
- Throws:
IllegalArgumentException- if the file's URL is invalid
-
model
Sets the model for this entity using the given URL.- Parameters:
url- the URL pointing to the model file- Returns:
- this builder
-
modelUrl
@Nullable URL modelUrl()Gets the URL of the model associated with this entity.- Returns:
- the model URL, or
nullif none was set
-