BlockEnv Documentation
website·Indexed 30 days ago
https://blockenv.jaronline.devA tool for testing Minecraft Java modpacks in production-like environments. BlockEnv allows users to create, manage, and launch testing environments to identify and fix issues before production.
What's inside BlockEnv
- BlockEnv is a tool used to create and manage isolated environments for testing Minecraft modpacks. It allows developers to run Minecraft with various modpacks and configurations in a production-like setting locally, providing full access to debug logs and crash reports to identify and fix issues before deploying to production.
Use the blockenv CLI to manage Minecraft Java testing environments
blockenv is a command-line tool used to create and manage testing environments for Minecraft Java modpacks. The general command syntax isblockenv [options] [command].blockenv [options] [command]Install BlockEnv in a project
BlockEnv requires Node.js to be installed on your system. It can be installed as a development dependency using npm, yarn, or pnpm.npm install --save-dev --save-exact @jaronline/blockenvExamples of using blockenv setup
Common usage scenarios for the
blockenv setupcommand:- Standard Client Setup: Set up a client environment with a specific loader and Minecraft version.
- Server Setup with Version Inference: Use
--new-setup-orderto infer the Minecraft version from the loader version. - Environment Preset: Use the
--environmentflag to load settings fromblockenv.config.json, reducing the need to specify the loader and loader version manually.
# Standard client setup blockenv setup --side client --loader neoforge --loader-version 21.1.173 --minecraft-version 1.21.1 # Server setup inferring Minecraft version from loader blockenv setup --side server --loader neoforge --loader-version 21.1.173 --new-setup-order # Setup using an environment preset from blockenv.config.json blockenv setup --environment client --minecraft-version 1.21.1 # Setup using environment preset and new setup order blockenv setup --environment server --loader neoforge --loader-version 21.1.173 --new-setup-orderInstall BlockEnv CLI globally
The BlockEnv CLI can be installed globally to allow theblockenvcommand to be run from any terminal location. Note that a project-specific configuration file is still required for the CLI to function.npm install --global @jaronline/blockenvConfigure blockenv setup options
The
blockenv setupcommand supports the following configuration options:-s, --side <side>: Specify whether to setup theclientorserver.-e, --environment <environment>: Specify which environment preset to setup (requires corresponding configuration inblockenv.config.json).-l, --loader <loader>: Specify the modloader (currently onlyneoforgeis supported).--loader-version <version>: Specify the version of the modloader.-m, --minecraft-version <version>: Specify the Minecraft version.--new-setup-order: If true, runs the installer first, then downloads libraries and assets (default: false).-h, --help: Display help for the command.
Set up a testing environment with blockenv setup
Use theblockenv setupcommand to initialize a testing environment. You can specify the target side (client or server), the modloader, and the specific versions of Minecraft and the loader. The--new-setup-orderflag changes the execution sequence to run the installer before downloading libraries and assets.blockenv setup [options]Launch a Minecraft client or server using blockenv launch
The
blockenv launchcommand is used to start a Minecraft client or server. Before using this command, you must first set up a BlockEnv environment using theblockenv setupcommand.Command Syntax
blockenv launch [options]Available Options
-s, --side <side>: Specify whether to launch the server or client. Choices areclient(default) orserver.-e, --environment <environment>: Specify the environment to use for the launch.-p, --profile <profile>: Specify the client profile to launch.--player-name <playerName>: Specify the player name to use in the game.-h, --help: Display help for the command.
blockenv launch [options]Setup and launch a Minecraft server environment
To run a server environment for testing a modded Minecraft server, perform a setup to download necessary files and then launch the server.# Setup the server environment npx blockenv setup --side server --loader MOD_LOADER --loader-version MOD_LOADER_VERSION # Launch the server environment npx blockenv launch --side serverSetup and launch a Minecraft client environment
To run a client environment for testing a modpack, first perform a setup to download necessary files, then launch the environment using a specific profile. Available profiles are listed in thelauncher_profiles.jsonfile within the client environment directory.# Setup the client environment npx blockenv setup --side client --loader MOD_LOADER --loader-version MOD_LOADER_VERSION # Launch the client environment npx blockenv launch --side client --profile PROFILE_NAMEClean a BlockEnv testing environment
The
blockenv cleancommand removes configurations, mods, and temporary files to reset a testing environment or free up space. Warning: This action is destructive and removes critical configuration and mod data; use with caution.Depending on the
--sidespecified, the following items are removed:- Both sides:
config/*,defaultconfigs/*,logs/*,mods/*,resourcepacks/*,usercache.json,usernamecache.json. - Client-side only:
downloads/*,shaderpacks/*,options.txt,servers.dat,servers.dat_old. - Server-side only:
world/,whitelist.json,ops.json,banned-ips.json,banned-players.json.
# Clean the client environment blockenv clean --side client # Clean the server environment blockenv clean --side server- Both sides:
Configure BlockEnv project settings
Create ablockenv.config.jsonfile in the project root directory. This file must define thebaseDir, which is the path to the directory where BlockEnv environments will be stored.{ "baseDir": "environment" }