Class EntitySnapshotBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.helper.EntitySnapshotBuilder
The
EntitySnapshotBuilder class provides a way to create and modify
EntitySnapshot instances before using them.-
Constructor Summary
ConstructorsConstructorDescriptionEntitySnapshotBuilder(@NotNull org.bukkit.entity.EntityType entityType) Creates anEntitySnapshotBuilderfor the specified entity type. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.entity.EntitySnapshotbuild(@NotNull org.bukkit.World world) Builds anEntitySnapshotbased on the provided data.static org.bukkit.entity.EntitySnapshotfromEntity(@NotNull org.bukkit.entity.Entity entity) Creates anEntitySnapshotfrom an existing entity.setLocation(@NotNull org.bukkit.Location location) Sets the location where the entity will be spawned.
-
Constructor Details
-
EntitySnapshotBuilder
public EntitySnapshotBuilder(@NotNull @NotNull org.bukkit.entity.EntityType entityType) Creates anEntitySnapshotBuilderfor the specified entity type.- Parameters:
entityType- The type of entity to snapshot.
-
-
Method Details
-
setLocation
Sets the location where the entity will be spawned.- Parameters:
location- The spawn location.- Returns:
- This
EntitySnapshotBuilderinstance for chaining.
-
fromEntity
public static org.bukkit.entity.EntitySnapshot fromEntity(@NotNull @NotNull org.bukkit.entity.Entity entity) Creates anEntitySnapshotfrom an existing entity.- Parameters:
entity- The entity to snapshot.- Returns:
- An immutable
EntitySnapshotof the given entity.
-
build
public org.bukkit.entity.EntitySnapshot build(@NotNull @NotNull org.bukkit.World world) Builds anEntitySnapshotbased 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.
-