Class EntityBuilder

java.lang.Object
dev.selena.luacore.utils.entities.EntityBuilder

@Experimental public class EntityBuilder extends Object
THIS CLASS IS HIGHLY EXPERIMENTAL, USAGE IS AT YOUR OWN RISK.
PLEASE REPORT ANY BUGS ON THE GITHUB ISSUE TRACKER
  • Constructor Details

    • EntityBuilder

      public EntityBuilder()
      Used for creating a blank instance
    • EntityBuilder

      public EntityBuilder(org.bukkit.entity.EntityType type)
      Used for creating an instance with EntityType
      Parameters:
      type - The EntityType you want to spawn
  • Method Details

    • setPotionEffects

      public EntityBuilder setPotionEffects(List<org.bukkit.potion.PotionEffect> potionEffects)
      Used for setting the list of potion effects
      Parameters:
      potionEffects - The list of potion effects you want to set
      Returns:
      The current builder instance
    • addPotionEffect

      public EntityBuilder addPotionEffect(org.bukkit.potion.PotionEffect effect)
      Used for adding a potion effect to the list of effects
      Parameters:
      effect - The effect you want to add
      Returns:
      The current builder instance
    • addPotionEffects

      public EntityBuilder addPotionEffects(org.bukkit.potion.PotionEffect... effects)
      Used for adding an array of potion effects to the entity
      Parameters:
      effects - The array of effects
      Returns:
      The current builder instance
    • addPotionEffects

      public EntityBuilder addPotionEffects(List<org.bukkit.potion.PotionEffect> effects)
      Used for adding a list of potion effects to the entity
      Parameters:
      effects - The list of effects you want to add
      Returns:
      The current builder instance
    • addDrop

      public EntityBuilder addDrop(double chance, ItemBuilder item)
      Used for adding a drop to the collection
      Parameters:
      chance - The weighted chance
      item - The items you want added
      Returns:
      The current builder instance
    • addDrops

      public EntityBuilder addDrops(Map<ItemBuilder,Double> drops)
      used to add a map of drops to the drop collection
      Parameters:
      drops - The map of drops
      Returns:
      The current builder instance
    • addDrop

      public EntityBuilder addDrop(double chance, org.bukkit.inventory.ItemStack item)
      Used for adding a drop to the collection
      Parameters:
      chance - The weighted chance
      item - The items you want added
      Returns:
      The current builder instance
    • addDropsFromItemMap

      public EntityBuilder addDropsFromItemMap(Map<org.bukkit.inventory.ItemStack,Double> drops)
      used to add a map of drops to the drop collection
      Parameters:
      drops - The map of drops
      Returns:
      The current builder instance
    • addMetaDataValue

      public EntityBuilder addMetaDataValue(String key, org.bukkit.metadata.MetadataValue metadata)
      Used for adding metadata to the entity (Not to sure if I can make it save on server restart) (NOTE: I Suggest using addCustomNBTData(String, Object))
      Parameters:
      key - The key used for getting the metadata value
      metadata - The metadata you want to store
      Returns:
      The current builder instance
    • addMetaDataValues

      public EntityBuilder addMetaDataValues(Map<String,org.bukkit.metadata.MetadataValue> metadataValues)
      Used for adding a map of metadata values to the entity (NOTE: I Suggest using addCustomNBTDataValues(Map))
      Parameters:
      metadataValues - The map of metadata values
      Returns:
      The current builder instance
    • addCustomNBTData

      @Deprecated(forRemoval=true) public EntityBuilder addCustomNBTData(String key, Object cls)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Used for adding custom NBTData to the entity
      Parameters:
      key - The key used to gather the data
      cls - The NBTData class (NOTE: can be essentially anything)
      Returns:
      The current builder instance
    • addCustomNBTData

      public EntityBuilder addCustomNBTData(String key, TypedObject typedObject)
      Used for adding custom NBTData to the entity
      Parameters:
      key - The key used to gather the data
      typedObject - The TypedObject you want to add
      Returns:
      The current builder instance
    • addCustomNBTDataValues

      public EntityBuilder addCustomNBTDataValues(Map<String,TypedObject> values)
      Used for adding a map of NBTData to add to the entity
      Parameters:
      values - The map of NBTData classes
      Returns:
      The current builder instance
    • setCustomNBTData

      public EntityBuilder setCustomNBTData(Map<String,TypedObject> customNBTData)
      Used for setting the custom NBTData map
      Parameters:
      customNBTData - The map of custom NBTData
      Returns:
      The current builder instance
    • setArmorBonus

      public EntityBuilder setArmorBonus(float armorBonus)
      Used for setting the armor bonus attribute (0.0 to 30.0, default 0.0)
      Parameters:
      armorBonus - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setArmorToughnessBonus

      public EntityBuilder setArmorToughnessBonus(float armorToughnessBonus)
      Used for setting the armor toughness bonus attribute (0.0 to 20.0, default 0.0)
      Parameters:
      armorToughnessBonus - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setAttackDamageBonus

      public EntityBuilder setAttackDamageBonus(float attackDamageBonus)
      Used for setting the attack damage bonus (0.0 to 2048.0 default, 2.0)
      Parameters:
      attackDamageBonus - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setAttackKnockBack

      public EntityBuilder setAttackKnockBack(float attackKnockBack)
      Used for setting the attack knock back attribute (0.0 to 5.0, default 0.0)
      Parameters:
      attackKnockBack - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setFlyingSpeed

      public EntityBuilder setFlyingSpeed(float flyingSpeed)
      Used for setting the flight speed attribute (0.0 to 1024.0, default 0.4)
      Parameters:
      flyingSpeed - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setFollowRange

      public EntityBuilder setFollowRange(float followRange)
      Used for setting the entity follow range attribute (0.0 to 2048, default 32.0)
      Parameters:
      followRange - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setKnockBackResistance

      public EntityBuilder setKnockBackResistance(float knockBackResistance)
      Used for setting the knock back resistance attribute (0.0 to 1.0, default 0.0)
      Parameters:
      knockBackResistance - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setMaxAbsorption

      public EntityBuilder setMaxAbsorption(float maxAbsorption)
      Used for setting the maximum absorption attribute (0.0 to 2048.0, default 0.0)
      Parameters:
      maxAbsorption - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setMaxHealth

      public EntityBuilder setMaxHealth(float maxHealth)
      Used for setting the maximum health attribute (0.0 to 1024.0, default 20.0)
      Parameters:
      maxHealth - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setMovementSpeed

      public EntityBuilder setMovementSpeed(float movementSpeed)
      Used for setting the entity movement speed attribute (0.0 to 1024.0, default depends on entity)
      Parameters:
      movementSpeed - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setJumpStrength

      public EntityBuilder setJumpStrength(float jumpStrength)
      Used for setting the horse jump strength attribute (0.0 to 2.0, default 0.7)
      Parameters:
      jumpStrength - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setEntityScale

      public EntityBuilder setEntityScale(float entityScale)
      Used for setting the entity scale attribute (0.0625 to 16.0, default 1.0)
      Parameters:
      entityScale - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setStepHeight

      public EntityBuilder setStepHeight(float stepHeight)
      Used for setting the entity step height attribute (0.0 to 10.0, default 0.6)
      Parameters:
      stepHeight - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setSpawnReinforcements

      public EntityBuilder setSpawnReinforcements(float reinforcementsChance)
      Used for setting the reinforcements spawn chance attribute
      Parameters:
      reinforcementsChance - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setBurningTimer

      public EntityBuilder setBurningTimer(float value)
      Used for setting the burn timer multiplier attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setCameraDistance

      public EntityBuilder setCameraDistance(float value)
      Used for setting the camera distance attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setExplosionKnockbackResistance

      public EntityBuilder setExplosionKnockbackResistance(float value)
      Used for setting the explosion knockback resistance attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setFallDamageMultiplier

      public EntityBuilder setFallDamageMultiplier(float value)
      Used for setting the fall damage multiplier attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setGravity

      public EntityBuilder setGravity(float value)
      Used for setting the gravity attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setMovementEfficiency

      public EntityBuilder setMovementEfficiency(float value)
      Used for setting the movement efficiency attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setOxygenBonus

      public EntityBuilder setOxygenBonus(float value)
      Used for setting the oxygen bonus attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setSafeFallDistance

      public EntityBuilder setSafeFallDistance(float value)
      Used for setting the safe fall distance attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setTemptRange

      public EntityBuilder setTemptRange(float value)
      Used for setting the temptation range attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setWaterMovementEfficiency

      public EntityBuilder setWaterMovementEfficiency(float value)
      Used for setting the water movement efficiency attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setWaypointReceiveRange

      public EntityBuilder setWaypointReceiveRange(float value)
      Used for setting the waypoint receive range attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setWaypointTransmitRange

      public EntityBuilder setWaypointTransmitRange(float value)
      Used for setting the waypoint transmit range attribute
      Parameters:
      value - The value for the attribute
      Returns:
      The current builder instance
      See Also:
    • setEntityType

      public EntityBuilder setEntityType(org.bukkit.entity.EntityType entityType)
      Used for setting the type of entity to spawn
      Parameters:
      entityType - The EntityType you want to spawn
      Returns:
      The current builder instance
    • setDisplayName

      public EntityBuilder setDisplayName(String displayName)
      Used for setting the display name of the entity (Color is translated once applied so no need to do it before)
      Parameters:
      displayName - The entity display name
      Returns:
      The current builder instance
    • setHelmet

      public EntityBuilder setHelmet(org.bukkit.inventory.ItemStack helmet)
      Used for setting the entity helmet
      Parameters:
      helmet - The item you want to set for helmet
      Returns:
      The current builder instance
    • setChestplate

      public EntityBuilder setChestplate(org.bukkit.inventory.ItemStack chestplate)
      Used for setting the entity chestplate
      Parameters:
      chestplate - The item you want to set for the chestplate (NOTE: Must be a chestplate item)
      Returns:
      The current builder instance
    • setLeggings

      public EntityBuilder setLeggings(org.bukkit.inventory.ItemStack leggings)
      Used for setting the entity leggings
      Parameters:
      leggings - The item you want to set for the leggings (NOTE: Must be a legging item)
      Returns:
      The current builder instance
    • setBoots

      public EntityBuilder setBoots(org.bukkit.inventory.ItemStack boots)
      Used for setting the entity boots
      Parameters:
      boots - The item you want to set for the boots (NOTE: Must be a boot item)
      Returns:
      The current builder instance
    • setMainHandItem

      public EntityBuilder setMainHandItem(org.bukkit.inventory.ItemStack mainHandItem)
      Used for setting the item in the entities main hand
      Parameters:
      mainHandItem - The item you want to place in the main hand
      Returns:
      The current builder instance
    • setOffHandItem

      public EntityBuilder setOffHandItem(org.bukkit.inventory.ItemStack offHandItem)
      Used for setting the item in the entities offhand
      Parameters:
      offHandItem - The item you want to place in the offhand
      Returns:
      The current builder instance
    • setDrops

      public EntityBuilder setDrops(RandomCollection<ItemBuilder> drops)
      Used for setting the drop collection for entity death
      Parameters:
      drops - The RandomCollection of ItemBuilder drops
      Returns:
      The current builder instance
    • setDropsFromItemCollection

      public EntityBuilder setDropsFromItemCollection(RandomCollection<org.bukkit.inventory.ItemStack> itemStackDrops)
      Used for setting the drop collection for entity death
      Parameters:
      itemStackDrops - The RandomCollection of ItemStack drops
      Returns:
      The current builder instance
    • setMetadataValues

      public EntityBuilder setMetadataValues(Map<String,org.bukkit.metadata.MetadataValue> metadataValues)
      Used for setting the map of metadata values (NOTE: I suggest using setCustomNBTData(Map))
      Parameters:
      metadataValues - The map of metadata values
      Returns:
      The current builder instance
    • setCustomPathfinderGoal

      @Experimental public EntityBuilder setCustomPathfinderGoal(Map<Integer,ICustomGoalWrapper> customPathfinderGoal)
      Used for setting a custom pathfinder goal NOTE: THIS IS VERY EXPERIMENTAL AND MAY NOT WORK AS INTENDED
      Parameters:
      customPathfinderGoal - The class of the pathfinder goal
      Returns:
      The current builder instance
    • addCustomPathfinderGoal

      @Experimental public EntityBuilder addCustomPathfinderGoal(int priority, ICustomGoalWrapper goalWrapper)
      Used for adding a custom pathfinder goal to the entity NOTE: THIS IS VERY EXPERIMENTAL AND MAY NOT WORK AS INTENDED
      Parameters:
      priority - The priority of the goal (lower number = higher priority)
      goalWrapper - The wrapper for the custom goal
      Returns:
      The current builder instance
    • setAi

      public EntityBuilder setAi(boolean hasAi)
      Used for setting if the entity has AI or not
      Parameters:
      hasAi - True if the entity has AI, false if it does not, true by default
      Returns:
      The current builder instance
    • setSilent

      public EntityBuilder setSilent(boolean silent)
      Used for setting if the entity is silent or not
      Parameters:
      silent - True if the entity is silent, false if it is not, false by default
      Returns:
      The current builder instance
    • setVanillaDrops

      public EntityBuilder setVanillaDrops(boolean vanillaDrops)
      Used for setting if the entity should use vanilla drops or not
      Parameters:
      vanillaDrops - True if the entity should use vanilla drops, false if it should not, false by default
      Returns:
      The current builder instance
    • setRemoveDefaultGoals

      public EntityBuilder setRemoveDefaultGoals(boolean removeDefaultGoals)
      Used for setting if the entity should remove default goals or not
      Parameters:
      removeDefaultGoals - True if the entity should remove default goals, false if it should not, false by default
      Returns:
      The current builder instance
    • spawn

      public org.bukkit.entity.Entity spawn(org.bukkit.Location location, org.bukkit.World world)
      Used for spawning the entity in the world
      Parameters:
      location - The location you want to spawn the entity
      world - The world you want to spawn the entity in
      Returns:
      The entity that has just been spawned
      See Also:
    • spawn

      public org.bukkit.entity.Entity spawn(org.bukkit.Location location)
      Used for spawning the entity in the world
      Parameters:
      location - The location you want to spawn the entity (World must not be null)
      Returns:
      The entity that has just been spawned
      See Also: