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 injected
E - 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 Type
    Method
    Description
    @Nullable net.minecraft.world.entity.ai.attributes.AttributeSupplier
    Gets the attribute supplier, or null if this entity is not a LivingEntity.
    attributes(net.minecraft.world.entity.ai.attributes.AttributeSupplier attributes)
    Sets the default attributes for this entity.
    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.Key
    key()
    Gets the entity key.
    net.minecraft.world.entity.MobCategory
    Gets the mob category.
    mobCategory(net.minecraft.world.entity.MobCategory category)
    Sets the mob category of the entity.
    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.
    model(File file)
    Sets the model for this entity using a local file on the filesystem.
    model(URL url)
    Sets the model for this entity using the given URL.
    @Nullable URL
    Gets the URL of the model associated with this entity.
    Consumer<net.minecraft.world.entity.EntityType.Builder<M>>
    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

      Class<M> 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

      EntityInjection.Builder<M,E> backingType(net.minecraft.world.entity.EntityType<?> 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

      EntityInjection.Builder<M,E> mobCategory(net.minecraft.world.entity.MobCategory category)
      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

      Consumer<net.minecraft.world.entity.EntityType.Builder<M>> 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 extending LivingEntity.

      Defaults to LivingEntity.createLivingAttributes() if this entity is a LivingEntity otherwise to null.

      Parameters:
      attributes - the attributes
      Returns:
      this builder
      Throws:
      UnsupportedOperationException - if the entity is not a LivingEntity
      See Also:
      • AttributeSupplier.Builder
    • 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 extending LivingEntity.

      Defaults to LivingEntity.createLivingAttributes() if this entity is a LivingEntity otherwise to null.

      Parameters:
      builder - the builder used to construct the attributes
      Returns:
      this builder
      Throws:
      UnsupportedOperationException - if the entity is not a LivingEntity
      See Also:
      • AttributeSupplier.Builder
    • attributes

      @Nullable net.minecraft.world.entity.ai.attributes.AttributeSupplier attributes()
      Gets the attribute supplier, or null if this entity is not a LivingEntity.
      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 resource
      resource - 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

      default EntityInjection.Builder<M,E> model(File file)
      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 null if none was set