Class PortalLinkingStorage

java.lang.Object
net.minecraft.world.level.saveddata.SavedData
tech.anonymoushacker1279.openportals.portal.linking.PortalLinkingStorage

public class PortalLinkingStorage extends net.minecraft.world.level.saveddata.SavedData
Stores bidirectional links between portal locations across dimensions.
  • Field Details

  • Constructor Details

    • PortalLinkingStorage

      public PortalLinkingStorage()
    • PortalLinkingStorage

      public PortalLinkingStorage(List<DimensionLink> portalLinks)
  • Method Details

    • getDimensionLinks

      public List<DimensionLink> getDimensionLinks()
    • getDestination

      @Nullable public @Nullable DimensionalBlockPos getDestination(net.minecraft.core.BlockPos portalFramePos, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim)
      Get the destination for a portal at the given position.
      Parameters:
      portalFramePos - the position of the portal frame
      dim - the dimension of the portal
      Returns:
      the destination position, or null if no link exists
    • createLink

      public void createLink(net.minecraft.core.BlockPos portalFramePos, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> fromDim, net.minecraft.core.BlockPos destPortalFramePos, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> destDim)
      Create a bidirectional link between two portals. Only adds a single link object that works in both directions.
      Parameters:
      portalFramePos - the position of the source portal frame
      fromDim - the dimension of the source portal
      destPortalFramePos - the position of the destination portal frame
      destDim - the dimension of the destination portal
    • cleanupOrphanedLinks

      public int cleanupOrphanedLinks(net.minecraft.server.MinecraftServer server)
      Clean up orphaned links.
      Parameters:
      server - the server to check dimensions
      Returns:
      the number of links removed