Class EntityCreator
java.lang.Object
com.github.pinont.singularitylib.api.entity.EntityCreator
Builder class for creating and configuring entities before spawning them.
Provides a fluent API for setting various entity properties and spawning entities at specific locations.
-
Constructor Summary
ConstructorsConstructorDescriptionEntityCreator(org.bukkit.entity.EntityType entityType) Creates a new EntityCreator for the specified entity type. -
Method Summary
Modifier and TypeMethodDescriptionaddPassenger(org.bukkit.entity.Entity passenger) Adds a passenger entity to this entity.addScoreboardTag(String... ScoreboardTag) Adds scoreboard tags to the entity.Class<? extends org.bukkit.entity.Entity> Gets the entity class for the entity type this creator will spawn.org.bukkit.entity.EntityTypegetType()Gets the entity type this creator will spawn.hasGravity(boolean gravity) Sets whether the entity is affected by gravity.setCustomNameVisible(Boolean visible) Sets whether the entity's custom name is visible.setFallingDistance(float distance) Sets the falling distance for the entity.setFireTicks(int ticks) Sets the number of fire ticks for the entity.setFreezeTicks(int ticks) Sets the number of freeze ticks for the entity.setGlowing(boolean glowing) Sets whether the entity should glow.setInvulnerable(boolean invulnerable) Sets whether the entity is invulnerable to damage.setMaxHealth(double maxHealth) Sets the maximum health for the entity (only applies to LivingEntity).setPersistent(Boolean persistent) Sets whether the entity is persistent (won't despawn).setPortalCooldown(int ticks) Sets the portal cooldown for the entity.setRotation(float yaw, float pitch) Sets the rotation (yaw and pitch) for the entity.setSilent(boolean silent) Sets whether the entity makes sounds.setTicksLived(int ticks) Sets the number of ticks the entity has been alive.setVelocity(org.bukkit.util.Vector vector) Sets the velocity vector for the entity.setVisibleByDefault(boolean visible) Sets whether the entity is visible by default.setVisualFire(boolean fire) Sets whether the entity has visual fire effect.org.bukkit.entity.Entityspawn(org.bukkit.Location location) Spawns the entity at the specified location with all configured properties.org.bukkit.entity.Entityspawn(org.bukkit.World world, double x, double y, double z) Spawns the entity at the specified coordinates in the given world.
-
Constructor Details
-
EntityCreator
public EntityCreator(org.bukkit.entity.EntityType entityType) Creates a new EntityCreator for the specified entity type.- Parameters:
entityType- the type of entity to create
-
-
Method Details
-
addPassenger
Adds a passenger entity to this entity.- Parameters:
passenger- the entity to add as a passenger- Returns:
- this EntityCreator for method chaining
-
addScoreboardTag
Adds scoreboard tags to the entity.- Parameters:
ScoreboardTag- the scoreboard tags to add- Returns:
- this EntityCreator for method chaining
-
setMaxHealth
Sets the maximum health for the entity (only applies to LivingEntity).- Parameters:
maxHealth- the maximum health value- Returns:
- this EntityCreator for method chaining
-
setFireTicks
Sets the number of fire ticks for the entity.- Parameters:
ticks- the number of fire ticks- Returns:
- this EntityCreator for method chaining
-
setGlowing
Sets whether the entity should glow.- Parameters:
glowing- true if the entity should glow, false otherwise- Returns:
- this EntityCreator for method chaining
-
setInvulnerable
Sets whether the entity is invulnerable to damage.- Parameters:
invulnerable- true if the entity should be invulnerable, false otherwise- Returns:
- this EntityCreator for method chaining
-
setSilent
Sets whether the entity makes sounds.- Parameters:
silent- true if the entity should be silent, false otherwise- Returns:
- this EntityCreator for method chaining
-
hasGravity
Sets whether the entity is affected by gravity.- Parameters:
gravity- true if the entity should have gravity, false otherwise- Returns:
- this EntityCreator for method chaining
-
setVelocity
Sets the velocity vector for the entity.- Parameters:
vector- the velocity vector- Returns:
- this EntityCreator for method chaining
-
setPersistent
Sets whether the entity is persistent (won't despawn).- Parameters:
persistent- true if the entity should be persistent, false otherwise- Returns:
- this EntityCreator for method chaining
-
setFreezeTicks
Sets the number of freeze ticks for the entity.- Parameters:
ticks- the number of freeze ticks- Returns:
- this EntityCreator for method chaining
-
setCustomNameVisible
Sets whether the entity's custom name is visible.- Parameters:
visible- true if the custom name should be visible, false otherwise- Returns:
- this EntityCreator for method chaining
-
setPortalCooldown
Sets the portal cooldown for the entity.- Parameters:
ticks- the portal cooldown in ticks- Returns:
- this EntityCreator for method chaining
-
setFallingDistance
Sets the falling distance for the entity.- Parameters:
distance- the falling distance- Returns:
- this EntityCreator for method chaining
-
setRotation
Sets the rotation (yaw and pitch) for the entity.- Parameters:
yaw- the yaw rotationpitch- the pitch rotation- Returns:
- this EntityCreator for method chaining
-
setTicksLived
Sets the number of ticks the entity has been alive.- Parameters:
ticks- the number of ticks lived- Returns:
- this EntityCreator for method chaining
-
setVisibleByDefault
Sets whether the entity is visible by default.- Parameters:
visible- true if the entity should be visible by default, false otherwise- Returns:
- this EntityCreator for method chaining
-
setVisualFire
Sets whether the entity has visual fire effect.- Parameters:
fire- true if the entity should have visual fire, false otherwise- Returns:
- this EntityCreator for method chaining
-
spawn
public org.bukkit.entity.Entity spawn(org.bukkit.Location location) Spawns the entity at the specified location with all configured properties.- Parameters:
location- the location to spawn the entity at- Returns:
- the spawned entity
-
spawn
public org.bukkit.entity.Entity spawn(org.bukkit.World world, double x, double y, double z) Spawns the entity at the specified coordinates in the given world.- Parameters:
world- the world to spawn the entity inx- the x coordinatey- the y coordinatez- the z coordinate- Returns:
- the spawned entity
-
getType
public org.bukkit.entity.EntityType getType()Gets the entity type this creator will spawn.- Returns:
- the entity type
-
getEntity
Gets the entity class for the entity type this creator will spawn.- Returns:
- the entity class
-