Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 17, 2025

This PR implements shared Xaero's Minimap & World Map integration that allows map data to be shared across different modpack instances, preventing duplicates and preserving exploration progress when playing on the same servers.

🎯 Problem Solved

Currently, Xaero's maps are stored per-instance in folders named after saved servers, leading to:

  • Duplicate map data when the same server is accessed from different modpacks
  • Loss of exploration progress when switching between modpack instances
  • Wasted disk space from redundant map files

✨ Features Added

🗺️ Shared Map Storage

  • Central storage for Xaero map data with hard links to instances
  • Follows the same pattern as existing shared mods functionality
  • Automatic migration of existing maps to shared location

🌐 Server-Specific Organization

  • Maps organized by server (host:port) for intelligent sharing
  • Server detection from instance.json configuration
  • Falls back to global shared maps when server info unavailable

⚙️ Configurable Settings

Two new settings added to the launcher:

  • xaeroMapsShared (default: true) - Enable/disable shared maps
  • xaeroMapsServerMatching (default: true) - Use server-specific organization

🔄 Automatic Lifecycle Management

  • Maps automatically set up when instances are created
  • Clean up when instances are deleted
  • Non-blocking operation with graceful fallbacks

📁 Directory Structure

game-data/
├── shared-xaero-maps/
│   ├── XaeroMinimap/           # Global shared minimap data
│   ├── XaeroWorldMap/          # Global shared world map data  
│   └── servers/                # Server-specific maps
│       ├── play.hypixel.net:25565/
│       │   ├── XaeroMinimap/
│       │   └── XaeroWorldMap/
│       └── mc.server.com:25565/
│           ├── XaeroMinimap/
│           └── XaeroWorldMap/
└── instances/
    ├── modpack-1/
    │   ├── XaeroMinimap/       # Hard link to shared location
    │   └── XaeroWorldMap/      # Hard link to shared location
    └── modpack-2/
        ├── XaeroMinimap/       # Hard link to same shared location  
        └── XaeroWorldMap/      # Hard link to same shared location

🔧 Technical Implementation

New Service Architecture

  • XaeroMapsService: Core service handling map management
  • Service Registration: Added to definedServices.ts for automatic initialization
  • Interface Definition: Clean API in runtime-api for extensibility

Integration Points

  • InstanceService: Automatic setup during instance creation/deletion
  • Settings Schema: New configuration options with proper validation
  • Hard Links: Uses existing linkDirectory() and linkWithTimeoutOrCopy() utilities

Key Methods

interface XaeroMapsService {
  setupSharedMaps(instancePath: string): Promise<void>
  setupServerSpecificMaps(instancePath: string): Promise<void>
  removeSharedMaps(instancePath: string): Promise<void>
  isSharedMapsEnabled(instancePath: string): Promise<boolean>
  migrateToSharedMaps(instancePath: string): Promise<void>
}

🧪 Testing

Created comprehensive integration tests that verify:

  • ✅ File system operations and directory structure creation
  • ✅ Server-specific map organization
  • ✅ Multi-instance sharing with data consistency
  • ✅ Settings schema compatibility
  • ✅ Migration logic for existing maps

💡 Benefits

  • Space Savings: Eliminates duplicate map data across instances
  • Progress Preservation: Exploration progress maintained when switching modpacks
  • Consistent Maps: All instances playing on the same server share map data
  • Automatic Management: Zero user intervention required
  • Backward Compatible: Can be disabled to restore original behavior

🔮 Future Enhancements

  • NBT parsing for servers.dat support (placeholder implemented)
  • Manual server assignment UI for custom map grouping
  • Selective sharing (minimap vs world map components)

Fixes #1000.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CrystalNetworkST
Copy link

Intresting XD

@CrystalNetworkST
Copy link

CrystalNetworkST commented Jul 17, 2025

But the problem is that you need to check for mod (I think) Xaero's Minimap & World Map or other maps, because not everyone plays with them

Copilot AI changed the title [WIP] Feature Request: Xaero's Minimap & World Map Integration Feature: Add Xaero's Minimap & World Map Integration with Shared Maps Jul 17, 2025
Copilot AI requested a review from ci010 July 17, 2025 10:26
Copilot finished work on behalf of ci010 July 17, 2025 10:26
@ci010
Copy link
Collaborator

ci010 commented Jul 17, 2025

But the problem is that you need to check for mod (I think) Xaero's Minimap & World Map or other maps, because not everyone plays with them

Yes, actually I dont know how exact the Xaero map data work. I need to figure out what's the right design.

@Entropy159
Copy link
Contributor

This folder structure is actually incorrect, the files are all stored under "xaero" in the instance, not "XaeroMinimap" and "XaeroWorldMap" and "servers"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Xaero's Minimap & World Map Integration

4 participants