Class Boss<T extends Mob>

java.lang.Object
me.gamercoder215.mobchip.bosses.Boss<T>
Type Parameters:
T - The entity type of this Boss.

public abstract class Boss<T extends Mob> extends Object
Represents a Boss Entity.
  • Field Details

    • DEFAULT_HEALTH

      public static final int DEFAULT_HEALTH
      Default health for Boss (20)
      See Also:
    • mob

      @Nullable protected T extends Mob mob
      This Entity, can be null.
    • id

      protected final long id
      The Numerical ID of this Boss.
  • Constructor Details

  • Method Details

    • valueOf

      @Nullable public static @Nullable Boss<?> valueOf(long id)
      Fetch a Boss by its id.
      Parameters:
      id - ID of boss to fetch
      Returns:
      found boss, or null if not found
    • valueOf

      @Nullable public static @Nullable Boss<?> valueOf(@NotNull @NotNull UUID uid)
      Fetch a Boss by an Entity UUID. Will not work for Bosses that are not spawned.
      Parameters:
      uid - UUID of Entity Boss
      Returns:
      Found boss class, or null if not found
    • valueOf

      @Nullable public static <T extends Mob> @Nullable Boss<T> valueOf(@NotNull T entity)
      Fetch a Boss by its Entity Instance.
      Type Parameters:
      T - Type of Entity
      Parameters:
      entity - Entity Instance
      Returns:
      Found boss class, or null if not found
    • getHandler

      @NotNull public final @NotNull BossHandler getHandler()
      Fetches the BossHandler for this Boss.
      Returns:
      BossHandler found
    • getEntityClass

      public final Class<T> getEntityClass()
      Fetch the Entity Class of this Boss.
      Returns:
      Entity Class Found
    • getEntityType

      public final EntityType getEntityType()
      Fetch the Entity Type of this Boss.
      Returns:
      Entity Type Found
    • getBossId

      public final long getBossId()
      Get the ID of this Boss Class.
      Returns:
      ID of Boss
    • spawn

      public final void spawn(@NotNull @NotNull Location l)
      Spawns this Boss. The SpawnReason will always be CreatureSpawnEvent.SpawnReason.CUSTOM.
      Parameters:
      l - Location to spawn
    • getDeathSound

      @NotNull public final @NotNull Sound getDeathSound()
      Gets the Death Sound, or Sound.ENTITY_WITHER_DEATH if not set
      Returns:
      Found Death Sound
    • setDeathSound

      public final void setDeathSound(@Nullable @Nullable Sound s)
      Sets the Death Sound.
      Parameters:
      s - New Death Sound, or Null to reset
    • getSpawnSound

      @NotNull public final @NotNull Sound getSpawnSound()
      Gets the Spawn Sound, or Sound.ENTITY_WITHER_SPAWN if not set
      Returns:
      Found Spawn Sound
    • setSpawnSound

      public final void setSpawnSound(@Nullable @Nullable Sound s)
      Sets the Death Sound.
      Parameters:
      s - New Death Sound, or Null to reset
    • getSoundPitch

      public final float getSoundPitch()
      Fetches the current sound pitch.
      Returns:
      Current Sound Pitch
    • getSoundVolume

      public final float getSoundVolume()
      Fetches the current sound volume.
      Returns:
      Current Sound Volume
    • setSoundPitch

      public final void setSoundPitch(float pitch) throws IllegalArgumentException
      Sets the Sound's Pitch.
      Parameters:
      pitch - Pitch to set
      Throws:
      IllegalArgumentException - if pitch is less than -2F or greater than 2F
    • setSoundVolume

      public final void setSoundVolume(float volume) throws IllegalArgumentException
      Sets the Sound's Volume.
      Parameters:
      volume - Volume to set
      Throws:
      IllegalArgumentException - if volume is less than 0F
    • getMob

      @Nullable public final T getMob()
      Fetch the Entity. Can be null if not spawned yet.
      Returns:
      Entity found
    • getAttributes

      @NotNull public final @NotNull Map<AttributeInstance,Double> getAttributes()
      Fetch this Entity's Attributes.
      Returns:
      Entity Attributes
    • getHealth

      public final double getHealth()
      Get the health that this Boss will spawn with.
      Returns:
      Health spawned with
    • setHealth

      public final void setHealth(double health)
      Sets the health that this Boss will spawn with.
      Parameters:
      health - Health to spawn with
    • addAttribute

      public final void addAttribute(@NotNull @NotNull AttributeInstance inst, double value)
      Adds an Attribute that this Boss will spawn with.
      Parameters:
      inst - Attribute Instance
      value - Value to set
    • removeAttribute

      public final void removeAttribute(@NotNull @NotNull AttributeInstance inst)
      Removes an Attribute that this Boss will spawn with.
      Parameters:
      inst - Attribute Instance
    • getEquipment

      @NotNull public final @NotNull Map<EquipmentSlot,ItemStack> getEquipment()
      Fetch the Boss's Equipment.
      Returns:
      Equipment that the Boss will spawn with
    • setItem

      public final void setItem(@NotNull @NotNull EquipmentSlot slot, @Nullable @Nullable ItemStack item)
      Sets an item on this Boss's Equipment that it will spawn with.
      Parameters:
      slot - EquipmentSlot to spawn
      item - ItemStack to set, can be null
    • setHelmet

      public final void setHelmet(@Nullable @Nullable ItemStack item)
      Sets this Boss's Helmet.
      Parameters:
      item - Helmet Item to set, can be null
    • setChestplate

      public final void setChestplate(@Nullable @Nullable ItemStack item)
      Sets this Boss's Chestplate.
      Parameters:
      item - Chestplate Item to set, can be null
    • setLeggings

      public final void setLeggings(@Nullable @Nullable ItemStack item)
      Sets this Boss's Leggings.
      Parameters:
      item - Leggings Item to set, can be null
    • setBoots

      public final void setBoots(@Nullable @Nullable ItemStack item)
      Sets this Boss's Boots.
      Parameters:
      item - Boots Item to set, can be null
    • setMainhand

      public final void setMainhand(@Nullable @Nullable ItemStack item)
      Sets this Boss's Mainhand.
      Parameters:
      item - Mainhand Item to change, can be null
    • setOffhand

      public final void setOffhand(@Nullable @Nullable ItemStack item)
      Sets this Boss's Offhand.
      Parameters:
      item - Offhand Item to change, can be null
    • getDrops

      public abstract List<ItemStack> getDrops()
      Get the Drops of this Boss Entity.
      Returns:
      List of Drops
    • onSpawn

      public void onSpawn(CreatureSpawnEvent e)
      Called when the Entity Spawns
      Parameters:
      e - Event called when it spawns
    • onDeath

      public void onDeath(EntityDeathEvent death)
      Called when the Entity Dies
      Parameters:
      death - Event called when it dies
    • onDamageDefensive

      public void onDamageDefensive(EntityDamageEvent e)
      Called when this Entity receives damage
      Parameters:
      e - Event called when it is damaged
    • onDamageOffensive

      public void onDamageOffensive(EntityDamageByEntityEvent e)
      Called when this Entity damages another Entity
      Parameters:
      e - Event called when it damages another entity