objd 0.3.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

objD #

Objective Builder Just for Datapacks

objD is a framework for developing Datapacks for Minecraft. It uses the Dart programming language.

Why a framework? #

A framework is a set of utilities to reduce the amount of repetitive work. I've tried many ways in the past to achieve a quick and easy way to generate Datapacks for Minecraft: A own programming language mcscript, several graphical online generators at stevertus.com or premade utilities.

Instead of developing a language, why not using the tools and parser an other language gives you? By building a custom frame around it you get the reliability and the extensive debugging tools in Editors.

The generation of Datapacks is easy,fast and aims to be less repetitive and modular by utilizing the concept of Widgets as one of the main features.

Installation #


You need the Dart SDK for this framework. 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.

Make a new folder that will house your project wherever you want(I would recommend datapacks folder).

And inside of that create a file named pubspec.yaml and another folder called lib.

Open the pubspec.yaml file and add

name: [unique_namespace]
   objd: ^0.3.1

Also remember to replace the [unique_namespace] with your own project name. And run

$  pub get

with the console in the new folder(VS code does this automatically)

Tip: You can also generate a full project with a console command. read more

Getting started #

Let's get started and create our first dart file with lib/main.dart file.

Then we import the framework with:

import 'package:objd/core.dart';

Then we need to create a new datapack project:

void main(List<String> args){
			name:"This is going to be the generated folder name",
			target:"./", // path for where to generate the project
			generate: CustomWidget() // The starting point of generation

Next of we need to build this custom Widget:

class CustomWidget extends Widget {
	Widget generate(Context context){

To get more details on why we build it like that, check out the Widget documentation.

Like we can see the generate method, which is called on build, has to return another Widget, in our case an instance of the Pack class.

Widget generate(Context context){
	return Pack(
		main: File( // optional

What we are doing right now is to generate a new subpack with a name(This will be the namespace of your functions later) and a main file(runs every tick) with the name "main.mcfunction".

You can run the project already and the result should be a pack with an empty main.mcfunction file.

So lets add some functionality to our project in our main file. We can use the Log Widget to display a message to the player.

main: File(
	child: Log('Hello World')

But how to add a list of Actions then? Well there's also an Widget for that: For.of

child: For.of([
	Log('Hello World'),
	Command('setblock 0 0 0 air')

So now we have a List of Widget, so we can use as many as we want

Whole code:

import 'package:objd/core.dart';

void main(List<String> args){
            name:"This is going to be the generated folder name",
            generate: CustomWidget() 

class CustomWidget extends Widget {
    Widget generate(Context context){
        return Pack(
            main: File( // optional
                child: For.of([
			Log('Hello World'),
			Command('setblock 0 0 0 air')

Documentation and Examples #

The example folder contains a boilerplate to start off.

There are many more widgets for objD including basic Widgeds, Command Wrappers, Text and Util Widgets. So check out the documentation at https://objd.stevertus.com or my youtube channel https://www.youtube.com/stevertus. In this video playlist are all objD related videos: https://www.youtube.com/playlist?list=PL5AxRIlgrL5GnKz69w4AUyqpZC35BlxdD

0.3.1 #

  • added Schedule.append, Schedule.appendFile and ScheduleMode for the upcoming 1.15 release
  • added Support for Predicates in Entity
  • added Condition.predicate
  • added Storage Widget to handle global nbt storage
  • added Data target DataStorage to store nbt globally
  • added TextComponent.storageNbt to display nbt from Storage
  • added RawFile to allow generation of any kind of file in a pack(for upcoming Predicates, LootTables...)
  • added Operators & and >> to Tag to enable faster Conditions and Assignments
  • updated Kill to include just an optional target
  • code refactoring, issue fixing

0.3.0 #

  • added updated documentation site at https://objd.stevertus.com
  • added completly new gson parser capable of types, see more here: https://pub.dev/packages/gson
  • added operators to Score: +, -, *, /, %, <, >, <=, >=. >>, &
  • added Entity.Self Constructor as a shortcut
  • added Entity kill, raycast, teleport, give, replaceitem, particle, crash, tellraw, tp, execute, exec, execStrait, asat, as, at, joinTeam, leaveTeam and forEach Methods.
  • added Data Manipulation within Entity with dataMerge, dataGet, dataRemove and dataModify methods
  • added Selector
  • added Tp Widget
  • added RestAction, RestActionAble and StraitWidget to support underlying structure
  • added Area.rel
  • added Area.fromRanges
  • added exact parameter for Range to support single matches
  • added EntityType operator == to match same Types
  • added Builder & ItemBuilder Widgets
  • added IndexedFile to update the old complicated Group functionality.
  • added --out argument to change the output directory with the CLI
  • rewritten Execute with StraitWidget
  • rewritten Entity addTag, addTags, removeTag, removeTags
  • moved the cli commands and related files to a new package here: https://pub.dev/packages/objd_cli
  • removed gson parser in TextComponent, Bossbar, Title and Tellraw
  • changed Entity.self to Entity.Self
  • changed Range(exact:...) to Range.exact(...)
  • changed all args to fit the CLI
  • updated Group to IndexedFile. BREAKING: Removed fileId and generateIDs
  • fixed missing seperator when using multiple scores in Entity
  • fixed missing items and added documentation references
  • fixed that global Location does not cut of last double digit(1.0)
  • fixed unnessesary required value with Tag
  • fixed that Entity.copyWith just returned nullĀ“
  • fixed bug that Execute generated a List instead of just execute
  • refactored code

A big thanks goes to Minimine who actually did most of the new additions, the new gson package and bug fixes. Thanks for contributing! Check out his projects here: https://github.com/MinimineLP Thanks as well for the critical bugs reports by Mastermori!

0.2.4 #

  • added ClickEvent Module
  • added copyWith on Entities
  • added setValues on Entity to change selections afterwards
  • added Location.clone
  • added desc to Log
  • changed Color to const to allow defaults
  • changed Particle to use a double type for speed and no requirement for a location
  • fixed Particle.item to use ItemType instead of Item
  • fixed CommandList Type Error
  • fixed Raycast Error when not using stop in the ray property
  • fixed missing Invisible Nbt on ArmorStand

0.2.3 #

  • added new Module type to allow registering tick functions and files with a convenient api
  • added modules property to Pack to inject new modules
  • added ScoreTimerModule that implements a Timer using Scoreboards
  • changed Widget class to be abstract
  • tweaked Raycast to work properly
  • improved Entity.not
  • fixed TextComponent.space with negative numbers

0.2.2 #

  • added Item.clone, Entity.clone and similar Methods with ItemType and Slot to enrich changeable inputs
  • added Entity.not to negate arguments
  • added Slot.craft
  • added Clear Wrapper
  • added Condition.Data
  • added Block.nbt to include Nbt-data and Blockstates
  • added Score.findSmallest and Score.findBiggest
  • updated Item.getGiveNotation to include Damage
  • changed Slot utilities to use seperate row and column arguments
  • fixed missing minecraft: on Item nbt
  • fixed wrong order of scale and datatype for Data.fromScore

0.2.1 #

  • added experimental hotreload to boost performance
  • added new -hotreload and -full build arguments
  • added new Slot class with helper functions
  • added Advancement Widget
  • added Data.fromScore
  • added Rotation utilities like Rotation.n and Rotation.north
  • added Rotation.getDirection
  • added isRotated value on entities to test for a Rotation object
  • reworked ReplaceItem for Blocks and using the new Slot
  • updated Item Slot requirements to match the Slot datatype
  • updated project generator without File path
  • updated Getting Started to fit new requirements and systems
  • fixed Location.storeResult

0.2.0 #

  • Completly reworked build algorithms that run the generate method just once.
  • improved performace
  • added new build arguments in createProject
  • new build arguments -min -prod and -debug
  • access to the prod property on context to change widget behaviour in productive build
  • comments and line breaks get automatically removed in productive build
  • added Raycast Widgets with many options to choose from
  • added ForEach Loop that iterates through each score
  • added Do.Until and Do.While Loops
  • added a Book Generator with Item.Book that allows to use BookPages and TextComponents to fill a book
  • added a TextComponent for the negative Spaces Font by AmberW. This automatically calculates the customs chars for a specified pixel value.
  • added a TextComponent for Custom Fonts
  • added a TextComponent for Linebreaks
  • added number and boolean arguments for Log
  • added new Block Condition which tests the current Position after the block
  • updated Say Wrapper to either use a String or Entity in one argument
  • fixed missing encapsulate property on If.not
  • fixed double and unmatching group ids with multiple packs and widgets
  • fixed multiple scoreboard related bugs. All declared Scoreboards from all packs should generate in the load functions now
  • fixed TextClickEvent.runCommand to include a slash (Thanks Dommi)
  • fixed data modify command generator (Thanks Vinicius Rangel for pull)

0.1.3 #

  • added Bossbar
  • added nbt TextComponents
  • added encapsulate to If
  • added strNbt to Data and Entity to support unvalid json chars
  • reworked the global console commands and binaries
  • fixed data modify
  • fixed missing datatype and scale with entity.storeResult

0.1.2 #

  • added RandomScore
  • added a Team wrapper
  • added a team option for entities as well as joinTeam and leaveTeam methods
  • added Repeat to repeat code with delay
  • added Log Widget to quickly print Messages, Scores or Entities in the chat
  • added ArmorStand Widget to create an armorstand
  • added Hologram to display text
  • added AreaEffectCloud
  • added Tag.toggle
  • added a create option to File
  • added a nbt option for Setblock
  • added Score.fromSelected to avoid annoying Entity.Selected
  • changed summon arguments
  • changed effect to also support nbt effects
  • changed Location to optional arguments
  • fixed when there are two identical files that they would extend

0.1.1 #

  • added AroundLocation widget
  • added Trigger wrapper
  • added Effect wrapper
  • added Particle wrapper
  • added clone wrapper
  • added nbt option for entities
  • added score.con for constants
  • added display name and lore for items
  • changed global commands and boilerplate project
  • fixed execute align
  • fixed execute bug if targetPath was null
  • fixed timer not generating schedule

0.1 #

with the first proper release there are the first util classes:

  • added Timeout and Timer widgets for delays and clocks
  • added Tag widget
  • added Schedule widget
  • added scores and tags parameters in any entity constructor
  • added addTag, addTags and removeTag Methods on entity
  • added targetFilePath and targetFileName parameters for the execute and if constructors to force a folder or filename
  • added suffix option for groups
  • added tag condition
  • added compile time
  • added experimental global commands
  • changed if behaviour to use a Tag instead with or conditions, else statement or multiple then children
  • fixed: nested groups generated in the wrong order
  • fixed entity Range generating unvalid results for -10..0
  • fixed groups that generated a different file than execution name(still some issues)

0.0.10 #

  • added experimental if else statements(may be changed later on)
  • added an if option for execute as well
  • added the area class
  • fixed group
  • fixed requirement for slot and count for items
  • changed entity static functions to named constructors(for Entity.Selected...)
  • updated fill to use area instead
  • updated teleport to use rotation
  • updated to dart 2.1.1
  • added inline documentation for many widgets
  • split the build process into multiple files

0.0.9 #

  • added subcommands for execute
  • added methods for execute
  • added storeResult to Location and Entity
  • added Rotation
  • fixed reference issue for groups(they prefixed everything :o)

0.0.8 #

  • added Entity.PlayerName()
  • fixed readme
  • modified score.setToResult
  • made Block, EntityType and ItemType constants to use them in defaults

0.0.7 #

  • added score generation
  • added Scoreboard
  • added Score with calculation and condition methods
  • fixed that main and load functions were not executed

0.0.6 #

  • added teleport
  • added fill
  • added data widget and DataModify to edit nbt data
  • updated entity with area parameter

0.0.5 #

0.0.4 #

  • added Summon command wrapper
  • added TextComponents
  • added Title and Tellraw
  • added Color class
  • added TextClickEvent class
  • added TextHoverEvent class

0.0.3 #

  • added Block
  • added Location
  • added Setblock
  • added Say

0.0.2 #

  • Fixed ReadMe

0.0.1 #

  • Initial Project with Basics and Builder


// import the core of the framework:
import 'package:objd/core.dart';
// import the custom pack:
import './packs/examplePack.dart';

void main(List<String> args) {

      name: "folder name",
      target: "./",             // path for where to generate the project
      generate: ExamplePack(),  // The starting point of generation

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  objd: ^0.3.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:objd/basic/area.dart';
import 'package:objd/basic/block.dart';
import 'package:objd/basic/command.dart';
import 'package:objd/basic/condition.dart';
import 'package:objd/basic/entity.dart';
import 'package:objd/basic/extend.dart';
import 'package:objd/basic/file.dart';
import 'package:objd/basic/for_list.dart';
import 'package:objd/basic/group.dart';
import 'package:objd/basic/indexed_file.dart';
import 'package:objd/basic/item.dart';
import 'package:objd/basic/location.dart';
import 'package:objd/basic/module.dart';
import 'package:objd/basic/pack.dart';
import 'package:objd/basic/parsable.dart';
import 'package:objd/basic/raw_file.dart';
import 'package:objd/basic/rest_action.dart';
import 'package:objd/basic/rotation.dart';
import 'package:objd/basic/score.dart';
import 'package:objd/basic/scoreboard.dart';
import 'package:objd/basic/selector.dart';
import 'package:objd/basic/slot.dart';
import 'package:objd/basic/strait_widget.dart';
import 'package:objd/basic/tag.dart';
import 'package:objd/basic/text.dart';
import 'package:objd/basic/text_components.dart';
import 'package:objd/basic/widget.dart';
import 'package:objd/basic/widgets.dart';
import 'package:objd/build/build.dart';
import 'package:objd/build/buildFile.dart';
import 'package:objd/build/buildPack.dart';
import 'package:objd/build/buildProject.dart';
import 'package:objd/build/context.dart';
import 'package:objd/build/findPack.dart';
import 'package:objd/build/io.dart';
import 'package:objd/build/project.dart';
import 'package:objd/build/reloader.dart';
import 'package:objd/build/scan.dart';
import 'package:objd/core.dart';
import 'package:objd/modules/click_event.dart';
import 'package:objd/modules/modules.dart';
import 'package:objd/modules/score_timer.dart';
import 'package:objd/utils/areaeffectcloud.dart';
import 'package:objd/utils/armorstand.dart';
import 'package:objd/utils/aroundlocation.dart';
import 'package:objd/utils/builder.dart';
import 'package:objd/utils/do_loop.dart';
import 'package:objd/utils/foreach.dart';
import 'package:objd/utils/hologram.dart';
import 'package:objd/utils/item_builder.dart';
import 'package:objd/utils/log.dart';
import 'package:objd/utils/randomScore.dart';
import 'package:objd/utils/raycast.dart';
import 'package:objd/utils/repeat.dart';
import 'package:objd/utils/storage.dart';
import 'package:objd/utils/timer.dart';
import 'package:objd/utils/widgets.dart';
import 'package:objd/wrappers/advancement.dart';
import 'package:objd/wrappers/bossbar.dart';
import 'package:objd/wrappers/clear.dart';
import 'package:objd/wrappers/clone.dart';
import 'package:objd/wrappers/comment.dart';
import 'package:objd/wrappers/data.dart';
import 'package:objd/wrappers/effect.dart';
import 'package:objd/wrappers/execute.dart';
import 'package:objd/wrappers/fill.dart';
import 'package:objd/wrappers/give.dart';
import 'package:objd/wrappers/if.dart';
import 'package:objd/wrappers/kill.dart';
import 'package:objd/wrappers/particle.dart';
import 'package:objd/wrappers/replaceitem.dart';
import 'package:objd/wrappers/say.dart';
import 'package:objd/wrappers/schedule.dart';
import 'package:objd/wrappers/setblock.dart';
import 'package:objd/wrappers/summon.dart';
import 'package:objd/wrappers/team.dart';
import 'package:objd/wrappers/teleport.dart';
import 'package:objd/wrappers/tellraw.dart';
import 'package:objd/wrappers/title.dart';
import 'package:objd/wrappers/tp.dart';
import 'package:objd/wrappers/trigger.dart';
import 'package:objd/wrappers/widgets.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21


Detected platforms: Flutter, other

Platform components identified in package: io.

Health suggestions

Format lib/basic/area.dart.

Run dartfmt to format lib/basic/area.dart.

Format lib/basic/block.dart.

Run dartfmt to format lib/basic/block.dart.

Format lib/basic/command.dart.

Run dartfmt to format lib/basic/command.dart.

Fix additional 60 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/basic/condition.dart (Run dartfmt to format lib/basic/condition.dart.)
  • lib/basic/entity.dart (Run dartfmt to format lib/basic/entity.dart.)
  • lib/basic/extend.dart (Run dartfmt to format lib/basic/extend.dart.)
  • lib/basic/file.dart (Run dartfmt to format lib/basic/file.dart.)
  • lib/basic/for_list.dart (Run dartfmt to format lib/basic/for_list.dart.)
  • lib/basic/item.dart (Run dartfmt to format lib/basic/item.dart.)
  • lib/basic/location.dart (Run dartfmt to format lib/basic/location.dart.)
  • lib/basic/module.dart (Run dartfmt to format lib/basic/module.dart.)
  • lib/basic/parsable.dart (Run dartfmt to format lib/basic/parsable.dart.)
  • lib/basic/raw_file.dart (Run dartfmt to format lib/basic/raw_file.dart.)
  • lib/basic/rotation.dart (Run dartfmt to format lib/basic/rotation.dart.)
  • lib/basic/score.dart (Run dartfmt to format lib/basic/score.dart.)
  • lib/basic/scoreboard.dart (Run dartfmt to format lib/basic/scoreboard.dart.)
  • lib/basic/slot.dart (Run dartfmt to format lib/basic/slot.dart.)
  • lib/basic/tag.dart (Run dartfmt to format lib/basic/tag.dart.)
  • lib/basic/text.dart (Run dartfmt to format lib/basic/text.dart.)
  • lib/basic/text_components.dart (Run dartfmt to format lib/basic/text_components.dart.)
  • lib/basic/widget.dart (Run dartfmt to format lib/basic/widget.dart.)
  • lib/basic/widgets.dart (Run dartfmt to format lib/basic/widgets.dart.)
  • lib/build/build.dart (Run dartfmt to format lib/build/build.dart.)
  • lib/build/buildFile.dart (Run dartfmt to format lib/build/buildFile.dart.)
  • lib/build/buildPack.dart (Run dartfmt to format lib/build/buildPack.dart.)
  • lib/build/buildProject.dart (Run dartfmt to format lib/build/buildProject.dart.)
  • lib/build/context.dart (Run dartfmt to format lib/build/context.dart.)
  • lib/build/findPack.dart (Run dartfmt to format lib/build/findPack.dart.)
  • lib/build/io.dart (Run dartfmt to format lib/build/io.dart.)
  • lib/build/project.dart (Run dartfmt to format lib/build/project.dart.)
  • lib/core.dart (Run dartfmt to format lib/core.dart.)
  • lib/modules/click_event.dart (Run dartfmt to format lib/modules/click_event.dart.)
  • lib/modules/score_timer.dart (Run dartfmt to format lib/modules/score_timer.dart.)
  • lib/utils/aroundlocation.dart (Run dartfmt to format lib/utils/aroundlocation.dart.)
  • lib/utils/builder.dart (Run dartfmt to format lib/utils/builder.dart.)
  • lib/utils/foreach.dart (Run dartfmt to format lib/utils/foreach.dart.)
  • lib/utils/hologram.dart (Run dartfmt to format lib/utils/hologram.dart.)
  • lib/utils/item_builder.dart (Run dartfmt to format lib/utils/item_builder.dart.)
  • lib/utils/log.dart (Run dartfmt to format lib/utils/log.dart.)
  • lib/utils/randomScore.dart (Run dartfmt to format lib/utils/randomScore.dart.)
  • lib/utils/raycast.dart (Run dartfmt to format lib/utils/raycast.dart.)
  • lib/utils/repeat.dart (Run dartfmt to format lib/utils/repeat.dart.)
  • lib/utils/storage.dart (Run dartfmt to format lib/utils/storage.dart.)
  • lib/utils/widgets.dart (Run dartfmt to format lib/utils/widgets.dart.)
  • lib/wrappers/advancement.dart (Run dartfmt to format lib/wrappers/advancement.dart.)
  • lib/wrappers/bossbar.dart (Run dartfmt to format lib/wrappers/bossbar.dart.)
  • lib/wrappers/clear.dart (Run dartfmt to format lib/wrappers/clear.dart.)
  • lib/wrappers/clone.dart (Run dartfmt to format lib/wrappers/clone.dart.)
  • lib/wrappers/comment.dart (Run dartfmt to format lib/wrappers/comment.dart.)
  • lib/wrappers/data.dart (Run dartfmt to format lib/wrappers/data.dart.)
  • lib/wrappers/effect.dart (Run dartfmt to format lib/wrappers/effect.dart.)
  • lib/wrappers/execute.dart (Run dartfmt to format lib/wrappers/execute.dart.)
  • lib/wrappers/fill.dart (Run dartfmt to format lib/wrappers/fill.dart.)
  • lib/wrappers/give.dart (Run dartfmt to format lib/wrappers/give.dart.)
  • lib/wrappers/if.dart (Run dartfmt to format lib/wrappers/if.dart.)
  • lib/wrappers/kill.dart (Run dartfmt to format lib/wrappers/kill.dart.)
  • lib/wrappers/particle.dart (Run dartfmt to format lib/wrappers/particle.dart.)
  • lib/wrappers/replaceitem.dart (Run dartfmt to format lib/wrappers/replaceitem.dart.)
  • lib/wrappers/schedule.dart (Run dartfmt to format lib/wrappers/schedule.dart.)
  • lib/wrappers/summon.dart (Run dartfmt to format lib/wrappers/summon.dart.)
  • lib/wrappers/team.dart (Run dartfmt to format lib/wrappers/team.dart.)
  • lib/wrappers/tellraw.dart (Run dartfmt to format lib/wrappers/tellraw.dart.)
  • lib/wrappers/tp.dart (Run dartfmt to format lib/wrappers/tp.dart.)

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://stevertus.com was unreachable.

Documentation URL doesn't exist. (-10 points)

At the time of the analysis the documentation field https://objd.stevertus.com was unreachable.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
colorize ^2.0.0 2.0.0
gson ^0.1.2 0.1.2
meta ^1.1.7 1.1.8
Dev dependencies
pedantic ^1.8.0