implement GitHub resource pack auto-updater with HTTP server and configuration

This commit is contained in:
Lars Behrends
2025-12-30 00:17:46 +01:00
parent 3305388f1c
commit e0dbca8d51
6 changed files with 432 additions and 5 deletions

View File

@@ -1,10 +1,11 @@
# Projectvollidioten
A Minecraft Fabric mod that logs player data on join and leave events to an external API.
A Minecraft Fabric mod that provides comprehensive player data logging and automatic resource pack management via GitHub integration.
## Features
- Logs player join and leave events
### Player Data Logging
- Logs player join and leave events to external API
- Captures detailed player statistics including:
- Health and max health
- Hunger level
@@ -15,6 +16,15 @@ A Minecraft Fabric mod that logs player data on join and leave events to an exte
- Asynchronous API communication to prevent server lag
- Pretty-printed JSON logging for debugging
### Automatic Resource Pack Updates
- **GitHub Integration**: Automatically monitors GitHub releases for new resource packs
- **HTTP Server**: Built-in HTTP server (port 25585) to serve resource packs locally
- **Smart Updates**: Downloads and installs new resource pack versions automatically
- **Server Configuration**: Automatically updates `server.properties` with correct URLs and SHA1 hashes
- **Player Notifications**: Broadcasts resource pack availability to all players
- **Periodic Checking**: Configurable interval checking (default: every 60 minutes)
- **Secure Serving**: Only serves configured resource pack files for security
## Requirements
- Minecraft 1.21.11
@@ -30,10 +40,42 @@ A Minecraft Fabric mod that logs player data on join and leave events to an exte
## Configuration
### Player Data Logging
The mod sends data to a hardcoded API endpoint: `http://localhost:3000/api/data`
To change the API endpoint, modify the `API_URL` constant in `PlayerDataLogger.java`.
### Resource Pack Auto-Updater
The resource pack updater is configured via `config/projectvollidioten/resourcepack.json`:
```json
{
"githubOwner": "your-username",
"githubRepo": "your-repo-name",
"resourcePackFileName": "my-pack.zip",
"checkIntervalMinutes": 60
}
```
**Configuration Options:**
- `githubOwner`: Your GitHub username or organization name
- `githubRepo`: The repository name containing the resource pack releases
- `resourcePackFileName`: The exact filename of the resource pack ZIP in GitHub releases
- `checkIntervalMinutes`: How often to check for updates (default: 60 minutes)
**Setup Instructions:**
1. Create a GitHub repository for your resource packs
2. Upload resource pack ZIP files as release assets
3. Update the configuration file with your repository details
4. The mod will automatically download and serve new versions
5. Players will be notified when new packs are available
**Important Notes:**
- The built-in HTTP server runs on port 25585 by default
- Resource packs are stored in `server-resource-packs/` directory
- Only the configured filename can be served for security
- SHA1 hashes are automatically computed and updated in server.properties
## API Format
The mod sends POST requests with JSON payloads in the following format: