Class PortalInstanceLinks

java.lang.Object
com.hypixel.hytale.builtin.portals.PortalInstanceLinks

public final class PortalInstanceLinks extends Object
Remembers which destination world each portal device inside an instance copy opened. A device in a normal world persists its destination in the chunk, but an instance copy is deleted and re-created from its template, so the link dies with the copy while the summoned world can outlive it. A device is identified by the instance's InstanceKey plus its authored block position, which are the same in every copy of that instance.

The link carries the device config so re-linking does not depend on how much of the PortalDevice component the block asset authors. PortalInstanceRelinker reads the entries of an instance when a copy of it starts.

The map is runtime-only on purpose: summoned worlds do not survive a server restart, so an empty map is the correct state after one. Entries are dropped when the destination world is removed and when a lookup resolves to a dead world.

  • Method Details

    • linksFor

      @Nullable public static Map<PortalInstanceLinks.DevicePos, PortalInstanceLinks.Link> linksFor(@Nonnull World world)
      The recorded links for this world's instance, or null in any world where re-linking must not apply: normal worlds (the chunk owns the link), unkeyed instances (no stable identity), and instance edit or validation worlds (no return point; a re-link there could be saved into the template).
    • record

      public static void record(@Nonnull World originWorld, int x, int y, int z, @Nonnull World destination, @Nonnull PortalDeviceConfig config)
    • forget

      public static void forget(@Nonnull World world, @Nonnull PortalInstanceLinks.DevicePos pos)
    • forgetDestination

      public static void forgetDestination(@Nonnull UUID destinationWorldUuid)