Development
This page is for developers who want to contribute to ResourcePackServer or build their own tooling around it.
Project Structure
ResourcePackServer/
├── main.py # Root entry point
├── pyproject.toml # Project metadata & dependencies
├── src/
│ ├── mcdreforged.plugin.json # MCDR plugin metadata
│ └── resource_pack_server/
│ ├── __init__.py
│ ├── __main__.py # python -m entry point
│ ├── server.py # HTTP server core (shared)
│ ├── config.py # Configuration classes
│ ├── logger.py # Dual-mode logger
│ ├── constants.py # Plugin constants
│ ├── hash_utils.py # SHA1 hashing utilities
│ ├── pack_merger.py # Multi-pack merge logic
│ ├── cli/
│ │ ├── __init__.py
│ │ └── cli_entrypoint.py # Standalone CLI (argparse)
│ └── mcdr/
│ ├── __init__.py
│ ├── mcdr_globals.py # MCDR global references
│ └── mcdr_entrypoint.py # MCDR plugin hooks
└── docs/ # Sphinx documentation
Architecture
Dual-Mode Design
ResourcePackServer follows the same pattern as PrimeBackup:
Environment detection:
ServerInterface.psi_opt()returnsNone→ standalone modeShared core:
server.py,pack_merger.py,config.pyare mode-agnosticDual entrypoints:
cli/cli_entrypoint.pyfor CLI,mcdr/mcdr_entrypoint.pyfor MCDRLogger: Detects MCDR environment and uses
psi.loggeror creates its own
Pack Merging
pack_merger.py implements deterministic multi-pack merging:
Packs are read into memory as
{filename: bytes}dictsMerged from lowest to highest priority → higher priority overwrites
pack.mcmetais special-cased: highest-priority metadata is the base;descriptionfields from all packs are concatenatedpack.pngis taken from the first pack that has one (highest priority)Result is cached; cache is invalidated when any source pack’s
mtimechanges
Building Docs
# Install doc dependencies
pip install -r docs/requirements.docs.txt
# Build (default language: zh_CN)
cd docs
./build_docs.sh
# Build English version
./build_docs.sh en_US
# Live preview with auto-reload
sphinx-autobuild source build/html
# Extract/update translation strings
make gettext
sphinx-intl update -p build/gettext -l zh_CN -l en_US