Class EntitySnapshotBuilder

java.lang.Object
io.github.lucfr1746.llibrary.itemstack.helper.EntitySnapshotBuilder

public class EntitySnapshotBuilder extends Object
The EntitySnapshotBuilder class provides a way to create and modify EntitySnapshot instances before using them.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntitySnapshotBuilder(@NotNull org.bukkit.entity.EntityType entityType)
    Creates an EntitySnapshotBuilder for the specified entity type.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.entity.EntitySnapshot
    build(@NotNull org.bukkit.World world)
    Builds an EntitySnapshot based on the provided data.
    static org.bukkit.entity.EntitySnapshot
    fromEntity(@NotNull org.bukkit.entity.Entity entity)
    Creates an EntitySnapshot from an existing entity.
    setLocation(@NotNull org.bukkit.Location location)
    Sets the location where the entity will be spawned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntitySnapshotBuilder

      public EntitySnapshotBuilder(@NotNull @NotNull org.bukkit.entity.EntityType entityType)
      Creates an EntitySnapshotBuilder for the specified entity type.
      Parameters:
      entityType - The type of entity to snapshot.
  • Method Details

    • setLocation

      public EntitySnapshotBuilder setLocation(@NotNull @NotNull org.bukkit.Location location)
      Sets the location where the entity will be spawned.
      Parameters:
      location - The spawn location.
      Returns:
      This EntitySnapshotBuilder instance for chaining.
    • fromEntity

      public static org.bukkit.entity.EntitySnapshot fromEntity(@NotNull @NotNull org.bukkit.entity.Entity entity)
      Creates an EntitySnapshot from an existing entity.
      Parameters:
      entity - The entity to snapshot.
      Returns:
      An immutable EntitySnapshot of the given entity.
    • build

      public org.bukkit.entity.EntitySnapshot build(@NotNull @NotNull org.bukkit.World world)
      Builds an EntitySnapshot based on the provided data.
      Parameters:
      world - The world where the entity will be spawned.
      Returns:
      The created EntitySnapshot.
      Throws:
      IllegalStateException - If location or world is not set.