Contents
Class SpawnUtil
java.lang.Object
com.hypixel.hytale.server.core.universe.world.SpawnUtil
A utility class that contains a variety of spawn-related methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TransformComponentapplyFirstSpawnTransform(Holder<EntityStore> holder, Transform spawnPoint) Called to apply the first spawn point to the holder's transform and head rotation components.static voidapplyTransform(Holder<EntityStore> holder, Transform transform) Applies the given transform to the holder's transform and head rotation components.static CompletableFuture<Transform> resolveSpawnPoint(World world, UUID uuid) Resolves the spawn point ofworldfor the given player, or an empty transform when the world has no spawn provider.static CompletableFuture<Void> teleportToSpawn(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, World targetWorld, World playerWorld, Consumer<Transform> onTeleport) Teleports the player to the spawn point oftargetWorldonce it resolves, reading the player's UUID throughcomponentAccessor.static CompletableFuture<Void> teleportToSpawn(Ref<EntityStore> ref, UUID uuid, World targetWorld, World playerWorld, Consumer<Transform> onTeleport) Teleports the player to the spawn point oftargetWorldonce it resolves.static CompletableFuture<Void> teleportWhenResolved(CompletableFuture<Transform> spawnPointFuture, Ref<EntityStore> ref, World targetWorld, World playerWorld, Consumer<Transform> onTeleport) Teleports the player to the pointspawnPointFutureresolves to.
-
Constructor Details
-
SpawnUtil
public SpawnUtil()
-
-
Method Details
-
resolveSpawnPoint
@Nonnull public static CompletableFuture<Transform> resolveSpawnPoint(@Nonnull World world, @Nonnull UUID uuid) Resolves the spawn point ofworldfor the given player, or an empty transform when the world has no spawn provider. -
teleportToSpawn
@Nonnull public static CompletableFuture<Void> teleportToSpawn(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nullable World targetWorld, @Nonnull World playerWorld, @Nullable Consumer<Transform> onTeleport) Teleports the player to the spawn point oftargetWorldonce it resolves, reading the player's UUID throughcomponentAccessor. SeeteleportToSpawn(Ref, UUID, World, World, Consumer). -
teleportToSpawn
@Nonnull public static CompletableFuture<Void> teleportToSpawn(@Nonnull Ref<EntityStore> ref, @Nonnull UUID uuid, @Nullable World targetWorld, @Nonnull World playerWorld, @Nullable Consumer<Transform> onTeleport) Teleports the player to the spawn point oftargetWorldonce it resolves.- Parameters:
targetWorld- The destination world, ornullfor the player's current world.playerWorld- The player's current world, whose thread applies the teleport.onTeleport- Runs on that thread just before the teleport is applied, with the resolved point.- Returns:
- a future that fails, after logging, when the spawn point cannot be resolved, so command callers can tell the sender.
-
teleportWhenResolved
@Nonnull public static CompletableFuture<Void> teleportWhenResolved(@Nonnull CompletableFuture<Transform> spawnPointFuture, @Nonnull Ref<EntityStore> ref, @Nullable World targetWorld, @Nonnull World playerWorld, @Nullable Consumer<Transform> onTeleport) Teleports the player to the pointspawnPointFutureresolves to. SeeteleportToSpawn(Ref, UUID, World, World, Consumer). -
applyFirstSpawnTransform
@Nonnull public static TransformComponent applyFirstSpawnTransform(@Nonnull Holder<EntityStore> holder, @Nonnull Transform spawnPoint) Called to apply the first spawn point to the holder's transform and head rotation components.- Parameters:
holder- The entity holder to apply the spawn transform to.spawnPoint- The resolved spawn point.- Returns:
- the newly created
TransformComponent.
-
applyTransform
public static void applyTransform(@Nonnull Holder<EntityStore> holder, @Nonnull Transform transform) Applies the given transform to the holder's transform and head rotation components.- Parameters:
holder- The entity holder to apply the transform to.transform- The transform to apply.
-