Class SpawnUtil

java.lang.Object
com.hypixel.hytale.server.core.universe.world.SpawnUtil

public final class SpawnUtil extends Object
A utility class that contains a variety of spawn-related methods.
  • Constructor Details

    • SpawnUtil

      public SpawnUtil()
  • Method Details

    • resolveSpawnPoint

      @Nonnull public static CompletableFuture<Transform> resolveSpawnPoint(@Nonnull World world, @Nonnull UUID uuid)
      Resolves the spawn point of world for 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 of targetWorld once it resolves, reading the player's UUID through componentAccessor. See teleportToSpawn(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 of targetWorld once it resolves.
      Parameters:
      targetWorld - The destination world, or null for 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 point spawnPointFuture resolves to. See teleportToSpawn(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.