Interface Bestium


@NullMarked public interface Bestium
The core system for managing custom Minecraft entities.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Holds all the internal singleton instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.NamespacedKey
    Constructs a NamespacedKey from the given string key value.
    static Bestium
    Returns the Bestium plugin instance cast as Bestium.
    static @Nullable net.kyori.adventure.key.Key
    getInjectedEntityKey(org.bukkit.entity.Entity entity)
    Retrieves the Bestium Key of the injected Bukkit Entity, or null if not injected.
    Returns the main entity injector instance, which handles the registration and management of custom entities within Bestium.
    static org.bukkit.plugin.java.JavaPlugin
    Returns the Bestium plugin instance.
    Returns the plugin support instance, providing access to functions for checking the status of external optional dependencies.
    static boolean
    isInjectedEntity(org.bukkit.entity.Entity entity)
    Checks whether the given Bukkit Entity is an injected entity.
    static net.kyori.adventure.key.Key
    requireInjectedEntityKey(org.bukkit.entity.Entity entity)
    Retrieves the Bestium Key of the injected Bukkit Entity.
    static <T extends net.minecraft.world.entity.Entity>
    @Nullable T
    spawn(org.bukkit.Location location, Class<T> entityClass, net.minecraft.world.entity.EntitySpawnReason entitySpawnReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason)
    Spawns a custom injected entity with default initialization logic.
    static <T extends net.minecraft.world.entity.Entity>
    @Nullable T
    spawn(org.bukkit.Location location, Class<T> entityClass, net.minecraft.world.entity.EntitySpawnReason entitySpawnReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason, Consumer<T> consumer)
    Spawns a custom injected entity of the specified class at the given location.
  • Method Details

    • getPlugin

      static org.bukkit.plugin.java.JavaPlugin getPlugin()
      Returns the Bestium plugin instance.
      Returns:
      the JavaPlugin instance
      Throws:
      IllegalStateException - if called before the plugin is loaded
    • getBestium

      static Bestium getBestium()
      Returns the Bestium plugin instance cast as Bestium.

      This instance can be safely cast back to a JavaPlugin.

      Returns:
      the Bestium instance
      Throws:
      IllegalStateException - if called before the plugin is loaded
    • getInjector

      static EntityInjector getInjector()
      Returns the main entity injector instance, which handles the registration and management of custom entities within Bestium.
      Returns:
      the injector instance
      Throws:
      IllegalStateException - if called before the Bestium bootstrap happens
      See Also:
    • getPluginSupport

      static PluginSupport getPluginSupport()
      Returns the plugin support instance, providing access to functions for checking the status of external optional dependencies.
      Returns:
      the plugin support instance
      Throws:
      IllegalStateException - if called before Bestium plugin is loaded
      See Also:
    • spawn

      static <T extends net.minecraft.world.entity.Entity> @Nullable T spawn(org.bukkit.Location location, Class<T> entityClass, net.minecraft.world.entity.EntitySpawnReason entitySpawnReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason, Consumer<T> consumer)
      Spawns a custom injected entity of the specified class at the given location.
      Type Parameters:
      T - the type of the entity
      Parameters:
      location - the location where the entity should spawn
      entityClass - the class of the injected entity to spawn
      entitySpawnReason - the Minecraft EntitySpawnReason to use when spawning
      creatureSpawnReason - the Bukkit CreatureSpawnEvent.SpawnReason to use when triggering events
      consumer - a consumer that is called after the entity is created but before it is added to the world
      Returns:
      the spawned entity instance, or null if spawning failed
      Throws:
      IllegalArgumentException - if the given class is not a registered injected entity
    • spawn

      static <T extends net.minecraft.world.entity.Entity> @Nullable T spawn(org.bukkit.Location location, Class<T> entityClass, net.minecraft.world.entity.EntitySpawnReason entitySpawnReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason)
      Spawns a custom injected entity with default initialization logic.
      Type Parameters:
      T - the type of the entity
      Parameters:
      location - the location where the entity should spawn
      entityClass - the class of the injected entity to spawn
      entitySpawnReason - the Minecraft EntitySpawnReason to use when spawning
      creatureSpawnReason - the Bukkit CreatureSpawnEvent.SpawnReason to use when triggering events
      Returns:
      the spawned entity instance, or null if spawning failed
      Throws:
      IllegalArgumentException - if the given class is not a registered injected entity
      See Also:
    • getInjectedEntityKey

      static @Nullable net.kyori.adventure.key.Key getInjectedEntityKey(org.bukkit.entity.Entity entity)
      Retrieves the Bestium Key of the injected Bukkit Entity, or null if not injected.

      This is the same key that was used when registering the entity injection.

      Parameters:
      entity - the Bukkit Entity to retrieve the key from
      Returns:
      the Key identifying the injected entity type, or null if the entity is not an injected entity
      See Also:
    • requireInjectedEntityKey

      static net.kyori.adventure.key.Key requireInjectedEntityKey(org.bukkit.entity.Entity entity)
      Retrieves the Bestium Key of the injected Bukkit Entity.

      This is the same key that was used when registering the entity injection. Throws an exception if the entity is not injected.

      Parameters:
      entity - the Bukkit Entity to retrieve the key from
      Returns:
      the Key identifying the injected entity type
      Throws:
      IllegalArgumentException - if the entity is not an injected entity
      See Also:
    • isInjectedEntity

      static boolean isInjectedEntity(org.bukkit.entity.Entity entity)
      Checks whether the given Bukkit Entity is an injected entity.
      Parameters:
      entity - the Bukkit Entity to check
      Returns:
      true if the entity was injected by Bestium, false otherwise
    • createKey

      @Internal org.bukkit.NamespacedKey createKey(@Value String key)
      Constructs a NamespacedKey from the given string key value.
      Parameters:
      key - the string value of the key. Must follow the KeyPattern.Value format
      Returns:
      a NamespacedKey constructed from the given value