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 anEntitySnapshotBuilder
for the specified entity type. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.entity.EntitySnapshot
build
(@NotNull org.bukkit.World world) Builds anEntitySnapshot
based on the provided data.static org.bukkit.entity.EntitySnapshot
fromEntity
(@NotNull org.bukkit.entity.Entity entity) Creates anEntitySnapshot
from 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 anEntitySnapshotBuilder
for 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
EntitySnapshotBuilder
instance for chaining.
-
fromEntity
public static org.bukkit.entity.EntitySnapshot fromEntity(@NotNull @NotNull org.bukkit.entity.Entity entity) Creates anEntitySnapshot
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 anEntitySnapshot
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.
-