1.0.0-next.4 • Published 2 years ago

bedpack v1.0.0-next.4

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
2 years ago

BedPack

All Contributors

Bedrock Edition Developer's Progressive Addon Creation Kit

Contents:

Overview

Writing Minecraft Addons is easier with BedPack

  • Build more content
  • Write less code

If it's JSON, BedPack covers it*.

*BedPack is still in beta, so some features may be missing or imperfect

What is a 'Progressive Addon'?

'Progressive Addon' is a term I've coined. It refers to a Minecraft Bedrock Addon which is generated by a programming library/framework, as opposed to writing JSON by hand, or using visual applications or software.

What is a Modlet?

A Modlet is a collection of related Game Elements which could (for the most part) stand on their own as a mini-addon.

This paradigm is useful for isolating parts of your Addon which gives several development advantages;

  • focus on small portions of your Addon at a time to prevent spaghetti code
  • disable parts of your Addon when debugging to quickly find the source of issues
  • access each Modlet under it's own namespace in in-game commands (configurable)

Installation & Usage

Install BedPack via your preferred package manager by installing bedpack:

npm install --save bedpack

Then, creating your Addon is simple.

import { BedPack } from "bedpack";

const MyAddon = bedPack();

MyAddon.Modlet("MyModlet1" /* define game elements... */);

MyAddon.Modlet("MyModlet2" /* define game elements... */);

await MyAddon.build(/* specify a build mode: "dev", "dist", or "bedrockOSS" */);

BedPack conforms to the Bedrock OSS project specification, and has a special bedrockOSS build mode to further support integrating with other Bedrock OSS projects.

To configure BedPack, it is recommended you use a config.json file, though you can also pass a config object directly to the BedPack() constructor if you prefer.

Defining Game Elements

Game Elements are defined by calling Game Element Builders.

BedPack provides some built-in Game Element Builders for you to use under "bedpack/stdlib", as well as a way for you to create your own.

A single Game Element Builder with very little information can be capable of generating dozens of Addon code files, making development significantly faster than writing by hand, or even using visual software.

Built-in Game Elements

BedPack currently includes the following Game Element Builders under "bedpack/stdlib":

  • recipes
    • brewing recipe
    • furnace recipe
    • shaped recipe
    • shapeless recipe
    • smithing recipe
    • stone cutter recipe

If you have an idea for BedPack's standard library, see contributing for more info on how to help.

Custom Game Elements

To create your own custom Game Element, you must extend the GameElementBuilder class.

It's recommend to "de-new" your class, especially if you intend to distribute the Game Element Builder, as it removes the need to use the new keyword when instantiating the class. This makes the usage syntax cleaner, and is easier for those who are picking up coding through building Addons.

import { GameElementBuilder, deNew } from "bedpack/elementBuilder";
import { GameElementWriteMap } from "bedpack/elementBuilder";

type MyElementInputData = {
  /* ... */
};

class MyElementBuilder extends GameElementBuilder<MyElementInputData> {
  // constructor is optional, but disencouraged
  validate(data: unknown): MyElementInputData {
    // validate data
    // BedPack uses Zod, but you may use any method you like
  }
  build(namespace: string): GameElementWriteMap {
    // build game elements from data
  }
}

export const MyElement = deNew(MyElementBuilder);

More info is available in the JSDoc on the imported items.

Regolith Compatibility

BedPack will be 100% compatible with Regolith before v1.0 release. Currently the details are being ironed out, but BedPack intends to fully integrate with Regolith soon.

Contributing

This project follows the all-contributors specification.

Contributions of any kind welcome!

When contributing, please refer to the Contribution Guide and be sure to follow our Code of Conduct.

Credits

Thanks goes to these wonderful people (emoji key):

License

BedPack is licensed under the GPLv3 license.

1.0.0-next.4

2 years ago

1.0.0-next.3

2 years ago

1.0.0-next.2

2 years ago

1.0.0-next.1

2 years ago