Class EntityBuilder
java.lang.Object
dev.selena.luacore.utils.entities.EntityBuilder
THIS CLASS IS HIGHLY EXPERIMENTAL, USAGE IS AT YOUR OWN RISK.
PLEASE REPORT ANY BUGS ON THE GITHUB ISSUE TRACKER
PLEASE REPORT ANY BUGS ON THE GITHUB ISSUE TRACKER
-
Constructor Summary
ConstructorsConstructorDescriptionUsed for creating a blank instanceEntityBuilder(org.bukkit.entity.EntityType type) Used for creating an instance with EntityType -
Method Summary
Modifier and TypeMethodDescriptionaddCustomNBTData(String key, TypedObject typedObject) Used for adding custom NBTData to the entityaddCustomNBTData(String key, Object cls) Deprecated, for removal: This API element is subject to removal in a future version.addCustomNBTDataValues(Map<String, TypedObject> values) Used for adding a map of NBTData to add to the entityaddCustomPathfinderGoal(int priority, ICustomGoalWrapper goalWrapper) Used for adding a custom pathfinder goal to the entity NOTE: THIS IS VERY EXPERIMENTAL AND MAY NOT WORK AS INTENDEDaddDrop(double chance, ItemBuilder item) Used for adding a drop to the collectionaddDrop(double chance, org.bukkit.inventory.ItemStack item) Used for adding a drop to the collectionaddDrops(Map<ItemBuilder, Double> drops) used to add a map of drops to the drop collectionaddDropsFromItemMap(Map<org.bukkit.inventory.ItemStack, Double> drops) used to add a map of drops to the drop collectionaddMetaDataValue(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 usingaddCustomNBTData(String, Object))addMetaDataValues(Map<String, org.bukkit.metadata.MetadataValue> metadataValues) Used for adding a map of metadata values to the entity (NOTE: I Suggest usingaddCustomNBTDataValues(Map))addPotionEffect(org.bukkit.potion.PotionEffect effect) Used for adding a potion effect to the list of effectsaddPotionEffects(List<org.bukkit.potion.PotionEffect> effects) Used for adding a list of potion effects to the entityaddPotionEffects(org.bukkit.potion.PotionEffect... effects) Used for adding an array of potion effects to the entitysetAi(boolean hasAi) Used for setting if the entity has AI or notsetArmorBonus(float armorBonus) Used for setting the armor bonus attribute (0.0 to 30.0, default 0.0)setArmorToughnessBonus(float armorToughnessBonus) Used for setting the armor toughness bonus attribute (0.0 to 20.0, default 0.0)setAttackDamageBonus(float attackDamageBonus) Used for setting the attack damage bonus (0.0 to 2048.0 default, 2.0)setAttackKnockBack(float attackKnockBack) Used for setting the attack knock back attribute (0.0 to 5.0, default 0.0)setBoots(org.bukkit.inventory.ItemStack boots) Used for setting the entity bootssetBurningTimer(float value) Used for setting the burn timer multiplier attributesetCameraDistance(float value) Used for setting the camera distance attributesetChestplate(org.bukkit.inventory.ItemStack chestplate) Used for setting the entity chestplatesetCustomNBTData(Map<String, TypedObject> customNBTData) Used for setting the custom NBTData mapsetCustomPathfinderGoal(Map<Integer, ICustomGoalWrapper> customPathfinderGoal) Used for setting a custom pathfinder goal NOTE: THIS IS VERY EXPERIMENTAL AND MAY NOT WORK AS INTENDEDsetDisplayName(String displayName) Used for setting the display name of the entity (Color is translated once applied so no need to do it before)setDrops(RandomCollection<ItemBuilder> drops) Used for setting the drop collection for entity deathsetDropsFromItemCollection(RandomCollection<org.bukkit.inventory.ItemStack> itemStackDrops) Used for setting the drop collection for entity deathsetEntityScale(float entityScale) Used for setting the entity scale attribute (0.0625 to 16.0, default 1.0)setEntityType(org.bukkit.entity.EntityType entityType) Used for setting the type of entity to spawnsetExplosionKnockbackResistance(float value) Used for setting the explosion knockback resistance attributesetFallDamageMultiplier(float value) Used for setting the fall damage multiplier attributesetFlyingSpeed(float flyingSpeed) Used for setting the flight speed attribute (0.0 to 1024.0, default 0.4)setFollowRange(float followRange) Used for setting the entity follow range attribute (0.0 to 2048, default 32.0)setGravity(float value) Used for setting the gravity attributesetHelmet(org.bukkit.inventory.ItemStack helmet) Used for setting the entity helmetsetJumpStrength(float jumpStrength) Used for setting the horse jump strength attribute (0.0 to 2.0, default 0.7)setKnockBackResistance(float knockBackResistance) Used for setting the knock back resistance attribute (0.0 to 1.0, default 0.0)setLeggings(org.bukkit.inventory.ItemStack leggings) Used for setting the entity leggingssetMainHandItem(org.bukkit.inventory.ItemStack mainHandItem) Used for setting the item in the entities main handsetMaxAbsorption(float maxAbsorption) Used for setting the maximum absorption attribute (0.0 to 2048.0, default 0.0)setMaxHealth(float maxHealth) Used for setting the maximum health attribute (0.0 to 1024.0, default 20.0)setMetadataValues(Map<String, org.bukkit.metadata.MetadataValue> metadataValues) Used for setting the map of metadata values (NOTE: I suggest usingsetCustomNBTData(Map))setMovementEfficiency(float value) Used for setting the movement efficiency attributesetMovementSpeed(float movementSpeed) Used for setting the entity movement speed attribute (0.0 to 1024.0, default depends on entity)setOffHandItem(org.bukkit.inventory.ItemStack offHandItem) Used for setting the item in the entities offhandsetOxygenBonus(float value) Used for setting the oxygen bonus attributesetPotionEffects(List<org.bukkit.potion.PotionEffect> potionEffects) Used for setting the list of potion effectssetRemoveDefaultGoals(boolean removeDefaultGoals) Used for setting if the entity should remove default goals or notsetSafeFallDistance(float value) Used for setting the safe fall distance attributesetSilent(boolean silent) Used for setting if the entity is silent or notsetSpawnReinforcements(float reinforcementsChance) Used for setting the reinforcements spawn chance attributesetStepHeight(float stepHeight) Used for setting the entity step height attribute (0.0 to 10.0, default 0.6)setTemptRange(float value) Used for setting the temptation range attributesetVanillaDrops(boolean vanillaDrops) Used for setting if the entity should use vanilla drops or notsetWaterMovementEfficiency(float value) Used for setting the water movement efficiency attributesetWaypointReceiveRange(float value) Used for setting the waypoint receive range attributesetWaypointTransmitRange(float value) Used for setting the waypoint transmit range attributeorg.bukkit.entity.Entityspawn(org.bukkit.Location location) Used for spawning the entity in the worldorg.bukkit.entity.Entityspawn(org.bukkit.Location location, org.bukkit.World world) Used for spawning the entity in the world
-
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
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
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
Used for adding an array of potion effects to the entity- Parameters:
effects- The array of effects- Returns:
- The current builder instance
-
addPotionEffects
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
Used for adding a drop to the collection- Parameters:
chance- The weighted chanceitem- The items you want added- Returns:
- The current builder instance
-
addDrops
used to add a map of drops to the drop collection- Parameters:
drops- The map of drops- Returns:
- The current builder instance
-
addDrop
Used for adding a drop to the collection- Parameters:
chance- The weighted chanceitem- The items you want added- Returns:
- The current builder instance
-
addDropsFromItemMap
used to add a map of drops to the drop collection- Parameters:
drops- The map of drops- Returns:
- The current builder instance
-
addMetaDataValue
Used for adding metadata to the entity (Not to sure if I can make it save on server restart) (NOTE: I Suggest usingaddCustomNBTData(String, Object))- Parameters:
key- The key used for getting the metadata valuemetadata- 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 usingaddCustomNBTDataValues(Map))- Parameters:
metadataValues- The map of metadata values- Returns:
- The current builder instance
-
addCustomNBTData
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 datacls- The NBTData class (NOTE: can be essentially anything)- Returns:
- The current builder instance
-
addCustomNBTData
Used for adding custom NBTData to the entity- Parameters:
key- The key used to gather the datatypedObject- TheTypedObjectyou want to add- Returns:
- The current builder instance
-
addCustomNBTDataValues
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
Used for setting the custom NBTData map- Parameters:
customNBTData- The map of custom NBTData- Returns:
- The current builder instance
-
setArmorBonus
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
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
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
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
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
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
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
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
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
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
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
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
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
Used for setting the reinforcements spawn chance attribute- Parameters:
reinforcementsChance- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setBurningTimer
Used for setting the burn timer multiplier attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setCameraDistance
Used for setting the camera distance attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setExplosionKnockbackResistance
Used for setting the explosion knockback resistance attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setFallDamageMultiplier
Used for setting the fall damage multiplier attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setGravity
Used for setting the gravity attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setMovementEfficiency
Used for setting the movement efficiency attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setOxygenBonus
Used for setting the oxygen bonus attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setSafeFallDistance
Used for setting the safe fall distance attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setTemptRange
Used for setting the temptation range attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setWaterMovementEfficiency
Used for setting the water movement efficiency attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setWaypointReceiveRange
Used for setting the waypoint receive range attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setWaypointTransmitRange
Used for setting the waypoint transmit range attribute- Parameters:
value- The value for the attribute- Returns:
- The current builder instance
- See Also:
-
setEntityType
Used for setting the type of entity to spawn- Parameters:
entityType- The EntityType you want to spawn- Returns:
- The current builder instance
-
setDisplayName
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
Used for setting the entity helmet- Parameters:
helmet- The item you want to set for helmet- Returns:
- The current builder instance
-
setChestplate
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
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
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
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
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
Used for setting the drop collection for entity death- Parameters:
drops- TheRandomCollectionof 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- TheRandomCollectionof 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 usingsetCustomNBTData(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
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
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
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
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 entityworld- 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:
-