objd 0.0.9

  • README.md
  • Example
  • Installing
  • Versions
  • new55

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

   objd: ^0.0.9

And run

$  pub get

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

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';b

Then we need to create a new datapack project:

void main(){
			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
			path: 'main'

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.

main: File(
	path: 'main',
	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(List<Widget>[
	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

Widget #

A widget is the base element for basically everything in objectiveD.

generate(Context)returns the underlying Widget Tree
toMap()Similar to toString, but returns a Map tree of the child in generate

Example: We can use an Widget to get or build functionality. e.g

// building our own widget:
class CustomCommand extends Widget {
	Widget generate(Context context){
		// using an existing widget
		return Command('custom')

Context #

Maybe you already wondered what this context argument here is:

Widget generate(Context context){

The Context is a way to get certain important information from the parents.

packIdString of the current pack's name
filethe current file name
loadFilethe filename of your load file
mainFilethe filename of your main file
prefixesa List of Strings that should be added in front of actions(mainly used by Groups)

You can use this context to build more modular Widgets and don't need to hardcode certain files and the pack id:

class LoadWidget extends Widget {
	Widget generate(Context context){
		return Command('function ' + context.packId + ":" + context.loadFile)

Project #

The project is a special Widget which is just defined once. It contains some built options, like description or name, but also the entire underlying tree of packs, files and actions.

namethe name of the datapack folder
generatea widget that defines the projects content
[description]A description that will go in pack.mcmeta


main() {
// create Project takes in one project and compiles it
	name:  "tested",
	generate:  mainWidget(),

Pack #

A pack is logically the next step. This defines a sub-pack with an name again that will be our namespace afterwards. Here we can also define included files as well as the main and load function:

namethe name of the sub-pack
[main]the main file that is ran every tick
[load]the load file that is ran on reload
[files]A List of type File witch includes other needed files


	main: File(...),
	load: File(...),
	files: List<File> [

The Pack class can be used as often as you want and where you want, so you can also define a new pack in some file.

Notice: The namespace of the pack is accessible in these files by using the context variable. e.g: Command("function" + context.packId + ":run")

File #

The Pack class already required some files, therefore this is the definition.

The File constructor has two required arguments:

paththe desired file path going from /data/:packId:/functions/ on
childthe content of the file
[execute]Boolean if the function should be executed directly

The File class can be used as often as you want and where you want, so you can also define a new file in a For container for example. Example:

	main: File(
		// and defining a new file inside of an widget
		child: File.execute( // same as execute: true
			path: 'new'
			child: Command(...)

Extend #

Extend is very similar to File, but instead of creating a new file it adds content to an existing file.

Stringthe desired file path going from /data/:packId:/functions/ on
childthe additional content
[first]Boolean if the content should be added in front of the original(def. false)

So lets say we already have some files in our pack, but want to add something to the main file somewhere entirely else in our project:

	child: Command("say okay"),
	first: true

This would add the command say okay in front of our main.mcfunction.

Command #

A Command is a raw action, that is executed by Minecraft directly.

Stringthe raw command in the format "/command" or "command"


// using a command in a file:
	child: Command('/say hey')
// uses the say command in command.mcfunction:
say hey

For #

The For class enables you to add multiple endpoints to one Widget.

There is always a List of Widgets involved.

tothe ending index including itself
createa function returning a Widget based on the index argument
[from]the starting index(default 0)
[step ]the value used in each iteration to increases the index(default 1)

So the basic for class utilizes a loop from a value to another value:

	child: For(
		from: 0,
		to: 5,
		create: (index){
			return Command('/say ' + index.toString())
// results in:
say 0
say 1
say 2
say 3
say 4
say 5

There is also an other Constructor for looping through a given list of widgets:

List of Widgetsloops through each of these Widgets


	child: For.of(List<Widget>[
		Command('say 1'),
		Command('say 2'),
		Command('say 3')
// results in:
say 1
say 2
say 3

CommandList #

But there is a more efficient way to list raw Minecraft commands. The CommandList Widget allows you to input a List of Commands, a List of Strings representing a command or a multiline string.

Lista list of commands or strings

This has basically the same function as For.of just for commands.

		Command('say 1'),
		Command('say 2'),
		Command('say 3')

But there is also a subset which accepts one big multiline string:

Stringlist of commands each on a seperate line
	/say 1
	/say 2
	/say 3

The slashes are automatically filtered out.

Group #

The group groups actions similar to for but has an option to prefix each action and encapsulate the content in a new file.

prefixa prefix type of String
childrenthe underlying widgets
[filename]the targeted filename(will be combined with an unique id)
[groupMin]the minimum amount of children to encapsulate(default = 3, set to -1 to disable)

If the children length is larger or equal groupMin a new file is created in /objD/(the working directory for objectiveD) and executed.

	prefix: "execute as @e run "
	children: List<Widget>[
		Command('say 1'),
		Command('say 2'),
		Command('say 3')
	filename: "asgroup",
	groupMin: 2

Entity #

constructorarguments are optional
selectorthe entity selector(e.g p,s,e or r)
limitnumber of matched entities
typeEntityType, id of the entity
areaA List of two Locations marking an area where the entity should be
distanceRange to the entity
levelRange of experience levels
gamemodeGamemode type(e.g Gamemode.creative, Gamemode.survival)
horizontalRotationRange of the horizontal facing direction
verticalRotationRange of the vertical facing direction
playerNamea String if you prefer to use a playername instead of arguments
sortadds a sort attribute of type Sort
storeResultCommand, path, useSuccess

storeResult stores a result or success of a command in the nbt path of an entity. Example:

	Command('say hello'),
	path: "Invisisble",

⇒ execute store success entity @s Invisisble run say hello

The Range class defines a range of values(e.g 3..10 in vanilla)

[to]Number for the maximum range
[from]Number for the minimal range
StringString representation of the type

There is also an EntityType for every type_id in minecraft with EntityType.[type_id]

	entity: Entity(
		selector: "e",
		limit: 1,
		type: EntityType.armor_stand,
		distance: Range(to:2),
		area: [
			// use null for a unlimited selection
			Location.glob(x: -10,y: null,z: -10), 
			Location.glob(x: 10, y: null, z: 10)
			// it also automatically calcs the distance between these
		level: Range(from: 1),
		gamemode: Gamemode.creative,
		horizontalRotation: Range(from:1),
		verticalRotation: Range(from: 20, to: 80),

⇒ say @e[limit=1,type=armor_stand,distance=..2,x=-10,z=-10,dx=20,dz=20,level=1..,gamemode=creative,y_rotation=1..,x_rotation=20..80,sort=random]
specific constructors
Entity.Selected(...)creates an entity with @s
Entity.Player(...)creates an entity with @p
Entity.PlayerName(String)creates an entity with an implicit name
Entity.All(...)creates an entity with @a
Entity.Random(...)creates an entity with @r

Scoreboard #

A scoreboard objective holds values, kind a like a Variable inside Minecraft. The Scoreboard class just handles adding or removing objectives. The value assignment is handled by the Score class.

Stringname of the objective(required)
typethe objective type (default = dummy)
displayTextComponent that displays the name
addIntoLoadbool whether the scoreboard should be added into your load file(default = true)

objD automatically keeps a list of all scoreboards and inserts them into the given load file, ignoring doubled names. Example:

type: "deathCount",
display: TextComponent("This is how many deaths you have:"),
addIntoLoad: true

// load.mcfunction:
/scoreboard objectives add death_count deathCount [{"text":"This is how many deaths you have:"}]

So the second scoreboard was not added because one "death_count" already existed.

The Scoreboard.add constructor does exactly the same but puts the result without checking in the current file.

Scoreboard.remove removes an objective by its name again.

With Scoreboard.setdisplay you can display the values:

Stringname of the objective(required)
displayString for display location (default = sidebar)

Score #

The score class is the basis for setting values, calculating with scores and checking the values. It implements one base class with no functionality and several methods to do actions:

Entitythe entity within the scoreboard
Stringthe name of the objective
addNewbool whether it should add the scoreboard itself if it does not exist(default = true)

With the addNew property it is not required to add a scoreboard before!

Calculations #

These methods can be used to set or calculate the value:

The following compare another Score

All of these methods return a new instance of Score with the calculations applied. So you can also chain single calculations or use multiple on one base Score.


// defining scores variables inside the widget
Score base = Score(Entity.Selected(),"score",addNew: true)
Score another = Score(Entity.Selected(),"score2")
// ... in the generate method:
⇒ scoreboard players set @s score 5
⇒ scoreboard players add @s score 3
⇒ scoreboard players remove @s score 10
⇒ scoreboard players reset @s score

⇒ scoreboard players operation @s score = @s score2
⇒ scoreboard players operation @s score >< @s score2
⇒ scoreboard players operation @s score > @s score2

⇒ scoreboard players operation @s score2 += @s score
⇒ scoreboard players operation @s score2 /= @s score
⇒ scoreboard players operation @s score2 %= @s score

// setToData must take in Data.get 
base.setToData(Data.get(Location("~ ~ ~"),"Items[0].Count"))
⇒ execute store result score @s score run data get block ~ ~ ~ Items[0].Count 1

// using success instead of result
base.setToResult(Command("say hi"),useSuccess:true) 
⇒ execute store success score @s score run say hi

Conditions #

These methods can be used for example with if to match values:

nameargumentsexample Result
matchesint@s score matches 5
matchesRangeRange@s score matches 0..20
isEqualScore@s score = @s score2
isSmallerScore@s score < @s score2
isSmallerOrEqualScore@s score <= @s score2
isBiggerScore@s score > @s score2
isBiggerOrEqualScore@s score >= @s score2

Block #

There is also a util class called Block which provides a wrapper for all available blocks in Minecraft. Usage:

Block([minecraft_block_id]) // as string or

All ids can be found here. But you can also insert a block by its string:

Stringthe minecraft block id


	location: Location.here()

Location #

In the block example we already used a class called Location. This translates into Minecraft Coordinates.

Stringthe minecraft coordinate string(e.g "~ ~ ~")
SetBlock(Block.stone,location: Location("~ 5 ~"))

There is also a shortcut for " ~ ~ ~ ":

Location.hereSelects the current Position
⇒ ~ ~ ~

But the Location class also provides a wrapper for global coordinates:

xa double defining the absolute x coordinate
ya double defining the absolute y coordinate
za double defining the absolute z coordinate
Location.glob(x: 5,y: 51.5,z: 784.20) 
⇒ 5 51.5 784.2

And also for relative coordinates:

xa double defining the relative x coordinate
ya double defining the relative y coordinate
za double defining the relative z coordinate
Location.rel(x: 5,y: 1.5,z: 0)
⇒ ~5 ~1.5 ~

And local coordinates(depends on the rotation of the head):

xa double defining the local x coordinate
ya double defining the local y coordinate
za double defining the local z coordinate
Location.local(x: 0,y: 1,z: 2.5)
⇒ ^ ^1 ^2.5

There is also a method for a location:

storeResultCommand, path, useSuccess
This stores a result or success of a command in the nbt path of a location.
Location.here().storeResult(Command('say hello'),path: "Items[0].tag.command",useSuccess:true)

⇒ execute store success block ~ ~ ~ Items[0].tag.command run say hello

Rotation #

The Rotation Widget is very similar to Location but takes in just two directions for an entities rotation:

Stringthe minecraft coordinate string(e.g "~ ~")
xint representing global x orientation
yint representing global y orientation
xint representing rotation relative to the current x orientation
yint representing rotation relative to the current y orientation


Rotation.rel(x: 90,y: 180)
⇒ ~90 ~180

	Command("tp @s ^ ^ ^10")
⇒ execute rotated 0 90 run command tp @s ^ ^ ^10

Data #

The Data Widgets allows you to edit nbt data of Entities or Blocks.

dynamicThe target Entity OR Block which you want to modify
nbtA Dart Map containing new nbt data
typeA String defining the operation type(default=merge)


	nbt: {
⇒ data merge entity @s {"Invisible":1,"NoGravity":1}

There are also subconstructors for each operation type(Data.merge, Data.get, Data.remove)

And the modify operation is also available, yet a bit more complex:

dynamicThe target Entity OR Location which you want to modify
paththe nbt path you want to modify
modifyA DataModify object defining which parameters you want to modify

So this is split up into a seperate class: DataModify There are five sub operations again: set, merge, prepend, append and insert. All follow this constructor rules:

dynamicThe source of the modification. Can be a Map, String, Number, Entity or Location
fromPathoptional path for the Entity or Location source from where to read the data

So we can for Example use

	path: "my_Custom_Path",
	modify: DataModify.set(
		"hey" // or {"nbt":"here"} or 56
⇒ data modify @s my_Custom_Path set value "hey"

Or So we can for Example use

	path: "my_Custom_Path2",
	modify: DataModify.insert(
		Entity.Selected(), // or Location... to get data from a block
		index: 2, // insert also needs an additional index
		fromPath: "my_Custom_Path"
// this just copies one property to another
⇒ data modify @s my_Custom_Path2 insert from entity @s my_Custom_Path

A handy shortcut for that is the Data.copy constructor, which just copies a property from one path to another:

dynamicThe target Entity OR Location which you want to modify
paththe nbt path you want to copy to
fromThe source Entity OR Block
fromPathThe source nbt path
	path: "my_Custom_Path2",
	from: Location("~ ~-1 ~"),
	fromPath: "Items[0].tag.display.name"
⇒ data modify @s my_Custom_Path2 set from block ~ ~-1 ~ Items[0].tag.display.name

Item #

The Item class represents an item in an inventory in Minecraft. It is used in the Give or Nbt Commands.

This Class is incomplete, more functionality soon...

ItemType |Block |Stringthe type of item(required, see example)
countInteger value for the amount of stacked items
slotThe current slot of the item(does not work for give)
damagethe used durability of the item
modelint describing which model varient should be used
nbtaddional NBT as Dart Map


	item: Item(
		ItemType.iron_axe, // OR Block.stone OR "whatever id"
		count: 5,
		damage: 40,
		model: 3390001,
		nbt: {

⇒ give @s minecraft:iron_axe{"customNBT":1,"Damage":40,"CustomModelData":3390001} 5

ItemType is like EntityType or Block a utility class to provide a list of all available blocks.

ItemType([minecraft_item_id])creates a ItemType from a String
ItemType.[minecraft_item_id]there is also an value for each item in Minecraft

Command Wrappers #

In this section are a few classes that build commands with inputs(Entities, Texts, Blocks, Locations).

Execute #

One of the most used commands has a widget too. The execute command has multiple syntaxes that allow to manipulate the position, executer or condition.

childrena List of children that should be executed(required)
encapsulateweither the children should be in an extra file for a certain length
asan Entity that runs the command
atan Entity from where the command should run
locationa Location or Entity from where to run the command
alignString with align statements e.g: "xyz"
anchoreither Facing.eyes or Facing.feet
facingA Location or Entity to rotate to
rotationA rotation of type Rotation
dimensionDimension of overworld, the_end or the_nether

All Execute classes are also an Group, so they will group commands in seperate files and allow multiple children. Example:

	as: Entity.player(),
	at: Entity.Selected(),
	location: Location.here(),
	align: "yz",
	anchor: Facing.eyes,
	facing: Location().glob(x:0,y:0,z:0)
	rotation: Rotation.rel(x:10,y:20),
	dimension: Dimension.the_nether
	children: List<Widget> [
		Command("/say I get executed")
		Say(msg:"Me too")

⇒ execute as @p at @s positioned ~ ~ ~ align yz anchored eyes facing 0 0 0 rotated ~10 ~20 in the_nether run say I get executed
  execute as @p at @s positioned ~ ~ ~ align yz anchored eyes facing 0 0 0 rotated ~10 ~20 in the_nether run say Me too
Execute. as
Entitythe entity from which the children should run
childrena List of children that should be executed
[encapsulate]same as base

This is just a different notation for Execute.

	children: List<Widget> [
		Command("/say I get executed")

⇒ execute as @p run say I get executed
Execute. at
Entitythe entity from where the children should run
childrena List of children that should be executed
[encapsulate]same as base
	children: List<Widget> [
		Command("/say I get executed")

⇒ execute at @p run say I get executed
Entitythe entity from which and where the children should run
childrena List of children that should be executed
[encapsulate]same as base

Asat combines as and at to just one entity.

	children: List<Widget> [
		Command("/say I get executed")

⇒ execute as @p at @s run say I get executed
Entity|Locationthe new position

Positioned sets the execution point of the command to a new Location or Entity.

	Entity.player(), // Location...
	children: List<Widget> [
		Command("/say I get executed")

⇒ execute positioned as @p run say I get executed
Stringrepresentation of the alignment

Aligns the position to the corners of the block grid.

FacingFacing.eyes or Facing.feet

Sets the execution position(^ ^ ^) to the eyes or the feet.

Entity or Locationthe target to face(required)
facingeither face the Facing.eyes(default) or Facing.feet

Sets the execution rotation so that it faces a location or an entity's feet or eyes. Example:

	Entity.player(), // or Location...
	facing: Facing.feet // optional
	children: List<Widget> [
		Command("/say I get executed")
⇒ execute facing entity @p feet run say I get executed
Rotationthe rotation object

Sets the execution rotation to the given rotation.

Dimensionthe given dimension type

Sets the execution dimension(execute in) to either Dimension.overworld, Dimension.the_end or Dimension.the_nether.

Methods #

All of these constructors are also available as methods with some additional utils:

centercenteres the alignment(middle of the block)

That means you can chain the actions, like with score, and use multiple actions at once:

// declaring the base
Execute ex = Execute(
		Command("say e")
// in the generate method:
⇒ execute as @a at @s align xyz positioned ~0.5 ~0.5 ~0.5 positioned ~ ~20 ~ run say Hello
   execute as @a at @s align xyz positioned ~0.5 ~0.5 ~0.5 positioned ~ ~20 ~ run say e

SetBlock #

The SetBlock Command Class sets a Block at the specified location:

Blockthe Block type you want to set
locationwhere you want to set the block


	location: Location.glob(
		x: 5,
		y: 0,
		z: 20
⇒ setblock 5 0 20 minecraft:stone

Fill #

Fill acts similar to setblock, but fills a whole area instead.

Blockthe fill material
fromone corner Location
tothe other corner Location

Tip: There are also constructors for Fill.destroy, Fill.hollow, Fill.outline and Fill.keep


	from: Location.glob(x: 0, y: 0, z: 0),
	to: Location.glob(x: 10, y: 20, z: 10)
⇒ fill 0 0 0 10 20 10 minecraft:dirt

You can also just replace specific other blocks:

...Everything the same
replacethe Block type you want to replace


	from: Location.glob(x: 0, y: 0, z: 0),
	to: Location.glob(x: 10, y: 20, z: 10),
	replace: Block.stone
⇒ fill 0 0 0 10 20 10 minecraft:dirt replace minecraft:stone

Say #

The Say Class writes a simple message or an entity in the chat.

msgMessage as String
entityenity of type Entity

You can't put both parameters in Say!


	msg: "Hello"
⇒ say Hello
	entity: Entity.Player()
⇒ say @p

Give #

Give a item to a player.

EntityThe player
itemthe Item you want to give(required)


	item: Item(
		count: 5

⇒ give @s minecraft:apple 5

Replaceitem #

Sets a specific container slot to a item.

  • for Entities:
EntityThe entity
itemthe Item you want to set(required)
slota String representation of the slot(required)


	slot: "hotbar.5"
	item: Item(
		count: 5,
		model: 339001

⇒ replaceitem entity @p hotbar.5 minecraft:apple{"CustomModelData":339001} 5 

replaceitem block will follow

Summon #

The summon class creates a new entity at a given location.

EntityTypethe type of entity(required)
locationthe location as type Location(default Location.here())
namea TextComponent respresenting the name of the entity
nbtadditional nbt as Map(key-value pairs)

This version is not final, there will be more properties in the future!


	location: Location.rel(x: 0,y:1,z:0),
	name: TextComponent("this is my name",color: Color.DarkBlue),
	nbt: {"Invisible":1}
⇒ summon armor_stand ~ ~1 ~ {"Invisible":1,"CustomName":"{\"text\":\"this is my name\",\"color\":\"dark_blue\"}"}

Teleport #

Sets the location of an Entity to a new Location.

Entitythe entity you want to teleport(required)
tothe target Location(required)
facinga Location or Entity to face


	to: Location.glob(x: 5, y: 10, z: 5),
	facing: Location.here()
⇒ tp @p 5 10 5 facing ~ ~ ~

And you can also teleport to another entity:

Entitythe entity you want to teleport(required)
tothe target entity(required)
facinga Location or Entity to face
	to: Entity(name: "target", limit: 1)
⇒ tp @p @e[name="target",limit=1]

Texts and Strings #

In Minecraft text in the chat or as title is defined with JSON-data. objD makes the JSON part of it easier by utilizing a few classes:

Stringthe text displayed (required)
colora the color of the type Color
boldbool whether it is bold
italicbool whether it is italic
underlinedbool whether it is underlined
strikethroughbool whether it is strikethrough
obfuscatedbool whether it is obfuscated
clickEventA TextClickEvent to handle left clicks
hoverEventA TextHoverEvent to handle mouse overs
insertiona String witch is inserted into the input if shift left clicked

Puuh, that are a lot of properties, we'll come to Color, TextClickEvent and TextHoverEvent in a bit.


	show: [
			color: Color.White,
			bold: true,
			underlined: true,
			strikethrough: false,
			obfuscated: false,
			clickEvent: TextClickEvent.open_url("https://stevertus.com"),
			hoverEvent: TextHoverEvent.text([TextComponent("hover me")]),
			insertion: "panic"
⇒ title @p title [{"text":"Hello","color":"white","bold":true,"italic":true,"underlined":true,"clickEvent":{"action":"open_url","value":"https://stevertus.com"},"hoverEvent":{"action":"text","value":[{text:"hover me"}]}}]

Now, its up to you to decide which is easier to read. There are also some other data sources: TODO: new 1.14 types!

Stringthe translate key (required)
conversionFlagsa List of strings that replace placeholder values(e.g $s)
...same properties...from TextComponent
Entitythe entity with the score(required)
objectiveName of the Scoreboard Objective(required)
...same properties...from TextComponent
	objective: "myscores",
⇒ {"score":{"name": "@s","objective":"myscores"},"color":"black"}
Entitythe entity whose name you want to display(required)
...same properties...from TextComponent
⇒ {"selector":"@e[name=hello]","color":"black"}

Colors #


See all available colors: https://minecraft.gamepedia.com/Formatting_codes#Color_codes



TextClickEvent #

Fires on left click, Part of TextComponent.

TextClickEvent.open_url(String)Opens the specified web url
TextClickEvent.run_command(Command)runs the command
TextClickEvent.suggest(Command)puts the command in the chat input
TextClickEvent.change_page(int)turns a books page to the value(just Books!)

TextHoverEvent #

Fires on mouse over, Part of TextComponent.

TextClickEvent.text(List)Accepts a new List of TextComponents to display
TextClickEvent.achievement(String)shows achievement
TextClickEvent.item(String)shows item(Warning!: Not final)
TextClickEvent.entity(String,String,String)displays a dummy entity with name, type and UUID(in this order))

Title #

To display our TextComponent, we need the /title command and the Title class wrapper.

selectorthe Entity for the title to show
showA List of TextComponents to show


	show: List<TextComponent>[
			color: Color.Black
⇒ title @p title [{"text":"hey","color":"black"}]

The same goes also for subtitle and actionbar:

Title.subtitle or Title.actionbar
selectorthe Entity for the title to show
showA List of TextComponents to show

Title.clear clears all titles again:

selectorclears title for the selector

Title.times sets the times

selectoredit the durations for this selector
fadeinthe fadein time in ticks(default 20)
displaythe time the title stays in ticks(default 60)
fadeoutthe fadeout time in ticks(default 20)

And also a resetter for that:

selectorresets times for this selector


	show: [
⇒ title @a actionbar [{"text":"hey"}]
⇒ title @e clear

⇒ title @a times 30 40 20

⇒ title @a reset

Tellraw #

The Tellraw class is very similar to the Title class, but shows its texts in the chat:

selectorthe Entity for the text to show
showA List of TextComponents to show


	show: List<TextComponent>[
			color: Color.Black
⇒ tellraw @p [{"text":"hey","color":"black"}]

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 'package:objd/core.dart';

main() {
      target: "./example/", name: "example Datapack", generate: mainWidget()));

class mainWidget extends Widget {
  Score hey2 = Score(Entity.PlayerName("hi"),"hey2");
  Widget generate(Context context) {
    return Pack(
      name: 'example',
      main: File(
        path: 'main',
        child: For.of([
          Execute.asat(Entity.All(),children: [hey2.get()]).anchored(Facing.feet).positioned(Location("~ ~10 ~")).dimension(Dimension.the_end),
          hey2.setToResult(Command("say hjey")),
              Entity.Player(area: [
                Location.glob(x: null, y: 10, z: 100)
              slot: "hotbar.0",
              item: Item(
                damage: 5,
                nbt: {"test": 1},
            path: "test",
            modify: DataModify.insert(
              Location("~ ~5 ~"),
              fromPath: "Items[0].id",
              index: 2,
        path: "load2",
        child: Scoreboard.add("hey5"),
      files: [
          path: "tes",
          child: For.of(
              Say(msg: "fgf"),
                first: true,
                child: Say(msg: "hey"),
            execute: true,
            path: 'test',
            child: Execute(
              as: Entity.Player(),
              at: Entity.Selected(),
              encapsulate: false,
              children: List.generate(
                (i) => SetBlock(
                      location: Location.rel(x: 0, y: i + 0.0, z: 0),

Use this package as a library

1. Depend on it

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

  objd: ^0.0.9

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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/block.dart';
import 'package:objd/basic/command.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/item.dart';
import 'package:objd/basic/location.dart';
import 'package:objd/basic/pack.dart';
import 'package:objd/basic/rotation.dart';
import 'package:objd/basic/score.dart';
import 'package:objd/basic/scoreboard.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/create_project.dart';
import 'package:objd/build/io.dart';
import 'package:objd/core.dart';
import 'package:objd/objD/comment.dart';
import 'package:objd/objD/data.dart';
import 'package:objd/objD/execute.dart';
import 'package:objd/objD/fill.dart';
import 'package:objd/objD/give.dart';
import 'package:objd/objD/replaceitem.dart';
import 'package:objd/objD/say.dart';
import 'package:objd/objD/setblock.dart';
import 'package:objd/objD/summon.dart';
import 'package:objd/objD/teleport.dart';
import 'package:objd/objD/tellraw.dart';
import 'package:objd/objD/title.dart';
import 'package:objd/objD/widgets.dart';
Version Uploaded Documentation Archive
0.0.9 Feb 18, 2019 Go to the documentation of objd 0.0.9 Download objd 0.0.9 archive
0.0.8 Feb 17, 2019 Go to the documentation of objd 0.0.8 Download objd 0.0.8 archive
0.0.7 Feb 16, 2019 Go to the documentation of objd 0.0.7 Download objd 0.0.7 archive
0.0.6 Feb 12, 2019 Go to the documentation of objd 0.0.6 Download objd 0.0.6 archive
0.0.5 Feb 9, 2019 Go to the documentation of objd 0.0.5 Download objd 0.0.5 archive
0.0.4 Feb 4, 2019 Go to the documentation of objd 0.0.4 Download objd 0.0.4 archive
0.0.3 Feb 3, 2019 Go to the documentation of objd 0.0.3 Download objd 0.0.3 archive
0.0.2 Feb 2, 2019 Go to the documentation of objd 0.0.2 Download objd 0.0.2 archive
0.0.1 Feb 2, 2019 Go to the documentation of objd 0.0.1 Download objd 0.0.1 archive
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 Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1


Detected platforms: Flutter, other

Platform components identified in package: io.

Health issues and suggestions

Document public APIs. (-0.48 points)

1550 out of 1578 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/basic/command.dart. (-1 points)

Analysis of lib/basic/command.dart reported 2 hints:

line 20 col 23: Use isNotEmpty instead of length

line 39 col 9: Use isNotEmpty instead of length

Fix lib/basic/item.dart. (-1 points)

Analysis of lib/basic/item.dart reported 2 hints:

line 16 col 23: Use isNotEmpty instead of length

line 22 col 23: Use isNotEmpty instead of length

Fix lib/basic/entity.dart. (-0.50 points)

Analysis of lib/basic/entity.dart reported 1 hint:

line 87 col 8: Use isNotEmpty instead of length

Fix additional 30 files with analysis or formatting issues. (-3.50 points)

Additional issues in the following files:

  • lib/basic/group.dart (1 hint)
  • lib/basic/score.dart (1 hint)
  • lib/basic/scoreboard.dart (1 hint)
  • lib/basic/text_components.dart (1 hint)
  • lib/build/build.dart (1 hint)
  • lib/objD/fill.dart (1 hint)
  • lib/objD/replaceitem.dart (1 hint)
  • lib/basic/block.dart (Run dartfmt to format lib/basic/block.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/location.dart (Run dartfmt to format lib/basic/location.dart.)
  • lib/basic/pack.dart (Run dartfmt to format lib/basic/pack.dart.)
  • lib/basic/rotation.dart (Run dartfmt to format lib/basic/rotation.dart.)
  • lib/basic/text.dart (Run dartfmt to format lib/basic/text.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/create_project.dart (Run dartfmt to format lib/build/create_project.dart.)
  • lib/build/io.dart (Run dartfmt to format lib/build/io.dart.)
  • lib/core.dart (Run dartfmt to format lib/core.dart.)
  • lib/objD/data.dart (Run dartfmt to format lib/objD/data.dart.)
  • lib/objD/execute.dart (Run dartfmt to format lib/objD/execute.dart.)
  • lib/objD/give.dart (Run dartfmt to format lib/objD/give.dart.)
  • lib/objD/say.dart (Run dartfmt to format lib/objD/say.dart.)
  • lib/objD/setblock.dart (Run dartfmt to format lib/objD/setblock.dart.)
  • lib/objD/summon.dart (Run dartfmt to format lib/objD/summon.dart.)
  • lib/objD/teleport.dart (Run dartfmt to format lib/objD/teleport.dart.)
  • lib/objD/tellraw.dart (Run dartfmt to format lib/objD/tellraw.dart.)
  • lib/objD/title.dart (Run dartfmt to format lib/objD/title.dart.)
  • lib/objD/widgets.dart (Run dartfmt to format lib/objD/widgets.dart.)

Maintenance issues and suggestions

Support the latest stable Dart SDK in pubspec.yaml. (-20 points)

The SDK constraint in pubspec.yaml doesn't allow the latest stable Dart SDK release.

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

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

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

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

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <=2.1.0
colorize ^2.0.0 2.0.0
meta ^1.1.7 1.1.7