Stevertus / objD

objD is a framework for developing Datapacks for Minecraft. It uses the Dart programming language.
https://objd.stevertus.com
BSD 2-Clause "Simplified" License
46 stars 13 forks source link
commands dart datapack framework generator mapmaking minecraft

objD

Objective Builder Just for Datapacks

objD is an object oriented toolkit for building/generating Datapacks for Minecraft. It uses the Dart programming language and thus integrates into popular editors like Visual Studio Code or IntelliJ.

You are able to write modular Datapacks, get suggestions with linting, auto completion, extensive documentation and syntax highlighting.

No need to remember which parameters commands take, automatic checking of your code and a ton of utility widgets help you to get more efficient creating Datapacks.

Resources

objD has many components. But there are a few things that can accelerate your start.

Installation

You need the Dart SDK for this library. Download and install it from https://www.dartlang.org/tools/sdk

I would also recommend Visual Studio Code along with the dart plugin to edit dart files very conveniently.

To get started, it is the easiest to use the objD CLI for generating a sample project, make small changes and let it run with hot reload.

Install it using

dart pub global activate objd_cli

You can then invoke the new command to create your project, follow the instructions:

dart pub global run objd_cli new <project_name>

Go into the created directory cd <project_name> and to install all dependencies run

dart pub get

For further explanations, refer to the Intro Video, where this is presented in depth.

Example

objD is all about nesting, abstracting the sequential nature of commands into so called Widgets and allowing powerful combinations.

For(
  from: 0,
  to: n,
  create: (i) => ArmorStand(
    Location.rel(x: i.toDouble()),
    name: TextComponent("Number $i"),
    nameVisible: true,
    pose: Pose(
      head: [360 * i / n - 180],
    ),
  ),
),

This simple example creates n armor stands(depending on a variable) each with custom names and pose.

Where in vanilla commands you would have to change multiple commands, this approach is flexible and can easily controlled by parameters.

Updating

When updating to a new version, change the version tag of objD in the pubspec.yaml file.

Note: also make sure the dart version requirements match the version requirements of objD. For 0.4.5 onwards, Dart 3.0.0 is required.

name: <project_name>

environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  objd: ^0.4.7

dev_dependencies:
  build_runner:
  objd_gen: ^0.0.4

Contributing & Bugs

New and fresh ideas are always welcome and greatly appreciated. Please create a pull requestto organize new additions.

Bugs can be reported using GitHub Issues.

Huge thanks to everyone who participated and made objD a better tool ❤.