0.1.5 • Published 1 year ago

@luckedcoronet/lcbuild v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

LCBuild

LCBuild is a Minecraft addon compiler that you can use through commands.

A quick overview of what you can achieve with LCBuild:

  • TypeScript support
  • Centralized project directory
  • One command to compile and copy your packs to Minecraft
  • Automatic manifest.json UUID generation for release builds

Prerequisites

LCBuild only works on Windows 10/11 and requires Node.js version 14 or later.

Make sure TypeScript is installed globally via npm:

npm i typescript -g

Table of contents

Why use LCBuild

If you are making a Minecraft addon, you will probably feel (or already felt) that putting your projects directly inside development_behavior_pack and development_resource_pack is not really good.

And if you want to use TypeScript in a behavior pack inside development_behavior_pack, you will not have a good time.

With LCBuild, you can say goodbye to those nightmares!

Installation

BEFORE YOU INSTALL: please read the prerequisites

First, create a folder somewhere on your drive (C:\ or not does not matter) and open it in terminal.

Second, run the command:

npm init -y
npm i @luckedcoronet/lcbuild typescript --save-dev
npm i @minecraft/server@latest @minecraft/server-ui@latest --save-exact
tsc --init

Third, run the command:

npx lcbuild

This will generate a folder named ".lcbuild" in your project folder, which contains files used by LCBuild.

Fourth, open config.json inside .lcbuild and change properties to your preferences. See Config properties for details.

Fifth, create src folder and make its structure identical to this:

Project Root
├── src
│   ├── packs
│   │   ├── (Behavior pack folder)
│   │   │   └── (Behavior pack files and folders)
│   │   └── (Resource pack folder)
│   │       └── (Resource pack files and folders)
│   └── scripts
│       ├── main.ts
│       └── (Script files)
└── (Other files and folders)

Config properties

  • minecraftComMojangDirectoryPath string - Full path of com.mojang folder
  • fullAddonName string - Full name of your addon (for example, "MyUntitledAddon")
  • shortAddonName string - Short name of your addon (for example, "MUA")
  • behaviorPackDirectoryName string - Name of the behavior pack directory name in src
  • resourcePackDirectoryName string - Name of the resource pack directory name in src
  • externalModules string array - List of modules/packages to be ignored by the bundler (it must contain "@minecraft")
  • entryScriptFileName string - Name of the main script file without extension (for example, "main")
  • compilationIgnorePatterns - List of glob patterns to exclude from pack compilation

Commands

Run npx lcbuild --help see list of commands.

Create development build

Example

npx lcbuild dev

Arguments

  • --bundleScripts -b - Choose whether to bundle scripts
  • --minifyBundle -m - Choose whether to minify bundled scripts when --bundleScripts flag is set to true
  • --copyToMc -c - Choose whether to copy compiled packs to development_behavior_packs and development_resource_packs after the build process is finished

Create release build

Example

npx lcbuild release --v 1 0 0 --s stable --i 1

Arguments

  • --bundleScripts -b - Choose whether to bundle scripts
  • --minifyBundle -m - Choose whether to minify bundled scripts when --bundleScripts flag is set to true
  • --copyToMc -c - Choose whether to copy compiled packs to development_behavior_packs and development_resource_packs after the build process is finished
  • --releaseVersion -v - Set release version in MAJOR MINOR PATCH format
  • --releaseStage -s - Set release stage ("prealpha", "alpha", "beta", "rc", or "stable")
  • --releaseIteration -i - Set release iteration/index as number

History of LCBuild

This is how I was developing my addon in early 2023: 3 git repositories (one for behavior pack, one for resource pack, another one for scripts), 3 VSCode windows opened at same time, and manually copying script folder every time I compile them.

After I realized that it was super unproductive, I made a Python script to automate those tedious tasks. It was fine but not ideal, because I write Minecraft scripts in TypeScript. So, I decided to rewrite it in Node.js and named it LCBuild.

Contributing

LCBuild is an open-source project.

See CONTRIBUTING.md for more details.

License

Licensed under MIT

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago