Class EntityCreator

java.lang.Object
com.github.pinont.singularitylib.api.entity.EntityCreator

public class EntityCreator extends Object
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 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

      public EntityCreator addPassenger(org.bukkit.entity.Entity passenger)
      Adds a passenger entity to this entity.
      Parameters:
      passenger - the entity to add as a passenger
      Returns:
      this EntityCreator for method chaining
    • addScoreboardTag

      public EntityCreator addScoreboardTag(String... ScoreboardTag)
      Adds scoreboard tags to the entity.
      Parameters:
      ScoreboardTag - the scoreboard tags to add
      Returns:
      this EntityCreator for method chaining
    • setMaxHealth

      public EntityCreator setMaxHealth(double maxHealth)
      Sets the maximum health for the entity (only applies to LivingEntity).
      Parameters:
      maxHealth - the maximum health value
      Returns:
      this EntityCreator for method chaining
    • setFireTicks

      public EntityCreator setFireTicks(int ticks)
      Sets the number of fire ticks for the entity.
      Parameters:
      ticks - the number of fire ticks
      Returns:
      this EntityCreator for method chaining
    • setGlowing

      public EntityCreator setGlowing(boolean glowing)
      Sets whether the entity should glow.
      Parameters:
      glowing - true if the entity should glow, false otherwise
      Returns:
      this EntityCreator for method chaining
    • setInvulnerable

      public EntityCreator setInvulnerable(boolean invulnerable)
      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

      public EntityCreator setSilent(boolean silent)
      Sets whether the entity makes sounds.
      Parameters:
      silent - true if the entity should be silent, false otherwise
      Returns:
      this EntityCreator for method chaining
    • hasGravity

      public EntityCreator hasGravity(boolean gravity)
      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

      public EntityCreator setVelocity(org.bukkit.util.Vector vector)
      Sets the velocity vector for the entity.
      Parameters:
      vector - the velocity vector
      Returns:
      this EntityCreator for method chaining
    • setPersistent

      public EntityCreator setPersistent(Boolean persistent)
      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

      public EntityCreator setFreezeTicks(int ticks)
      Sets the number of freeze ticks for the entity.
      Parameters:
      ticks - the number of freeze ticks
      Returns:
      this EntityCreator for method chaining
    • setCustomNameVisible

      public EntityCreator setCustomNameVisible(Boolean visible)
      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

      public EntityCreator setPortalCooldown(int ticks)
      Sets the portal cooldown for the entity.
      Parameters:
      ticks - the portal cooldown in ticks
      Returns:
      this EntityCreator for method chaining
    • setFallingDistance

      public EntityCreator setFallingDistance(float distance)
      Sets the falling distance for the entity.
      Parameters:
      distance - the falling distance
      Returns:
      this EntityCreator for method chaining
    • setRotation

      public EntityCreator setRotation(float yaw, float pitch)
      Sets the rotation (yaw and pitch) for the entity.
      Parameters:
      yaw - the yaw rotation
      pitch - the pitch rotation
      Returns:
      this EntityCreator for method chaining
    • setTicksLived

      public EntityCreator setTicksLived(int ticks)
      Sets the number of ticks the entity has been alive.
      Parameters:
      ticks - the number of ticks lived
      Returns:
      this EntityCreator for method chaining
    • setVisibleByDefault

      public EntityCreator setVisibleByDefault(boolean visible)
      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

      public EntityCreator setVisualFire(boolean fire)
      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 in
      x - the x coordinate
      y - the y coordinate
      z - 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

      public Class<? extends org.bukkit.entity.Entity> getEntity()
      Gets the entity class for the entity type this creator will spawn.
      Returns:
      the entity class